//--------------------------------------------------// //--- Called when the add port button is clicked ---// //--------------------------------------------------// private void btnAddPort_Click(object sender, EventArgs e) { var port = new PhysicalInterfacePortsPort(); var form = new PhysicalInterfacePortForm(_physicalInterfaceConnectors); if (DialogResult.OK == form.ShowDialog()) { lvPorts.AddPort(form.Port); //if (_physicalInterfacePorts.Port == null) // _physicalInterfacePorts.Port = new List<PhysicalInterfacePortsPort>(); //_physicalInterfacePorts.Port.Add( form.Port ); } }
//---------------------------------------------------// //--- Called when the edit port button is clicked ---// //---------------------------------------------------// private void btnEditPort_Click(object sender, EventArgs e) { if (lvPorts.SelectedItems.Count > 0) { var form = new PhysicalInterfacePortForm(_physicalInterfaceConnectors); form.Port = (PhysicalInterfacePortsPort)lvPorts.SelectedItems[0].Tag; if (DialogResult.OK == form.ShowDialog()) { lvPorts.SelectedItems[0].Tag = form.Port; lvPorts.UpdatePort(lvPorts.SelectedItems[0]); lvPortConnectors.Port = (PhysicalInterfacePortsPort)lvPorts.SelectedItems[0].Tag; } } }