private void mnuProject_AddSensor_Click(object sender, EventArgs e) { var d = SelectedDevice; if (d != null) { // Pop up a window to design a new sensor var dlg = new AddObjectWindow(typeof(BaseSensor)); var result = dlg.ShowDialog(); if (result.HasValue && result.Value) { // Add this sensor to the currently selected device SensorProject.Current.AddSensor(d, dlg.ObjectToAdd as ISensor); } } }
private void mnuProject_AddAction_Click(object sender, EventArgs e) { var c = SelectedCondition; if (c != null) { // Pop up a window to design a new sensor var dlg = new AddObjectWindow(typeof(BaseAction)); var result = dlg.ShowDialog(); if (result.HasValue && result.Value) { // Add this sensor to the currently selected device SensorProject.Current.AddAction(c, dlg.ObjectToAdd as IAction); } } }