Пример #1
0
 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);
     }
 }
Пример #2
0
 /// <summary>
 /// Add new device to the device collector.
 /// </summary>
 public void NewDevice()
 {
     try
     {
         if (Client.GetDeviceProfiles(false, false).Length == 0)
         {
             throw new Exception("You must add device profile to the data collector before you can create new device.");
         }
         GXAmiDataCollector[] list = Client.GetDataCollectors();
         if (list.Length == 0)
         {
             throw new Exception("You must create one data collector first.");
         }
         GXAmiDeviceSettingsForm dlg = new GXAmiDeviceSettingsForm(Client, null, list);
         dlg.ShowDialog(ParentComponent);
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(this.ParentComponent, Gurux.DeviceSuite.Properties.Resources.GuruxDeviceSuiteTxt, ex);
     }
 }