示例#1
0
        private void btZero_Baffle_Lift_Click(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;
            if (PLC_Com_CP.BaffleOriginReset_Lift())
            {
                DateTime timeBegin = DateTime.Now;
                Thread.Sleep(1000);

                while (!PLC_Com_CP.BaffleOriginResetIsOK())
                {
                    if (DateTime.Now > timeBegin.AddSeconds(Config.Mac_C.WaitTime_Reset_Baffle))
                    {
                        break;
                    }
                    Thread.Sleep(500);
                }

                if (PLC_Com_CP.BaffleOriginResetIsOK())
                {
                    csMsg.ShowInfo("原点返回完成", false);
                    tbPulse_Baffle_Lift_Now.Text = PLC_Com_CP.ReadBafflePulse_Lift().ToString();
                }
                else
                {
                    csMsg.ShowWarning("原点返回失败", false);
                }
            }
            else
            {
                csMsg.ShowWarning("指令发送失败", false);
            }
            Cursor = null;
        }
示例#2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            timer_Monitor.Interval = TimeSpan.FromSeconds(3);
            timer_Monitor.Tick    += new EventHandler(timer_Monitor_Tick);
            timer_Monitor.Start();

            grid_Monitor.Visibility = Visibility.Collapsed;
            if (Config.Soft.Function == "I")
            {
                sp_Out_Auto.Visibility = sp_Out_Manul.Visibility = sp_Error_Out.Visibility = Visibility.Hidden;
                grid_Lift.Visibility   = grid_Max_Baffle.Visibility = grid_Min_Baffle.Visibility = Visibility.Collapsed;
            }
            else
            {
                sp_Add_List.Visibility = sp_Add.Visibility = Visibility.Hidden;
                grid_X.Visibility      = grid_Z.Visibility = grid_Left.Visibility = grid_Right.Visibility = grid_ZHA.Visibility = Visibility.Collapsed;

                ellipseGM.Visibility = tb_GM.Visibility = Visibility.Collapsed;
            }

            PLC_Tcp_CP.ThrowMsg += new PLC_Tcp_CP.ShowMsg(MsgChanged);
            PLC_Com_CP.ThrowMsg += new PLC_Com_CP.ShowMsg(MsgChanged);
            DPJ_CP.ThrowMsg     += new DPJ_CP.ShowMsg(MsgChanged);
            //Scanner.ThrowMsg += new Scanner.ShowMsg(MsgChanged);
            //Laser.ThrowMsg += new Laser.ShowMsg(MsgChanged);
            CSHelper.SQL.ThrowMsg += new CSHelper.SQL.ShowMsg(MsgChanged);
            OutDrug_CP.ThrowMsg   += new OutDrug_CP.ShowMsg(MsgChanged);

            UCDebug_Add_CP.ShowKey  += new UCDebug_Add_CP.SetKey(KeyShow);
            UCAdd_CP.ShowKey        += new UCAdd_CP.SetKey(KeyShow);
            UCOut_Manual_CP.ShowKey += new UCOut_Manual_CP.SetKey(KeyShow);
            UCDebug_Out_CP.ShowKey  += new UCDebug_Out_CP.SetKey(KeyShow);

            if (Config.Soft.Function == "O")
            {
                ellipseGM.Visibility = Visibility.Collapsed;
                tb_GM.Visibility     = Visibility.Collapsed;
            }

            if (csMsg.ShowQuestion("设备在断电后的第一次启动时,运动部件需要原点复位。\r\n是否要原点复位?", false))
            {
                if (Config.Soft.Function == "I")
                {
                    PLC_Tcp_CP.ExtramanOriginReset();
                    Thread.Sleep(1000);
                    PLC_Tcp_CP.PlateOriginReset();
                }
                else
                {
                    PLC_Tcp_CP.LiftOriginReset();
                    Thread.Sleep(1000);
                    PLC_Com_CP.BaffleOriginReset_Lift();
                }
            }
        }