コード例 #1
0
 public StateObjClass(frmWaitingTime frmWaiting)
 {
     _frmWaiting              = frmWaiting;
     _timerReference          = new Timer();
     _timerReference.Tick    += (sender, e) => { OnTimedEvent(this); };
     _timerReference.Interval = 1000;
     _timerReference.Enabled  = true;
     _timerReference.Start();
 }
コード例 #2
0
ファイル: ExtensionMethods.cs プロジェクト: xhominum/Robot
 public static void InvokeIfRequired(this frmWaitingTime mForm, Action <frmWaitingTime> action)
 {
     if (mForm.InvokeRequired)
     {
         try
         {
             mForm.Invoke(new Action(() => action(mForm)));
         }
         catch (ObjectDisposedException)
         {
             // Ignore.  Control is disposed cannot update the UI.
         }
     }
     else
     {
         action(mForm);
     }
 }
コード例 #3
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");
            }
        }