/// <summary> /// Update OBIS code. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ObjectTypeCb_SelectedIndexChanged(object sender, EventArgs e) { LogicalNameTb.Items.Clear(); bool first = true; foreach (KeyValuePair <string, string> it in converter.GetObisCodesByType((ObjectType)ObjectTypeCb.SelectedItem)) { LogicalNameTb.Items.Add(it.Key); if (first) { LogicalNameTb.Text = it.Key; DescriptionTb.Text = it.Value; first = false; } } }
/// <summary> /// Object type has changed. /// </summary> private void ObjectTypeCb_SelectedIndexChanged(object sender, EventArgs e) { LogicalNameTb.Items.Clear(); bool first = true; foreach (KeyValuePair <string, string> it in converter.GetObisCodesByType((ObjectType)ObjectTypeCb.SelectedItem)) { LogicalNameTb.Items.Add(it.Key); if (first) { LogicalNameTb.Text = it.Key; DescriptionTb.Text = it.Value; first = false; } } //Restore default columns if old target is association LN. if (Target is GXDLMSAssociationLogicalName) { VersionCb.Enabled = true; CreateAccessrightsColumns(version); } if (Target == null || Target.ObjectType != (ObjectType)ObjectTypeCb.SelectedItem) { Target = GXDLMSClient.CreateObject((ObjectType)ObjectTypeCb.SelectedItem); } UpdateAttributes(); //Update max version number. VersionCb.Items.Clear(); for (int pos = 0; pos != 1 + (Target as IGXDLMSBase).GetMaxSupportedVersion(); ++pos) { VersionCb.Items.Insert(0, pos); } if (Target is GXDLMSAssociationLogicalName) { VersionCb.SelectedItem = version; VersionCb.Enabled = false; } else { VersionCb.SelectedIndex = 0; } }