public static Thread LaunchForm(InventoryForm form)
        {
            if (form == null) throw new ArgumentNullException("form");

            inv = form;

            //if (MsgThread != null) return MsgThread;

            MessageForm.msgThread = new Thread(MsgThreadProc);
            MsgThread.Name = "MessageForm";
            MsgThread.Priority = ThreadPriority.Highest;
            MsgThread.IsBackground = false;
            MsgThread.Start();
            return MsgThread;
        }
 private void btn_inv_Click(object sender, EventArgs e)
 {
     this.Hide();
     using (InventoryForm InvForm = new InventoryForm(false))
     {
         InvForm.ShowDialog();
     }
     UpdatePower();
     this.Show();
 }
 void MainForm_OnButtonEnable(object sender, InventoryForm.OnButtonClickEventArgs e)
 {
     ButtonHandle(e.State, e.Enable);
 }
 private void ButtonHandle(InventoryForm.ButtonState btnState, bool en)
 {
     if (this.InvokeRequired)
     {
         Invoke(new OnButtonHandleDeleg(ButtonHandle), new object[] { btnState , en});
         return;
     }
     switch (btnState)
     {
         case InventoryForm.ButtonState.Clear:
             btn_clear.Enabled = en;
             break;
         case InventoryForm.ButtonState.Save:
             btn_save.Enabled = en;
             break;
         case InventoryForm.ButtonState.Select:
             btn_select.Enabled = en;
             break;
         case InventoryForm.ButtonState.Start:
             btn_once.Enabled = btn_run.Enabled = en;
             break;
         case InventoryForm.ButtonState.Stop:
             btn_stop.Enabled = en;
             break;
         case InventoryForm.ButtonState.ALL:
             this.Enabled = en;
             break;
         default: break;
     }
 }
        public static Thread LaunchControlPanel(InventoryForm form)
        {
            if (form == null)
                throw new ArgumentNullException("form");

            if (ControlPanelThread != null) return ControlPanelThread;

            _mainForm = form;

            ControlPanelForm._controlPanelThread = new Thread(ControlPanelThreadProc);
            ControlPanelThread.Name = "ControlPanel";
            ControlPanelThread.Priority = ThreadPriority.Highest;
            ControlPanelThread.IsBackground = false;
            ControlPanelThread.Start();
            return ControlPanelThread;
        }