示例#1
0
        public override void AddItem()
        {
            PingCollectorEditHostAddress editHostAddress = new PingCollectorEditHostAddress();

            editHostAddress.HostEntry = new PingCollectorHostEntry();

            if (editHostAddress.ShowHostAddress() == DialogResult.OK)
            {
                ListViewItem lvi = new ListViewItem(editHostAddress.HostEntry.ToString());
                lvi.SubItems.Add(editHostAddress.HostEntry.MaxTimeMS.ToString());
                lvi.SubItems.Add(editHostAddress.HostEntry.TimeOutMS.ToString());
                lvi.SubItems.Add(editHostAddress.HostEntry.DescriptionLocal);
                lvi.Tag = editHostAddress.HostEntry;
                lvwEntries.Items.Add(lvi);
            }
            base.AddItem();
        }
示例#2
0
 public override void EditItem()
 {
     if (lvwEntries.SelectedItems.Count > 0)
     {
         ListViewItem lvi = lvwEntries.SelectedItems[0];
         PingCollectorEditHostAddress editHostAddress = new PingCollectorEditHostAddress();
         editHostAddress.HostEntry = (PingCollectorHostEntry)lvi.Tag;
         if (editHostAddress.ShowHostAddress() == DialogResult.OK)
         {
             lvi.Text             = editHostAddress.HostEntry.ToString();
             lvi.SubItems[1].Text = editHostAddress.HostEntry.MaxTimeMS.ToString();
             lvi.SubItems[2].Text = editHostAddress.HostEntry.TimeOutMS.ToString();
             lvi.SubItems[3].Text = editHostAddress.HostEntry.DescriptionLocal;
             lvi.Tag = editHostAddress.HostEntry;
         }
     }
     base.EditItem();
 }