Beispiel #1
0
 private void task_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     if (InvokeRequired)
        {
     if (DateTime.Now - lastUpdate < new TimeSpan(0, 0, 0, 0, 300))
      return;
     lastUpdate = DateTime.Now;
     Invoke((EventHandler<ProgressChangedEventArgs>)task_ProgressChanged, sender, e);
     return;
        }
        ErasureTarget target = sender as ErasureTarget;
        if (target == null)
     return;
        SteppedProgressManager progress = target.Progress as SteppedProgressManager;
        if (progress == null)
     return;
        UpdateProgress(progress, e);
 }
 void task_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     if (scheduler.InvokeRequired)
        {
     Invoke((EventHandler<ProgressChangedEventArgs>)task_ProgressChanged, sender, e);
     return;
        }
        ErasureTarget target = (ErasureTarget)sender;
        schedulerProgress.Value = (int)(target.Task.Progress.Progress * 1000.0);
 }
Beispiel #3
0
 private void UpdateProgress(SteppedProgressManager targetProgress, ProgressChangedEventArgs e)
 {
     TaskProgressChangedEventArgs e2 = (TaskProgressChangedEventArgs)e.UserState;
        status.Text = targetProgress.CurrentStep.Name;
        if (e2 != null)
        {
     item.Text = WrapItemName(e2.ItemName);
     pass.Text = e2.ItemTotalPasses != 0 ?
      S._("{0} out of {1}", e2.ItemPass, e2.ItemTotalPasses) :
      e2.ItemPass.ToString(CultureInfo.CurrentCulture);
        }
        if (targetProgress.TimeLeft >= TimeSpan.Zero)
     timeLeft.Text = S._("About {0} left", RoundToSeconds(targetProgress.TimeLeft));
        else
     timeLeft.Text = S._("Unknown");
        if (targetProgress.Progress >= 0.0f)
        {
     itemProgress.Style = ProgressBarStyle.Continuous;
     itemProgress.Value = (int)(targetProgress.Progress * 1000);
     itemProgressLbl.Text = targetProgress.Progress.ToString("#0%",
      CultureInfo.CurrentCulture);
        }
        else
        {
     itemProgress.Style = ProgressBarStyle.Marquee;
     itemProgressLbl.Text = string.Empty;
        }
        overallProgress.Value = (int)(task.Progress.Progress * 1000);
        overallProgressLbl.Text = S._("Total: {0,2:#0.00%}", task.Progress.Progress);
 }