//-----------------------------------------------------------------// //--- Call to edit the selected connector item in the list view ---// //-----------------------------------------------------------------// private void btnEditConnector_Click( object sender, EventArgs e ) { if (lvConnectors.SelectedItems.Count > 0) { var form = new ConnectorForm(); var connector = (Connector) lvConnectors.SelectedItems[0].Tag; form.Connector = connector; form.TopLevel = true; form.Closed += delegate { if (DialogResult.OK == form.DialogResult) { ListViewItem item = lvConnectors.SelectedItems[0]; lvConnectors.UpdateConnector( item, form.Connector ); lvPins.Connector = (Connector) lvConnectors.SelectedItems[0].Tag; } }; form.Show(); } }
//---------------------------------------------------------// //--- Call to add a new connector item to the list view ---// //---------------------------------------------------------// private void btnAddConnector_Click( object sender, EventArgs e ) { var form = new ConnectorForm(); var connector = new Connector(); form.Connector = connector; form.TopLevel = true; form.Closed += delegate { if (DialogResult.OK == form.DialogResult) { connector = form.Connector; lvConnectors.AddConnector( connector ); //if (_physicalInterfaceConnectors.Connector == null) // _physicalInterfaceConnectors.Connector = new List<Connector>(); //_physicalInterfaceConnectors.Connector.Add( connector ); } }; form.Show(); }