예제 #1
0
 private void AddDeviceCMnu_Click(object sender, EventArgs e)
 {
     try
     {
         DevicePropertiesForm dlg = new DevicePropertiesForm(Manufacturers, new GXDLMSMeter());
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             target.AddDevices(new GXDLMSMeter[] { dlg.Device });
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message);
     }
 }
예제 #2
0
 private void PropertiesCMnu_Click(object sender, EventArgs e)
 {
     try
     {
         if (Devices.SelectedNode != null)
         {
             GXDLMSMeter          m   = Devices.SelectedNode.Tag as GXDLMSMeter;
             DevicePropertiesForm dlg = new DevicePropertiesForm(Manufacturers, m);
             if (dlg.ShowDialog(this) == DialogResult.OK)
             {
                 target.EditDevices(new GXDLMSMeter[] { dlg.Device });
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message);
     }
 }
예제 #3
0
 private void AddDeviceMnu_Click(object sender, EventArgs e)
 {
     try
     {
         DevicePropertiesForm dlg = new DevicePropertiesForm(this.Manufacturers, null);
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             dlg.Device.Manufacturers = this.Manufacturers;
             dlg.Device.Comm.parentForm = this;
             AddDevice(dlg.Device, false);
             Devices.Add(dlg.Device);
             SetDirty(true);
         }
     }
     catch (Exception Ex)
     {
         GXDLMS.Common.Error.ShowError(this, Ex);
     }
 }
예제 #4
0
 /// <summary>
 /// Show properties of the selected media.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PropertiesMnu_Click(object sender, EventArgs e)
 {
     try
     {
         GXDLMSDevice dev = GetSelectedDevice();
         if (dev != null)
         {
             string man = dev.Manufacturer;
             DevicePropertiesForm dlg = new DevicePropertiesForm(this.Manufacturers, dev);
             if (dlg.ShowDialog(this) == DialogResult.OK)
             {
                 //If user has change meter manufacturer.
                 if (man != dev.Manufacturer)
                 {
                     while (dev.Objects.Count != 0)
                     {
                         RemoveObject(dev.Objects[0]);
                     }
                     SelectItem(dev);
                 }
                 ((TreeNode)ObjectTreeItems[dev]).Text = dev.Name;
                 SetDirty(true);
             }
         }
     }
     catch (Exception Ex)
     {
         GXDLMS.Common.Error.ShowError(this, Ex);
     }
 }