private void cmdAdd_Click(object sender, EventArgs e) { EditHttpPingEntry edithttpPingEntry = new EditHttpPingEntry(); if (edithttpPingEntry.ShowDialog() == DialogResult.OK) { ListViewItem lvi = new ListViewItem(edithttpPingEntry.SelectedHttpPingEntry.Url); lvi.SubItems.Add(edithttpPingEntry.SelectedHttpPingEntry.MaxTime.ToString()); lvi.SubItems.Add(edithttpPingEntry.SelectedHttpPingEntry.TimeOut.ToString()); lvi.SubItems.Add(edithttpPingEntry.SelectedHttpPingEntry.ProxyServer); lvi.Tag = edithttpPingEntry.SelectedHttpPingEntry; lvwEntries.Items.Add(lvi); CheckOKButtonEnable(); } }
private void cmdEdit_Click(object sender, EventArgs e) { if (lvwEntries.SelectedItems.Count > 0) { EditHttpPingEntry edithttpPingEntry = new EditHttpPingEntry(); edithttpPingEntry.SelectedHttpPingEntry = (HttpPingEntry)lvwEntries.SelectedItems[0].Tag; if (edithttpPingEntry.ShowDialog() == DialogResult.OK) { lvwEntries.SelectedItems[0].Text = edithttpPingEntry.SelectedHttpPingEntry.Url; lvwEntries.SelectedItems[0].SubItems[1].Text = edithttpPingEntry.SelectedHttpPingEntry.MaxTime.ToString(); lvwEntries.SelectedItems[0].SubItems[2].Text = edithttpPingEntry.SelectedHttpPingEntry.TimeOut.ToString(); lvwEntries.SelectedItems[0].SubItems[3].Text = edithttpPingEntry.SelectedHttpPingEntry.ProxyServer; lvwEntries.SelectedItems[0].Tag = edithttpPingEntry.SelectedHttpPingEntry; } CheckOKButtonEnable(); } }