public bool ExecuteOnOff(ADAM4150FuncID ID) { if (this.Comlist.SelectedIndex < 0) { MessageBox.Show("请选择串口"); return(false); } comset = new ComSettingModel(); comset.DigitalQuantityCom = Comlist.SelectedValue.ToString(); adam = new DigitalLibrary.ADAM4150(comset); return(adam.OnOff(ID)); }
public void getValue(object sender, EventArgs e) { //Console.Write("log:"+e.ToString()); if (this.Comlist.SelectedIndex < 0) { MessageBox.Show("请选择串口"); return; } comset = new ComSettingModel(); comset.DigitalQuantityCom = Comlist.SelectedValue.ToString(); adam = new DigitalLibrary.ADAM4150(comset); adam.SetData(); lab_fire.Content = adam.DI1 ? "有火灾" : "一切正常"; lab_humanbody.Content = adam.DI0 ? "有人" : "一切正常"; lab_infrared.Content = adam.DI4 ? "有人入侵" : "一切正常"; lab_smoke.Content = adam.DI2 ? "有烟雾" : "一切正常"; }