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); } }
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(); }
void timer_Pulse_Tick(object sender, EventArgs e) { tbPulse.Text = PLC_SP.ReadNowPulse().ToString(); tbLayer.Text = PLC_SP.ReadNowLay().ToString(); }