Ejemplo n.º 1
0
 /// <summary>
 /// Add new DC.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NewDataCollectorMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         GXAmiUserGroup[] ugs = Client.GetUserGroups(false);
         GXAmiDataCollector dc = new GXAmiDataCollector();
         GXAmiDataCollectorForm dlg = new GXAmiDataCollectorForm(Client, dc, DataCollectorActionType.Add);
         if (dlg.ShowDialog(this.ParentComponent) == System.Windows.Forms.DialogResult.OK)
         {
             AddDataCollector(new GXAmiDataCollector[]{dc});
         }
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(this.ParentComponent, Gurux.DeviceSuite.Properties.Resources.GuruxDeviceSuiteTxt, ex);
     }  
 }       
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Assign DC so users can see it.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void AssignMenu_Click(object sender, EventArgs e)
 {
     try
     {
         GXAmiUserGroup[] ugs = Client.GetUserGroups(false);
         foreach (ListViewItem it in UnassignedDCList.SelectedItems)
         {
             GXAmiDataCollectorForm dlg = new GXAmiDataCollectorForm(Client, it.Tag as GXAmiDataCollector, DataCollectorActionType.Edit);
             if (dlg.ShowDialog(this.ParentComponent) != DialogResult.OK)
             {
                 break;
             }
             Client.AddDataCollector(it.Tag as GXAmiDataCollector, ugs);
         }               
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(this.ParentComponent, Gurux.DeviceSuite.Properties.Resources.GuruxDeviceSuiteTxt, ex);
     }  
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Add new data collector.
 /// </summary>
 public void NewDataCollector()
 {
     try
     {
         GXAmiDataCollectorForm dlg = new GXAmiDataCollectorForm(Client, null, DataCollectorActionType.Add);
         dlg.ShowDialog(ParentComponent);                 
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(this.ParentComponent, Gurux.DeviceSuite.Properties.Resources.GuruxDeviceSuiteTxt, ex);
     }
 }