예제 #1
0
 private void btStop_Click(object sender, RoutedEventArgs e)
 {
     btUp.IsEnabled   = true;
     btStop.IsEnabled = false;
     btDown.IsEnabled = true;
     PLC_SP.Turn(PLC_SP.TurnType.Stop);
 }
예제 #2
0
        void Turn_Click(object sender, RoutedEventArgs e)
        {
            Button bt  = sender as Button;
            string lay = bt.Tag.ToString();

            PLC_SP.TurnTo(int.Parse(lay));
        }
예제 #3
0
        void b_Click(object sender, RoutedEventArgs e)
        {
            Button bt  = sender as Button;
            int    lay = int.Parse(bt.Tag.ToString());

            PLC_SP.TurnTo(lay);
        }
예제 #4
0
        void Set_Click(object sender, RoutedEventArgs e)
        {
            Button bt  = sender as Button;
            string lay = bt.Tag.ToString();

            if (csMsg.ShowQuestion("确定要设置该层脉冲吗?", false))
            {
                //读取当前脉冲
                int pulse = PLC_SP.ReadNowPulse();
                PLC_SP.SavePulse(int.Parse(lay), pulse);
            }
        }
예제 #5
0
        private void Test()
        {
            int nowLay = PLC_SP.ReadNowLay();

            if (ToLay == 0 || nowLay == ToLay)
            {
                Random r = new Random();
                int    i = r.Next(11);
                i = (i * 2) - 1;
                PLC_SP.TurnTo(i);
            }
        }
예제 #6
0
        public WinMain_SP()
        {
            InitializeComponent();

            if (!csSql.SQLIsConnected(Config.Soft.ConnString))
            {
                csMsg.ShowWarning("服务器未连接", true);

                Application.Current.Shutdown();
            }
            Config.InitialConfig_Mac_S();

            if (Config.Mac_S.PLCIsEnable == "Y")
            {
                PLC_SP.Initial();
            }
        }
예제 #7
0
 private void ShowMonitor()
 {
     if (Config.Mac_S.PLCIsEnable == "Y")
     {
         //光幕监控
         gm_new = PLC_SP.GMIsProtected();
         if (gm_new != gm_old)
         {
             gm_old = gm_new;
             ShowGM(gm_new);
         }
         //急停监控
         stop_new = PLC_SP.MacIsStopped();
         if (stop_new != stop_old)
         {
             stop_old = stop_new;
             ShowStop(stop_new);
         }
     }
 }
예제 #8
0
        void b_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Ellipse b = sender as Ellipse;

            string[] ss = b.Tag.ToString().Split(new char[] { '-' });
            int      i  = Math.Abs(int.Parse(ss[2]) - 1);

            b.Tag = ss[0] + "-" + ss[1] + "-" + i.ToString();
            switch (i)
            {
            case 0:
                b.Fill = new SolidColorBrush(Color.FromArgb(150, 128, 128, 128));
                PLC_SP.LightSingleNum(int.Parse(ss[0]), int.Parse(ss[1]), PLC_SP.LightType.Close);
                break;

            case 1:
                b.Fill = new SolidColorBrush(Color.FromArgb(150, 220, 20, 60));
                PLC_SP.LightSingleNum(int.Parse(ss[0]), int.Parse(ss[1]), PLC_SP.LightType.Open);
                break;
            }
        }
예제 #9
0
        private void btZero_Click(object sender, RoutedEventArgs e)
        {
            Cursor = Cursors.Wait;
            PLC_SP.BackZero();
            DateTime timeBegin = DateTime.Now;

            Thread.Sleep(1000);

            while (!PLC_SP.BackZeroIsFinished())
            {
                if (DateTime.Now > timeBegin.AddSeconds(60))
                {
                    csMsg.ShowWarning("原点返回超时", false);
                    break;
                }
                Thread.Sleep(1000);
            }

            if (PLC_SP.BackZeroIsFinished())
            {
                csMsg.ShowInfo("原点返回完成", false);
            }
            Cursor = null;
        }
예제 #10
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            timer_Pulse.Interval = TimeSpan.FromSeconds(2);
            timer_Pulse.Tick    += new EventHandler(timer_Pulse_Tick);

            timer_Test.Interval = TimeSpan.FromSeconds(3);
            timer_Test.Tick    += new EventHandler(timer_Test_Tick);

            if (Config.Mac_S.PLCIsEnable == "Y")
            {
                tbPulse.Text = PLC_SP.ReadNowPulse().ToString();
                tbLayer.Text = PLC_SP.ReadNowLay().ToString();
                timer_Pulse.Start();
            }

            if (Config.Mac_S.ShowTest == "N")
            {
                btStart_Test.Visibility = btStop_Test.Visibility = Visibility.Hidden;
            }

            ShowLayerSet();
            ShowLayerTurn();
            ShowLasers();
        }
예제 #11
0
 private void UserControl_Unloaded(object sender, RoutedEventArgs e)
 {
     PLC_SP.LightAllNum(PLC_SP.LightType.Close);
 }
예제 #12
0
 private void btAllOff_Click(object sender, RoutedEventArgs e)
 {
     PLC_SP.LightAllNum(PLC_SP.LightType.Close);
 }
예제 #13
0
 private void btPerimeter_Click(object sender, RoutedEventArgs e)
 {
     PLC_SP.TestZC();
 }
예제 #14
0
 void timer_Pulse_Tick(object sender, EventArgs e)
 {
     tbPulse.Text = PLC_SP.ReadNowPulse().ToString();
     tbLayer.Text = PLC_SP.ReadNowLay().ToString();
 }