private void btnSta_Click(object sender, EventArgs e) { try { SendKeys.Send("{tab}"); if (_bInput) { return; } if (!IOManage.outputDrivers.dicDrivers.ContainsKey(_driverName)) { return; } if (!IOManage.docIO.dicOutput.ContainsKey(_driverName)) { return; } if (_bSta) { IOManage.OUTPUT(_driverName).SetOutBit(false); } else { IOManage.OUTPUT(_driverName).SetOutBit(true); } } catch { } }
private void timer1_Tick(object sender, EventArgs e) { try { if (_bInput) { if (!IOManage.inputDrivers.dicDrivers.ContainsKey(_driverName)) { _bSta = false; } else { _bSta = IOManage.INPUT(_driverName).GetOn(); } } else { if (!IOManage.outputDrivers.dicDrivers.ContainsKey(_driverName)) { _bSta = false; } else { _bSta = IOManage.OUTPUT(_driverName).GetOn(); } } btnSta.BackColor = _bSta ? Color.Lime : Color.White; } catch { } }