Beispiel #1
0
 private async Task PerformLengthyTaskAsync(RefToFunction toFunction)
 {
     for (int i = 0; i < 2; i++) // 2 sec task
     {
         await Task.Delay(1000); // wait for 1 sec
     }
     toFunction.Invoke();
 }
Beispiel #2
0
        private async void btnGenerate_ClickAsync(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(ReportName))
            {
                MessageBox.Show(this, "Please, select a template before generate a report.", "Atention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }
            else
            {
                pgbWorking.IsIndeterminate = true;
                pgbWorking.Visibility      = Visibility.Visible;
                btnGenerate.IsEnabled      = false;
                RefToFunction toFunction = new RefToFunction(OnReponse);

                await PerformLengthyTaskAsync(toFunction);

                GenerateReport();
            }
        }