Exemplo n.º 1
0
 protected virtual void OnProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     CrossThreadingHelpers.InvokeControl(ProgressBar1, e.ProgressPercentage, (x) =>
     {
         ProgressBar1.Value = (int)x;
         ProgressChanged?.Invoke(sender, e);
     });
 }
Exemplo n.º 2
0
        public void WriteText(string text)
        {
            var pars = new ArrayList();

            pars.Add(text);
            CrossThreadingHelpers.InvokeControl(this, pars, (x) =>
            {
                ArrayList input = (ArrayList)x;
                string str      = (string)input[0];
                AppendText(str);
                ScrollToCaret();
            });
        }
Exemplo n.º 3
0
 protected virtual void OnAborted(object sender, EventArgs e)
 {
     CrossThreadingHelpers.InvokeControl((Control)sender, null, (x) =>
     {
         if (backWorker.IsBusy && !backWorker.CancellationPending)
         {
             if (CanAbort)
             {
                 backWorker.CancelAsync();
                 ProgressBar1.Enabled = false;
                 Aborted?.Invoke(sender, e);
             }
         }
     });
 }
Exemplo n.º 4
0
 public void NextStep(bool marquee)
 {
     if (ListView1.Items.Count > CurrentStepIndex + 1)
     {
         CurrentStepIndex++;
         if (marquee)
         {
             CrossThreadingHelpers.InvokeControl(ProgressBar1, null, (x) =>
             {
                 ProgressBar1.Style = ProgressBarStyle.Marquee;
             });
         }
         else
         {
             ReportProgress(0);
             CrossThreadingHelpers.InvokeControl(ProgressBar1, null, (x) => { ProgressBar1.Style = ProgressBarStyle.Blocks; });
         }
     }
 }