private void btnSelectNetworkNode_Click(object sender, EventArgs e) { var form = new NetworkPathSelectionForm(HardwareItemDescription, CapabilityMapMode); var nodePaths = new List <string>(); if (_networkNode != null && _networkNode.Path != null) { nodePaths.Add(_networkNode.Path.Value); } form.CheckedNodePaths = nodePaths; if (DialogResult.OK == form.ShowDialog()) { nodePaths = form.CheckedNodePaths; if (nodePaths.Count > 0) { _networkNode = new NetworkNode(); _networkNode.Path = new NetworkNodePath(); _networkNode.Path.Value = nodePaths[0]; //Grab first node selected edtPathValue.Value = _networkNode.Path.Value; edtPathDocumentId.Value = _networkNode.Path.documentId; } } }
private void btnMapNetwork_Click(object sender, EventArgs e) { var form = new NetworkPathSelectionForm(_hardwareItemDescription, CapabilityMapMode); var nodePaths = new List <string>(); if (_networkNodes == null) { _networkNodes = new List <NetworkNode>(); } foreach (NetworkNode networkNode in _networkNodes) { nodePaths.Add(networkNode.Path.Value); } form.CheckedNodePaths = nodePaths; if (DialogResult.OK == form.ShowDialog()) { nodePaths = form.CheckedNodePaths; //--- Check for unchecked paths and remove them RemoveUnselectedNodes(nodePaths); //--- Check if there are any matched nodes - if so leave them alone so we don't delete the id and description if already set //--- Check for new paths - create a edit instance and open form modeless to allow user to add an id and description foreach (string nodePath in nodePaths) { if (!ListContainsValue(_networkNodes, nodePath)) { var node = new NetworkNode(); node.Path = new NetworkNodePath(); node.Path.Value = nodePath; _networkNodes.Add(node); } } //--- Reload the list view ---// DataToControls(); } }