Example #1
0
 public static void InvokeIfRequired(this frmAutomaticMode mForm, Action <frmAutomaticMode> action)
 {
     if (mForm.InvokeRequired)
     {
         try
         {
             mForm.Invoke(new Action(() => action(mForm)));
         }
         catch (ObjectDisposedException)
         {
             // Ignore.  Control is disposed cannot update the UI.
         }
     }
     else
     {
         action(mForm);
     }
 }
Example #2
0
        void StartAutomaticMode()
        {
            if (GR.Instance.BalanceSerialPort.SerialPortActive)
            {
                bool fillingCompleted;
                using (var frm = new frmAutomaticMode(this.ctrlGroupSelect1.SelectedGroup))
                {
                    frm.ShowDialog();
                    fillingCompleted = frm.FillingCompleted;
                }

                if (fillingCompleted)
                {
                    using (var frm2 = new frmWaitingTime())
                    {
                        frm2.ShowDialog();
                    }
                }
            }
            else
            {
                MessageBox.Show("Serial port not connected");
            }
        }