private void Downloader_DownloadProgressChanged(object sender, DownloadProgressChangedArg e) { int total = e.LeftTasksCount + e.DoneTaskCount; ProgressMaximum = total; ProgressValue = e.DoneTaskCount; Percentage = (double)e.DoneTaskCount / (e.DoneTaskCount + e.LeftTasksCount); }
private void Downloader_DownloadProgressChanged(object sender, DownloadProgressChangedArg e) { this.Dispatcher.Invoke(new Action(() => { this.progressBar.Maximum = e.TaskCount; this.progressBar.Value = e.TaskCount - e.LastTaskCount; this.progressPerTextBlock.Text = ((double)(e.TaskCount - e.LastTaskCount) / (double)e.TaskCount).ToString("0%"); Tasks.Remove(e.DoneTask); })); }
private void Downloader_DownloadProgressChanged(object sender, DownloadProgressChangedArg e) { Dispatcher.Invoke(new Action(() => { progressBar.Maximum = e.TaskCount; progressBar.Value = e.TaskCount - e.LastTaskCount; double progress = (e.TaskCount - e.LastTaskCount) / (double)e.TaskCount; if (progress > 0) { TaskbarManager.SetProgressValue((int)(progress * 100), 100, CriticalHandle); } progressPerTextBlock.Text = progress.ToString("0%"); Tasks.Remove(e.DoneTask); })); }