コード例 #1
0
 /// <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);
     }
 }
コード例 #2
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)
         {
             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
 public GXDLMSNeighbourTableDlg(GXDLMSNeighbourTable item)
 {
     InitializeComponent();
     ModulationCb.Items.AddRange(new object[] { Modulation.RobustMode, Modulation.DbPsk, Modulation.DqPsk, Modulation.D8Psk, Modulation.Qam16 });
     TxGainResolutionCb.Items.AddRange(new object[] { GainResolution.dB6, GainResolution.dB3 });
     Item                            = item;
     AddressTb.Text                  = item.ShortAddress.ToString();
     EnabledCB.Checked               = item.Enabled;
     ToneMapTb.Text                  = item.ToneMap;
     ModulationCb.SelectedItem       = item.Modulation;
     TxGainTb.Text                   = item.TxGain.ToString();
     TxGainResolutionCb.SelectedItem = item.TxRes;
     TransmitterGainTb.Text          = item.TxCoeff;
     LinkQualityIndicatorTb.Text     = item.Lqi.ToString();
     PhaseDifferenceTb.Text          = item.PhaseDifferential.ToString();
     TMRValidTimeTb.Text             = item.TMRValidTime.ToString();
     ValidTimeTb.Text                = item.NeighbourValidTime.ToString();
 }
コード例 #4
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);
     }
 }