public void UpdateProgress(Object argData) { AriaData data = (AriaData)argData; if (data.Progress > 0) { prgBrStatus.Style = ProgressBarStyle.Continuous; prgBrStatus.Value = data.Progress; } lblStatus.Text = String.Format("{0}%", data.Progress); FileSize totalCompleted = new FileSize((grdQueue.DataSource as IList <QueueItem>).Where(q => q.State == JobState.Completed).Sum(q => q.Size.Size)); FileSize total = new FileSize((grdQueue.DataSource as IList <QueueItem>).Where(q => q.State != JobState.Failed).Sum(q => q.Size.Size)); FileSize totalRemaining = total - totalCompleted; txtAriaData.Text = String.Format("Downloaded: {0} | Speed: {1} | ETA: {2} | Total {3} / {4} | Remaining {5}", data.Downloaded, data.Speed, data.ETA, totalCompleted, total, totalRemaining); if (data.Progress > 0) { gTaskbarProgress.SetState(this, gTaskbarProgress.TaskbarStates.Normal); gTaskbarProgress.SetValue(this, Convert.ToUInt64(data.Progress), (UInt64)100); } grdQueue.Refresh(); Application.DoEvents(); }
private void AriaHelper_AriaProgressUpdated(AriaData argData) { this.Invoke(new UpdateProgressDelegate(UpdateProgress), new object[] { argData }); }