private void btnAddPort_Click(object sender, EventArgs e) { var form = new PortForm(); if (DialogResult.OK == form.ShowDialog()) { AddPortToListView(form.Port); } }
private void lvInterface_OnEdit() { if (lvInterface.HasSelected) { var form = new PortForm { Port = lvInterface.SelectedItems[0].Tag as Port }; if (DialogResult.OK == form.ShowDialog()) { Port port = form.Port; lvInterface.SelectedItems[0].Tag = port; lvInterface.SelectedItems[0].SubItems[0].Text = port.ToString(); } } }
private void btnEditPort_Click(object sender, EventArgs e) { if (lvPorts.SelectedItems.Count > 0) { var port = (Port)lvPorts.SelectedItems[0].Tag; var form = new PortForm(); form.Port = port; if (DialogResult.OK == form.ShowDialog()) { port = form.Port; lvPorts.SelectedItems[0].Tag = port; lvPorts.SelectedItems[0].SubItems[0].Text = port.name; lvPorts.SelectedItems[0].SubItems[1].Text = port.direction.ToString(); OnPortChanged(); } } }
private void btnPort_Click(object sender, EventArgs e) { PortForm form = new PortForm(); form.ShowDialog(this); }