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

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

                if (PLC_Com_AP.BaffleOriginResetIsOK())
                {
                    csMsg.ShowInfo("原点返回完成", false);
                    tbPulse_Baffle_Lift_Now.Text = PLC_Com_AP.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 = sp_PD.Visibility = sp_Error_PD.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_AP.ThrowMsg   += new PLC_Tcp_AP.ShowMsg(MsgChanged);
            PLC_Com_AP.ThrowMsg   += new PLC_Com_AP.ShowMsg(MsgChanged);
            DPJ_AP.ThrowMsg       += new DPJ_AP.ShowMsg(MsgChanged);
            Scanner.ThrowMsg      += new Scanner.ShowMsg(MsgChanged);
            Laser.ThrowMsg        += new Laser.ShowMsg(MsgChanged);
            CSHelper.SQL.ThrowMsg += new CSHelper.SQL.ShowMsg(MsgChanged);
            OutDrug_AP.ThrowMsg   += new OutDrug_AP.ShowMsg(MsgChanged);

            UCDebug_Add.ShowKey  += new UCDebug_Add.SetKey(KeyShow);
            UCAdd.ShowKey        += new UCAdd.SetKey(KeyShow);
            UCOut_Manual.ShowKey += new UCOut_Manual.SetKey(KeyShow);
            UCDebug_Out.ShowKey  += new UCDebug_Out.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_AP.ExtramanOriginReset();
                    Thread.Sleep(1000);
                    PLC_Tcp_AP.PlateOriginReset();
                }
                else
                {
                    PLC_Tcp_AP.LiftOriginReset();
                    Thread.Sleep(1000);
                    PLC_Com_AP.BaffleOriginReset_Lift();
                }
            }
        }