/// <summary>
 /// Edit key neighbour item.
 /// </summary>
 private void NeighbourTableEditBtn_Click(object sender, EventArgs e)
 {
     try
     {
         if (NeighbourTable.SelectedItems.Count != 0)
         {
             ListViewItem            li   = NeighbourTable.SelectedItems[0];
             GXDLMSNeighbourTable    item = (GXDLMSNeighbourTable)li.Tag;
             GXDLMSNeighbourTableDlg dlg  = new GXDLMSNeighbourTableDlg(item);
             if (dlg.ShowDialog(this) == DialogResult.OK)
             {
                 GXDLMSG3PlcMacSetup target = Target as GXDLMSG3PlcMacSetup;
                 li.SubItems[0].Text = item.ShortAddress.ToString();
                 li.SubItems[1].Text = item.Enabled.ToString();
                 li.SubItems[2].Text = item.Modulation.ToString();
                 li.SubItems[3].Text = item.ToneMap;
                 Target.UpdateDirty(11, target.NeighbourTable);
                 errorProvider1.SetError(NeighbourTable, Properties.Resources.ValueChangedTxt);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 /// <summary>
 /// Add new item to neighbour table.
 /// </summary>
 private void NeighbourTableAddBtn_Click(object sender, EventArgs e)
 {
     try
     {
         GXDLMSNeighbourTable    item = new GXDLMSNeighbourTable();
         GXDLMSNeighbourTableDlg dlg  = new GXDLMSNeighbourTableDlg(item);
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             GXDLMSG3PlcMacSetup         target = Target as GXDLMSG3PlcMacSetup;
             List <GXDLMSNeighbourTable> list   = new List <GXDLMSNeighbourTable>();
             if (target.NeighbourTable != null)
             {
                 list.AddRange(target.NeighbourTable);
             }
             ListViewItem li = new ListViewItem(item.ShortAddress.ToString());
             li.SubItems.Add(item.Enabled.ToString());
             li.SubItems.Add(item.Modulation.ToString());
             li.SubItems.Add(item.ToneMap);
             li.Tag = item;
             NeighbourTable.Items.Add(li);
             target.NeighbourTable = list.ToArray();
             Target.UpdateDirty(11, target.NeighbourTable);
             errorProvider1.SetError(NeighbourTable, Properties.Resources.ValueChangedTxt);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #3
0
 /// <summary>
 /// Add new item to neighbour table.
 /// </summary>
 private void NeighbourTableAddBtn_Click(object sender, EventArgs e)
 {
     try
     {
         GXDLMSNeighbourTable    item = new GXDLMSNeighbourTable();
         GXDLMSNeighbourTableDlg dlg  = new GXDLMSNeighbourTableDlg(item);
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             ListViewItem li = new ListViewItem(item.ShortAddress.ToString());
             li.SubItems.Add(item.Enabled.ToString());
             li.SubItems.Add(item.Modulation.ToString());
             li.SubItems.Add(item.ToneMap);
             li.Tag = item;
             NeighbourTable.Items.Add(li);
             errorProvider1.SetError(NeighbourTable, Properties.Resources.ValueChangedTxt);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }