public GXDLMSAssociationViewDlg(GXDLMSObject target, bool LogicalNameReferencing, bool remove) { Target = target; InitializeComponent(); foreach (ObjectType it in GXDLMSClient.GetObjectTypes2()) { if (it != ObjectType.None) { ObjectTypeCb.Items.Add(it); } } ObjectTypeCb.SelectedItem = target.ObjectType; LogicalNameTb.Text = target.LogicalName; if (LogicalNameReferencing) { ShortNameTb.Visible = ShortNameLbl.Visible = false; } else { ShortNameTb.Text = target.ShortName.ToString(); } ObjectTypeCb.SelectedIndexChanged += new System.EventHandler(this.ObjectTypeCb_SelectedIndexChanged); if (remove) { ShortNameTb.ReadOnly = true; ObjectTypeCb.Enabled = LogicalNameTb.Enabled = ObjectTypeCb.Enabled = false; VerifyBtn.Visible = false; DescriptionTb.Text = target.Description; } }
public GXDLMSAssociationViewDlg(object parent, GXDLMSObject target, bool LogicalNameReferencing, bool remove) { Target = target; if (parent is GXDLMSAssociationLogicalName ln) { version = ln.Version; } else if (parent is GXDLMSAssociationShortName sn) { version = sn.Version; } InitializeComponent(); CreateAccessrightsColumns(version); SortedSet <ObjectType> items = new SortedSet <ObjectType>(); foreach (KeyValuePair <ObjectType, int> it in GXDLMSClient.GetObjectTypes2()) { if (it.Key != ObjectType.None && !items.Contains(it.Key)) { items.Add(it.Key); ObjectTypeCb.Items.Add(it.Key); } } ObjectTypeCb.SelectedItem = target.ObjectType; LogicalNameTb.Text = target.LogicalName; if (LogicalNameReferencing) { ShortNameTb.Visible = ShortNameLbl.Visible = false; } else { ShortNameTb.Text = target.ShortName.ToString(); } ObjectTypeCb.SelectedIndexChanged += new System.EventHandler(this.ObjectTypeCb_SelectedIndexChanged); if (remove) { ShortNameTb.ReadOnly = true; ObjectTypeCb.Enabled = LogicalNameTb.Enabled = ObjectTypeCb.Enabled = false; DescriptionTb.Text = target.Description; VersionCb.SelectedItem = target.Version; LogicalNameTb_Leave(null, null); } }