public void ShowProperties() { try { if (DCList.Focused) { if (DCList.SelectedItems.Count != 1) { throw new Exception("Select only one Data Collector."); } GXAmiDataCollector dc = DCList.SelectedItems[0].Tag as GXAmiDataCollector; GXAmiDataCollectorForm dlg = new GXAmiDataCollectorForm(Client, dc, DataCollectorActionType.Edit); dlg.ShowDialog(ParentComponent); } else if (DevicesList.Focused) { if (DevicesList.SelectedItems.Count != 1) { throw new Exception("Select only one device."); } GuruxAMI.Common.GXAmiDevice device = DevicesList.SelectedItems[0].Tag as GuruxAMI.Common.GXAmiDevice; GuruxAMI.Common.GXAmiDataCollector[] dcs = Client.GetDataCollectors(device); GXAmiDeviceSettingsForm dlg = new GXAmiDeviceSettingsForm(Client, device, dcs); dlg.ShowDialog(ParentComponent); } else if (DeviceProfilesList.Focused) { if (DeviceProfilesList.SelectedItems.Count != 1) { throw new Exception("Select only one device template."); } GuruxAMI.Common.GXAmiDevice device = DeviceProfilesList.SelectedItems[0].Tag as GuruxAMI.Common.GXAmiDeviceProfile; GXAmiDeviceSettingsForm dlg = new GXAmiDeviceSettingsForm(Client, device, null); dlg.ShowDialog(ParentComponent); } else if (Schedules.Focused) { if (Schedules.SelectedItems.Count != 1) { throw new Exception("Select only one schedule."); } GXAmiSchedule schedule = Schedules.SelectedItems[0].Tag as GXAmiSchedule; GXAmiScheduleEditorDlg dlg = new GXAmiScheduleEditorDlg(Client, schedule); dlg.ShowDialog(ParentComponent); } } catch (Exception ex) { GXCommon.ShowError(this.ParentComponent, Gurux.DeviceSuite.Properties.Resources.GuruxDeviceSuiteTxt, ex); } }
/// <summary> /// Add new Schedule. /// </summary> public void NewSchedule() { try { GXAmiSchedule schedule = new GXAmiSchedule(); schedule.ScheduleStartTime = DateTime.Now; GXAmiScheduleEditorDlg dlg = new GXAmiScheduleEditorDlg(Client, schedule); dlg.ShowDialog(ParentComponent); } catch (Exception ex) { GXCommon.ShowError(this.ParentComponent, Gurux.DeviceSuite.Properties.Resources.GuruxDeviceSuiteTxt, ex); } }