/// <summary> /// 从文件中加载数据 /// </summary> /// <param Name="xml">xml文件对象</param> /// <param Name="isCreate"></param> override public void loadXML(SVXml xml, Boolean isCreate = false) { XmlElement curve = xml.CurrentElement; if (isCreate) { newID(); } else { _attrib.ID = UInt16.Parse(curve.GetAttribute("ID")); } int x = int.Parse(curve.GetAttribute("X")); int y = int.Parse(curve.GetAttribute("Y")); int width = int.Parse(curve.GetAttribute("Width")); int height = int.Parse(curve.GetAttribute("Height")); _attrib.Rect = new Rectangle(x, y, width, height); _attrib.FrontColor = Color.FromArgb(int.Parse(curve.GetAttribute("FrontColor"))); _attrib.BackgdColor = Color.FromArgb(int.Parse(curve.GetAttribute("BackgdColor"))); _attrib.Interval = UInt16.Parse(curve.GetAttribute("Interval")); String fontFamily = curve.GetAttribute("Font"); Single fontSize = Single.Parse(curve.GetAttribute("FontSize")); _attrib.Font = new Font(fontFamily, fontSize); _attrib.Max = Single.Parse(curve.GetAttribute("Max")); _attrib.Min = Single.Parse(curve.GetAttribute("Min")); Int32 count = Int32.Parse(curve.GetAttribute("Count")); for (int i = 0; i < count; i++) { SVCurveProper proper = new SVCurveProper(); XmlNodeList nls = curve.GetElementsByTagName("VarName"); XmlElement vElement = (XmlElement)nls[i]; proper.Var.VarName = vElement.GetAttribute("Value"); XmlNodeList varType = curve.GetElementsByTagName("VarType"); XmlElement tElement = (XmlElement)varType[i]; proper.Var.VarBlockType = Byte.Parse(tElement.GetAttribute("Value")); XmlNodeList colorList = curve.GetElementsByTagName("VarColor"); XmlElement cElement = (XmlElement)colorList[i]; String value = cElement.GetAttribute("Value"); proper.Color = Color.FromArgb(int.Parse(value)); XmlNodeList enabledList = curve.GetElementsByTagName("varEnabled"); XmlElement eElement = (XmlElement)enabledList[i]; proper.Enabled = Boolean.Parse(eElement.GetAttribute("Value")); _attrib.Variable.Add(proper); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { SVCurveProper proper = value as SVCurveProper; if (proper == null) { return(null); } return(proper.Var.VarName); }