Beispiel #1
0
 private void OKBtn_Click(object sender, EventArgs e)
 {
     try
     {
         if (!GXDLMSObject.ValidateLogicalName(Target.LogicalName))
         {
             throw new Exception("Invalid logical name.");
         }
         OriginalTarget.Description = Target.Description;
         OriginalTarget.ObjectType  = Target.ObjectType;
         OriginalTarget.LogicalName = Target.LogicalName;
         OriginalTarget.Append      = Target.Append;
         OriginalTarget.Attributes.Clear();
         OriginalTarget.Attributes.AddRange(Target.Attributes);
         if (ObisCodeCollection.FindByLN(OriginalTarget.ObjectType, OriginalTarget.LogicalName, OriginalTarget) != null)
         {
             throw new Exception("OBIS code already exists.");
         }
     }
     catch (Exception Ex)
     {
         GXDLMS.Common.Error.ShowError(this, Ex);
         DialogResult = DialogResult.None;
     }
 }
        private static GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject> CreateColumn(GXDLMSObjectCollection objects, GXObisCodeCollection obisCodes, ObjectType ot, string ln, int index, DataType dt)
        {
            GXDLMSObject obj = objects.FindByLN(ot, ln);

            if (obj == null)
            {
                GXObisCode code = obisCodes.FindByLN(ot, ln, null);
                obj             = GXDLMSClient.CreateObject(ot);
                obj.LogicalName = ln;
                if (code != null)
                {
                    GXDLMSAttributeSettings s = code.Attributes.Find(index);
                    if (s != null)
                    {
                        obj.SetDataType(index, s.Type);
                        obj.SetUIDataType(index, s.UIType);
                        obj.SetValues(index, s.Values);
                    }
                }
                else
                {
                    obj.SetUIDataType(index, dt);
                }
            }
            return(new GXKeyValuePair <GXDLMSObject, GXDLMSCaptureObject>(obj, new GXDLMSCaptureObject(index, 0)));
        }
Beispiel #3
0
        void UpdateTarget()
        {
            //If logical name is not given set default value.
            if (string.IsNullOrEmpty(Target.LogicalName))
            {
                Target.LogicalName = "0.0.0.0.0.255";
            }
            Target.Attributes.Clear();
            GXObisCode code = ObisCodeCollection.FindByLN(Target.ObjectType, Target.LogicalName, null);

            if (code != null && code.Attributes != null)
            {
                Target.Attributes.AddRange(code.Attributes);
                Target.Description = code.Description;
            }
            else
            {
                Target.Description = converter.GetDescription(Target.LogicalName, Target.ObjectType)[0];
            }
            ObisPropertyGrid.SelectedObject = Target;
            InterfaceCB.SelectedItem        = Target;
        }