Example #1
0
 GXObisCode CreateItem(ObjectType objectType, int attributeIndex, string name)
 {
     GXObisCode item = new GXObisCode();
     item.ObjectType = objectType;
     item.LogicalName = name;
     item.AttributeIndex = attributeIndex;            
     return item;
 }
 public OBISCodeForm(GXObisCodeCollection collection, GXObisCode item)
 {
     InitializeComponent();
     OriginalTarget = item;
     //Create clone from original items.
     MemoryStream ms = new MemoryStream();
     BinaryFormatter bf = new BinaryFormatter();
     bf.Serialize(ms, item);
     ms.Position = 0;
     Target = (GXObisCode)bf.Deserialize(ms);
     ms.Close();
     ObisCodeCollection = collection;
     ShowInterfaces();
     if (Target.ObjectType == ObjectType.None)
     {
         InterfaceCB.SelectedIndex = 0;
     }
     else
     {
         InterfaceCB.SelectedItem = Target.ObjectType;
     }
     UpdateTarget();
 }
Example #3
0
 private void NewBtn_Click(object sender, EventArgs e)
 {
     try
     {
     GXObisCode item = new GXObisCode();
     OBISCodeForm dlg = new OBISCodeForm(((GXManufacturer)ManufacturersList.SelectedItems[0].Tag).ObisCodes, item);
     if (dlg.ShowDialog(this) == DialogResult.OK)
     {
         AddItem(item);
         ((GXManufacturer)ManufacturersList.SelectedItems[0].Tag).ObisCodes.Add(item);
     }
     }
     catch (Exception Ex)
     {
     GXDLMS.Common.Error.ShowError(this, Ex);
     }
 }
Example #4
0
 /// <summary>
 /// Add item to OBIS list.
 /// </summary>
 /// <param name="item"></param>
 ListViewItem AddItem(GXObisCode item)
 {
     ListViewItem it = OBISCodesList.Items.Add(item.LogicalName + " " + item.Description);
     it.Tag = item;
     Items[item] = it;
     return it;
 }
Example #5
0
 void UpdateFromObisCode(GXDLMSObject obj, GXObisCode item)
 {
     if (!String.IsNullOrEmpty(item.Description))
     {
         obj.Description = item.Description;
     }
     foreach (GXDLMSAttributeSettings it in item.Attributes)
     {
         if (obj.Attributes.Find(it.Index) == null)
         {
             obj.Attributes.Add(it);
         }
     }
 }