public static T FindDescendantByProperty <T>(this GuiMap Map, Func <T, bool> Property = null) where T : class { if (Property == null) { Property = new Func <T, bool>(t => true); } return(findDescendantByPropertyTemplate <T>(Map.Children, Property)); }
public static IEnumerable <T> FindAllByName <T>(this GuiMap Map, string Name) where T : class { return(findAllByNameTemplate <T>(Name, Map.FindAllByName)); }
/// <summary> /// Loads the GUI map. /// </summary> /// <param name="filePath">The file path.</param> /// <returns></returns> public Dictionary<String, GuiMap> LoadGuiMap(String filePath) { XmlDocument doc = new XmlDocument(); Dictionary<String, GuiMap> guiObjCollection = null; try { List<string> IdentType = new List<string>(); List<string> Value = new List<string>(); string logicalName = string.Empty; string identificationType = string.Empty; string elementValue = string.Empty; doc.Load(filePath); XmlNodeList rootNode = doc.DocumentElement.SelectNodes(xmlNodePath); //Create a dictionary object that can hold key value pairs of string and GUIMap objects guiObjCollection = new Dictionary<string, GuiMap>(); GuiMap guimap = null; foreach (XmlNode featureSetNode in rootNode) { XmlNodeList elementNodes = featureSetNode.ChildNodes; foreach (XmlNode node in elementNodes) { guimap = new GuiMap(); logicalName = node.Attributes["name"].InnerText; guimap.LogicalName = logicalName; XmlNodeList mulNode = node.ChildNodes; if (node.ChildNodes.Count > 0) { foreach (XmlNode nod in mulNode) { for (int i = 0; i <= node.ChildNodes.Count - 1; i++) { IdentType.Add(node.ChildNodes[i].Name); Value.Add(node.ChildNodes[i].InnerText); switch (IdentType[i].ToLower()) { case id: guimap.MultIdentities.Add(IdentType[i], Value[i]); continue; case text: guimap.MultIdentities.Add(IdentType[i], Value[i]); continue; } } break; } } if (!guiObjCollection.ContainsKey(guimap.LogicalName)) { guiObjCollection.Add(guimap.LogicalName, guimap); IdentType.Clear(); Value.Clear(); } } } } catch (FileNotFoundException fne) { } catch (Exception ex) { string message = "Exception occured while loading the values" + "from Gui map xml" + filePath + "not found"; } return guiObjCollection; }
public static T FindById <T>(this GuiMap Map, string Id) where T : class { return(findByIdTemplate <T>(Id, Map.FindById)); }
public static T FindByName <T>(this GuiMap Map, string Name) where T : class { return(findByNameTemplate <T>(Name, Map.FindByName)); }
public static T FindChildByProperty <T>(this GuiMap Map, Func <T, bool> Property = null) where T : class { return(findChildByPropertyTemplate <T>(Map.Children, Property)); }
public static T FindByNameEx <T>(this GuiMap Map, string Name, int TypeId) where T : class { return(findByNameExTemplate <T>(Name, TypeId, Map.FindByNameEx)); }
public static IEnumerable <T> FindDescendantsByProperty <T>(this GuiMap Map, Func <T, bool> Property = null) where T : class { return(findDescendantsByPropertyTemplate <T>(Map.Children, Property)); }