protected void ControlsToData() { if (_networkNode == null) _networkNode = new NetworkNode(); _networkNode.Description = edtDescription.GetValue<string>(); if (_networkNode.Path == null) _networkNode.Path = new NetworkNodePath(); _networkNode.Path.Value = edtPathValue.GetValue<string>(); _networkNode.Path.documentId = edtPathDocumentId.GetValue<string>(); }
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 String GetMappingName( NetworkNode node ) { String mappingName = ""; XmlDocument doc = XmlUtils.XPath2XmlDocument( node.Path.Value ); Dictionary<String, Dictionary<String, String>> elements = XmlUtils.ExtractElementsWithAttributes( doc ); foreach (String key in elements.Keys) { mappingName += ( key + ":" ); Dictionary<String, String> attributes = elements[key]; foreach (String k in attributes.Keys) { mappingName += ( attributes[k] + " " ); } } return mappingName.Trim(); }
public static bool LoadFromFile(string fileName, out NetworkNode obj) { Exception exception; return LoadFromFile(fileName, out obj, out exception); }
/// <summary> /// Deserializes xml markup from file into an NetworkNode object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output NetworkNode object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out NetworkNode obj, out Exception exception) { exception = null; obj = default(NetworkNode); try { obj = LoadFromFile(fileName); return true; } catch (Exception ex) { exception = ex; return false; } }
public static bool Deserialize(string input, out NetworkNode obj) { Exception exception; return Deserialize(input, out obj, out exception); }
/// <summary> /// Deserializes workflow markup into an NetworkNode object /// </summary> /// <param name="input">string workflow markup to deserialize</param> /// <param name="obj">Output NetworkNode object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string input, out NetworkNode obj, out Exception exception) { exception = null; obj = default(NetworkNode); try { obj = Deserialize(input); return true; } catch (Exception ex) { exception = ex; return false; } }
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(); } }