Exemplo n.º 1
0
        /// <summary>
        /// 根据xml配置信息给过滤对象赋值
        /// </summary>
        /// <param name="xml">文本节点</param>
        public void Deserialize(XmlNode xml)
        {
            if (xml == null)
            {
                return;
            }
            XmlDocument Doc = new XmlDocument();

            Doc.LoadXml(xml.OuterXml);
            if (Doc.DocumentElement != null)
            {
                if (Doc.DocumentElement.GetElementsByTagName("DataSourceName")[0] != null)
                {
                    this.DataSourceName = Doc.DocumentElement.GetElementsByTagName("DataSourceName")[0].InnerText;
                }
                if (Doc.DocumentElement.GetElementsByTagName("StatisticsEngName")[0] != null)
                {
                    this.StatisticsEngName = Doc.DocumentElement.GetElementsByTagName("StatisticsEngName")[0].InnerText;
                }
                XmlNodeList          PropertiesToShownodes = Doc.DocumentElement.GetElementsByTagName("PropertiesToShow");
                List <PropertiyName> showpros = new List <PropertiyName>();
                foreach (XmlNode node in PropertiesToShownodes)
                {
                    if (node != null)
                    {
                        PropertiyName speicalDate = new PropertiyName();
                        speicalDate.Deserialize(node);
                        showpros.Add(speicalDate);
                    }
                }
                this.PropertiesToShow = showpros;
                XmlNode XAxisnode = Doc.DocumentElement.GetElementsByTagName("XAxis")[0];
                if (XAxisnode != null)
                {
                }
                XmlNode Limitsnode = Doc.DocumentElement.GetElementsByTagName("Limits")[0];
                if (Limitsnode != null)
                {
                    Limits _limits = new Limits();
                    _limits.Deserialize(Limitsnode);
                    this.Limits = _limits;
                }
            }
            if (xml.Attributes != null)
            {
                if (xml.Attributes["FilterLists"] != null)
                {
                    this.FilterLists.AddRange(xml.Attributes["FilterLists"].Value.Split(new String[] { " " }, StringSplitOptions.RemoveEmptyEntries));
                }
                if (xml.Attributes["ShowLable"] != null)
                {
                    this.ShowLable = xml.Attributes["ShowLable"].Value == "true";
                }
                if (xml.Attributes["ShowLegend"] != null)
                {
                    this.ShowLegend = xml.Attributes["ShowLegend"].Value == "true";
                }
                if (xml.Attributes["YX"] != null)
                {
                    this.YX = xml.Attributes["YX"].Value == "true";
                }
                if (xml.Attributes["IsBand"] != null)
                {
                    this.IsBand = xml.Attributes["IsBand"].Value == "true";
                }
                if (xml.Attributes["SortX"] != null)
                {
                    this.SortX = int.Parse(xml.Attributes["SortX"].Value);
                }
                if (xml.Attributes["SOURCEPROVIDER"] != null)
                {
                    this.SOURCEPROVIDER = (SOURCEPROVIDER)Enum.Parse(typeof(SOURCEPROVIDER), xml.Attributes["SOURCEPROVIDER"].Value);
                }
                if (xml.Attributes["Style"] != null)
                {
                    this.Style = xml.Attributes["Style"].Value;
                }
                //if (xml.Attributes["FilterLists"] != null)
                //    this.FilterLists = xml.Attributes["FilterLists"].Value;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 构建图形数据源对象
 /// </summary>
 public DataSourceAdaptor()
 {
     this.PropertiesToShow = new List <PropertiyName>(10);
     this.DataSourceName   = String.Empty;
     this.Limits           = new Limits();
 }