private async void CmdParallelAsync_Click(object sender, RoutedEventArgs e) { var watch = Stopwatch.StartNew(); var results = await DownloadTasks.RunDownloadSiteParallelAsync(); PrintWebSiteInfo(results, txtBlockParallelAsync); watch.Stop(); var elapsedTime = watch.ElapsedMilliseconds; txtBlockParallelAsync.Text += $"Total Execution time {elapsedTime}{Environment.NewLine}"; }
private async void CmdAsync_Click(object sender, RoutedEventArgs e) { Progress <ProgressDataModel> progress = new Progress <ProgressDataModel>(); progress.ProgressChanged += ReportProgress; var watch = Stopwatch.StartNew(); try { //cancellationTokenSoure.IsCancellationRequested var results = await DownloadTasks.RunDownloadSiteAsync(progress, cancellationTokenSoure.Token); } catch (OperationCanceledException) { txtBlockAsync.Text += $"async download operation cancelled{Environment.NewLine}"; } //PrintWebSiteInfo(results, txtBlockAsync); watch.Stop(); var elapsedTime = watch.ElapsedMilliseconds; txtBlockAsync.Text += $"Total Execution time {elapsedTime}{Environment.NewLine}"; }