Example #1
0
 public void ShowAlarms(bool reShow = false)
 {
     if (reShow)
     {
         FormMgr.GetForm <AlarmForm>().Visible = false;
     }
     if (FormMgr.GetForm <AlarmForm>().Visible)
     {
         return;
     }
     FormMgr.GetForm <AlarmForm>().AddControl(this.alarmControl).Show(this);
 }
Example #2
0
 private void BtnJog_Click(object sender, EventArgs e)
 {
     FormMgr.Show <JogForm>(this);
     FormMgr.GetForm <JogForm>().UpdateUI();
 }
Example #3
0
 public void HandleMsg(string msgName, IMsgSender sender, params object[] args)
 {
     // 更新硬件信息
     if (msgName == MachineMsg.SETUP_INFO)
     {
         OnSetupInfo();
     }
     // 加载程序
     else if (msgName == Constants.MSG_LOAD_PROGRAM)
     {
         string programPath = args[0] as string;
         OnLoadProgram(programPath);
     }
     // 退出AFM
     else if (msgName == MsgType.EXIT)
     {
         this.Close();
     }
     // 进入主界面
     else if (msgName == MsgType.ENTER_MAIN)
     {
         OnEnterMainPage();
     }
     // 进入编程界面
     else if (msgName == MsgType.ENTER_EDIT)
     {
         OnEnterEditPage();
     }
     // 初始化相机
     else if (msgName == MachineMsg.INIT_VISION)
     {
         //this.CameraCtl.SetupCamera(Machine.Instance.Camera);
         //this.CameraCtl.UpdateUI();
     }
     // 切换语言
     else if (msgName == LngMsg.SWITCH_LNG)
     {
         this.Config.Lang = (LanguageType)args[0];
         this.SwitchConfig();
         this.SaveConfig();
         //this.CameraCtl.UpdateUI();
         CameraForm cameraForm = FormMgr.GetForm <CameraForm>();
         JogForm    jogForm    = FormMgr.GetForm <JogForm>();
         cameraForm.UpdateUI();
         jogForm.UpdateUI();
         if (!cameraForm.Visible)
         {
             cameraForm.Close();
         }
         if (!jogForm.Visible)
         {
             jogForm.Close();
         }
         this.ReadLanguageResources();
     }
     //切换了用户或修改了权限表需要更新界面
     else if (msgName == MsgConstants.SWITCH_USER || msgName == MsgConstants.MODIFY_ACCESS)
     {
         //只有Jog和Camera2个非模态窗口,相机界面无运行时参数,所以只需要更新Jog界面。
         JogForm jogForm = FormMgr.GetForm <JogForm>();
         jogForm.UpdateUI();
         if (!jogForm.Visible)
         {
             jogForm.Close();
         }
     }
     else if (msgName == Domain.MsgType.MSG_FIND_MARK_FIALED)
     {
         this.onFindMarkFailed(args[0] as Pattern, args[1] as Mark);
     }
     else if (msgName == Domain.MsgType.MSG_BLOBS_FIALED)
     {
         this.onFindBlobsFailed(args[0] as Blobs);
     }
     else if (msgName == Domain.MsgType.MSG_FIND_BARCODE_FIALED)
     {
         if (args[1] is Barcode)
         {
             this.onFindBarcodeFailed(args[0] as Pattern, args[1] as Barcode);
         }
         else if (args[1] is ConveyorBarcode)
         {
             this.onFindBarcodeFailed(args[0] as Pattern, args[1] as ConveyorBarcode);
         }
     }
 }