Async methods with progress bar

Can be used in both WHO and BusinessObject. The property isIndeterminate is set as true when the number of steps is unknown or when a single step takes a long time.

public async void Generate()
{
    if (ValidateGenerateInput() == false) return;

    var year = PromptForYear();
    if (year == null) return;

    using (var progress = new Progress(l.Translate("Generieren ..."), isIndeterminate: true))
    {
        var selectedDaysOfWeek = GetSelectedDaysOfWeek();
        await BusObj.Generate(year.Value, selectedDaysOfWeek);

        if (year != yearlyCalendarView.SelectedYear) return;

        RefreshDetailsForSelectedYear();
    }
}

Last updated