예제 #1
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            EditSocketPingEntry editSocketPingEntry = new EditSocketPingEntry();

            if (editSocketPingEntry.ShowDialog() == DialogResult.OK)
            {
                ListViewItem lvi = new ListViewItem(editSocketPingEntry.SelectedSocketPingEntry.HostName);
                lvi.SubItems.Add(editSocketPingEntry.SelectedSocketPingEntry.PortNumber.ToString());
                lvi.SubItems.Add(editSocketPingEntry.SelectedSocketPingEntry.PingTimeOutMS.ToString());
                lvi.Tag = editSocketPingEntry.SelectedSocketPingEntry;
                lvwEntries.Items.Add(lvi);
                CheckOKButtonEnable();
            }
        }
예제 #2
0
 private void cmdEdit_Click(object sender, EventArgs e)
 {
     if (lvwEntries.SelectedItems.Count > 0)
     {
         EditSocketPingEntry editSocketPingEntry = new EditSocketPingEntry();
         editSocketPingEntry.SelectedSocketPingEntry = (SocketPingEntry)lvwEntries.SelectedItems[0].Tag;
         if (editSocketPingEntry.ShowDialog() == DialogResult.OK)
         {
             lvwEntries.SelectedItems[0].Text             = editSocketPingEntry.SelectedSocketPingEntry.HostName;
             lvwEntries.SelectedItems[0].SubItems[1].Text = editSocketPingEntry.SelectedSocketPingEntry.PortNumber.ToString();
             lvwEntries.SelectedItems[0].SubItems[2].Text = editSocketPingEntry.SelectedSocketPingEntry.PingTimeOutMS.ToString();
             lvwEntries.SelectedItems[0].Tag = editSocketPingEntry.SelectedSocketPingEntry;
         }
         CheckOKButtonEnable();
     }
 }