Esempio n. 1
0
        public ChartWindow(int id)
        {
            InitializeComponent();

            Width  = double.NaN;
            Height = double.NaN;

            Window_Id      = id;
            Selected_Index = -1;

            #region 读图数据列表
            //
            var xmle = XDocument.Load(@"Xml/Settings.xml");                                     //
            _element = xmle.Root.Element("Settings").Element("PlotContents");


            //加载 XML 文件
            XDocument xml     = XDocument.Load(@"Xml/Message/Get_UAVData.xml");             //
            var       xmlRoot = xml.Root.Element("message").Element("Data").Element("UAV"); // 从 XML 中检索数据

            xml    = XDocument.Load(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\ACSL\X-Monitor\Setting\GUI\Settings.xml");
            _tagHi = new List <string>();
            _tagLo = new List <string>();
            _plotDataSelectList = new List <string>();

            foreach (var element in xml.Root.XPathSelectElements("Settings/Plot/Tag"))
            {
                string _attVal = element.Attribute("a").Value;
                if (_attVal == "H")
                {
                    _tagHi.Add(element.Value);
                }
                else
                {
                    _tagLo.Add(element.Value);
                }
            }

            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
            xmlDoc.LoadXml(xmlRoot.ToString());                                                                                 //转换
            System.Xml.XmlElement xmlRoot1 = xmlDoc.DocumentElement;

            string trvChild = string.Empty;
            Make(xmlRoot1, ref trvChild);               //提取标记名称

            //PlotList.Items.Add("CPU使用率");

            PlotList _xmlTag = new PlotList
            {
                XMLTag   = "CPU使用率",
                Contents = "PCの使用率"
            };
            TagList.Items.Add(_xmlTag);
            #endregion

            source1 = new List <ObservableDataSource <System.Windows.Point> >();
        }
Esempio n. 2
0
        // 标记提取
        private void GetXmlPathAIT(string _path, string _a, string _i, string _t)
        {
            PlotList _xmlTag = new PlotList
            {
                XMLTag   = _path,
                Contents = "NoData"
            };

            foreach (var _e in _element.XPathSelectElements(_path))
            {
                if (_e != null)
                {
                    var _aa = _e.Attribute("a");
                    var _ai = _e.Attribute("i");
                    var _at = _e.Attribute("t");

                    string _ata = ""; if (_aa != null)
                    {
                        _ata = _aa.Value;
                    }
                    string _ati = ""; if (_ai != null)
                    {
                        _ati = _ai.Value;
                    }
                    string _att = ""; if (_at != null)
                    {
                        _att = _at.Value;
                    }

                    if ((_ata == _a) && (_ati == _i) && (_att == _t))
                    {
                        if (_a != "")
                        {
                            _xmlTag.XMLTag += "[@" + _aa + "]";
                        }
                        if (_t != "")
                        {
                            _xmlTag.XMLTag += "[@" + _at + "]";
                        }
                        if (_i != "")
                        {
                            _xmlTag.XMLTag += "[@" + _ai + "]";
                        }
                        _xmlTag.Contents = _e.Value;
                    }
                }
            }
            TagList.Items.Add(_xmlTag);
        }