private void SetProgressBarParams(ProgressBar pb, int minimum, int maximum, int step)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (pb.InvokeRequired)
     {
         SetProgressBarParamsCallback d = new SetProgressBarParamsCallback(SetProgressBarParams);
         pb.BeginInvoke(d, new object[] { pb, minimum, maximum, step });
     }
     else
     {
         pb.Minimum = minimum;
         pb.Maximum = maximum;
         pb.Step = step;
     }
 }
Esempio n. 2
0
 /// /////////////////////////////////////////////////////////////////
 public void SetValue(int nValue)
 {
     m_progressBar.BeginInvoke((MethodInvoker) delegate
     {
         try
         {
             m_progressBar.Value = m_gestionnaireSegments.GetValeurReelle(nValue);
             m_progressBar.Refresh();
         }
         catch { }
     });
 }
 void UpdateProgressBar()
 {
     if (_ProgressBar.InvokeRequired)
     {
         MethodInvoker updateProgressBar =
             UpdateProgressBar;
         _ProgressBar.BeginInvoke(updateProgressBar);
     }
     else
     {
         _ProgressBar.Increment(1);
     }
 }
Esempio n. 4
0
 private void UpdateProgressBar(ProgressBar bar, int maxValue, int current)
 {
     if (bar.InvokeRequired)
     {
         bar.BeginInvoke(new Action<ProgressBar, int, int>(UpdateProgressBar), bar, maxValue, current);
     }
     else
     {
         bar.Maximum = maxValue;
         bar.Value = current;
         bar.Update();
         bar.Parent.Update();
     }
 }
Esempio n. 5
0
 /// /////////////////////////////////////////////////////////////////
 public void SetValue(int nValue)
 {
     m_progressBar.BeginInvoke((MethodInvoker) delegate
     {
         try
         {
             m_progressBar.Value = m_gestionnaireSegments.GetValeurReelle(nValue);
             Text = m_progressBar.Value.ToString() + "% " + "Traitement en cours";
             Refresh();
             m_progressBar.Refresh();
         }
         catch { }
     });
 }
 private void SetProgressBarValue(ProgressBar pb, int value)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (pb.InvokeRequired)
     {
         SetProgressBarValueCallback d = new SetProgressBarValueCallback(SetProgressBarValue);
         pb.BeginInvoke(d, new object[] { pb, value });
     }
     else
     {
         pb.Value = value;
     }
 }
 private void ProgressBarPerformStep(ProgressBar pb)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (pb.InvokeRequired)
     {
         ProgressBarPerformStepCallback d = new ProgressBarPerformStepCallback(ProgressBarPerformStep);
         pb.BeginInvoke(d, new object[] { pb });
     }
     else
     {
         if (pb.Value >= pb.Maximum)
         {
             pb.Value = pb.Minimum;
         }
         pb.PerformStep();
     }
 }