private void button10_Click(object sender, EventArgs e) { var cont = new DeviceController(); var firstDev = cont.RetrieveDevice(1); var window = new SetDeviceCommunicators(firstDev); window.Show(); }
private void bCommunicator_Click(object sender, EventArgs e) { if (_comm == null) { var devCont = new DeviceController(); var device = devCont.RetrieveDevice(_rule.DeviceId); var ai = new AddCommunicator(device,false); ai.ShowDialog(); _comm = ai._communicator; } else { var cm = new CommunicatorModifier(_comm); cm.ShowDialog(); } }
private void add_cbRule_SelectedIndexChanged(object sender, EventArgs e) { var devController = new DeviceController(); var commController = new CommunicatorController(); _rule = (Models.Rule)add_cbRule.SelectedItem; _rule.Device = devController.RetrieveDevice(_rule.DeviceId); _device = _rule.Device; //add_cbCommunicatorDestination.Items.AddRange(commController.GetAllCommunicators().Where(com=>com.Device.Id==_rule.DeviceId && com.Inbound==false).ToArray()); }
private void alarm_lbAlarms_SelectedIndexChanged(object sender, EventArgs e) { //Resetting the form. alarm_bRule.Enabled = false; alarm_bDevice.Enabled = false; alarm_tDateTime.Text = ""; alarm_rbTrue.Checked = false; alarm_rbFalse.Checked = false; alarm_tValue.Text = ""; alarm_tDevice.Text = ""; try { var selected = (Alarm) alarm_lbAlarms.SelectedItem; alarm_tDateTime.Text = selected.TimeStamp.ToString(); alarm_rbTrue.Checked = selected.Accepted; alarm_rbFalse.Checked = !selected.Accepted; //Get Value information. if (selected.ValueId > 0) { var controller = new ValueController(); _value = controller.GetValueById(selected.ValueId); selected.Value = _value; alarm_tValue.Text = selected.Value.StringValue; } //Get Rule information. if (selected.RuleId > 0) { var controller = new RuleController(); _rule = controller.RetrieveRuleById(selected.RuleId); alarm_bRule.Enabled = true; } //Get Device information. if (selected.DeviceId > 0) { var controller = new DeviceController(); _selectedDevice = controller.RetrieveDevice(selected.DeviceId); selected.Device = _selectedDevice; alarm_tDevice.Text = _selectedDevice.ToString(); alarm_bDevice.Enabled = true; } } catch { DebugOutput.Print("Attempted to load an alarm and failed..."); } }