private async void ExecuteParallelAsync_Click(object sender, RoutedEventArgs e) { if (cancellationTokenSource.IsCancellationRequested) cancellationTokenSource = new CancellationTokenSource(); var watch = System.Diagnostics.Stopwatch.StartNew(); await DemoMethods.RunDownloadParallelAsync(); watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; resultsWindow.Text += $"PARALLEL Total execution time: { elapsedMs }"; }
private async void ExecuteParallelAsync_Click(object sender, RoutedEventArgs e) { var watch = System.Diagnostics.Stopwatch.StartNew(); Progress <ProgressReportModel> progress = new Progress <ProgressReportModel>(); progress.ProgressChanged += ReportProgress; var results = await DemoMethods.RunDownloadParallelAsync(progress); PrintResults(results); watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; resultsWindow.Text += $"Total execution time: { elapsedMs }"; }