/// <summary> /// Selects single node from passed XmlNode and returns corresponding OrientationType, if the node is not found the given defaultvalue is returned /// </summary> /// <param name="xpath">Expression to select node containing setting value</param> /// <param name="selectionNode">Node to apply xpath expression on</param> /// <param name="defaultValue">Value to return if node is not found or not possible to parse as a OrientationType</param> public static ChartSettings.OrientationType GetSettingValue(string xpath, XmlNode selectionNode, ChartSettings.OrientationType defaultValue) { ChartSettings.OrientationType returnValue = defaultValue; XmlNode node = null; if (selectionNode != null) { node = selectionNode.SelectSingleNode(xpath); } if (node != null) { switch (node.InnerText.ToLower()) { case "vertical": returnValue = ChartSettings.OrientationType.Vertical; break; default: returnValue = ChartSettings.OrientationType.Horizontal; break; } } return(returnValue); }
public static ChartSettings.OrientationType ConvertToLabelOrientation(string orientation, ChartSettings.OrientationType defaultValue) { switch (orientation) { case "Horizontal": return(ChartSettings.OrientationType.Horizontal); case "Vertical": return(ChartSettings.OrientationType.Vertical); default: break; } return(defaultValue); }