Example #1
0
 public MainForm()
 {
     InitializeComponent();
     filterString = txtFilter.Text;
     msgHandler = new ShowMessageHandler(ShowMsg);
     pbHandler = new ShowProgressHandler(UpdatePb);
 }
Example #2
0
        void ShowProgress(object sender, ShowProgressArgs e)
        {
            // Make sure we're on the UI thread
            if (_pi.InvokeRequired == false)
            {
                _pi.Text            = e.Pi;
                _piProgress.Maximum = e.TotalDigits;
                _piProgress.Value   = e.DigitsSoFar;

                // Check for Cancel
                e.Cancel = (_state == CalcState.Canceled);

                // Check for completion
                if (e.Cancel || (e.DigitsSoFar == e.TotalDigits))
                {
                    _state              = CalcState.Pending;
                    _calcButton.Text    = "Calc";
                    _calcButton.Enabled = true;
                }
            }
            else
            {
                // Get ready to show progress asynchronously
                ShowProgressHandler showProgress = new ShowProgressHandler(ShowProgress);
                // Show progress
                Invoke(showProgress, new object[] { sender, e });
            }
        }
Example #3
0
 public void DisplayProgress(int Val)
 {
     if (this.DBT_Progress.InvokeRequired)
     {
         ShowProgressHandler sph = new ShowProgressHandler(ShowProgress);
         sph.Invoke(Val);
     }
     else
     {
         ShowProgress(Val);
     }
 }
Example #4
0
 public void ShowProgress(int CurrCount, int TabCount)
 {
     if (this.PB_Generate.InvokeRequired)
     {
         if (ShowProgressMethod == null)
         {
             ShowProgressMethod = new ShowProgressHandler(SetPro);
         }
         ShowProgressMethod.Invoke(CurrCount, TabCount);
     }
     else
     {
         SetPro(CurrCount, TabCount);
     }
 }
Example #5
0
 private void StartProcess()
 {
     if (pbStatus.InvokeRequired)
     {
         var del = new ShowProgressHandler(StartProcess);
         this.BeginInvoke(del);
     }
     else
     {
         this.Refresh();
         this.pbStatus.Maximum = _Max;
         for (int i = 0; i <= _Max; i++)
         {
             Thread.Sleep(10);
             this.lblOutput.Text = i.ToString();
             this.pbStatus.Value = i;
         }
     }
 }
Example #6
0
 public MainForm()
 {
     InitializeComponent();
     msgHandler = new ShowMessageHandler(ShowMsg);
     pbHandler  = new ShowProgressHandler(UpdatePb);
 }
Example #7
0
 public MainForm()
 {
     InitializeComponent();
     msgHandler = new ShowMessageHandler(ShowMsg);
     pbHandler = new ShowProgressHandler(UpdatePb);
 }