private void btPerimeter_Click(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; PLC.TestZC(); DateTime timeBegin = DateTime.Now; Thread.Sleep(1000); while (!PLC.TestZCIsFinished()) { if (DateTime.Now > timeBegin.AddSeconds(60)) { csMsg.ShowWarning("测周长失败", false); break; } Thread.Sleep(1000); } if (PLC.TestZCIsFinished()) { csMsg.ShowInfo("测周长完成", false); int sumPulse = PLC.ReadNowPulse(); Config.SaveConfig(Config.Soft.MacCode, "Perimeter", sumPulse.ToString()); } Cursor = null; }
void Set_Click(object sender, RoutedEventArgs e) { Button bt = sender as Button; string lay = bt.Tag.ToString(); if (csMsg.ShowQuestion("确定要设置该层脉冲吗?", false)) { //读取当前脉冲 int pulse = PLC.ReadNowPulse(); PLC.SavePulse(int.Parse(lay), pulse); } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { timer_Pulse.Interval = TimeSpan.FromSeconds(2); timer_Pulse.Tick += new EventHandler(timer_Pulse_Tick); if (Config.Mac.PLCIsEnable == "Y") { tbPulse.Text = PLC.ReadNowPulse().ToString(); tbLayer.Text = PLC.ReadNowLay().ToString(); timer_Pulse.Start(); } ShowLayerSet(); ShowLayerTurn(); ShowLasers(); }
void timer_Pulse_Tick(object sender, EventArgs e) { tbPulse.Text = PLC.ReadNowPulse().ToString(); tbLayer.Text = PLC.ReadNowLay().ToString(); }