Пример #1
0
 protected virtual void OnProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     CrossThreadingHelpers.InvokeControl(ProgressBar1, e.ProgressPercentage, (x) =>
     {
         ProgressBar1.Value = (int)x;
         ProgressChanged?.Invoke(sender, e);
     });
 }
Пример #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();
            });
        }
Пример #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);
             }
         }
     });
 }
Пример #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; });
         }
     }
 }