12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Xml;
- using Aitex.Common.Util;
- using Aitex.Core.RT.Log;
- using Aitex.Core.Util;
- using MECF.Framework.Common.DataCenter;
- namespace EfemDualUI.Config
- {
- class SystemConfigManager : Singleton<SystemConfigManager>
- {
- public List<Tuple<string, string, string, bool>> PMAMonitorDataList = new List<Tuple<string, string, string, bool>>();
- public List<Tuple<string, string, string, bool>> PMBMonitorDataList = new List<Tuple<string, string, string, bool>>();
- private XmlDocument _domADefault = new XmlDocument();
- private XmlDocument _domBDefault = new XmlDocument();
- public void Initialize()
- {
- try
- {
- if (File.Exists(PathManager.GetCfgDir() + "\\SystemConfigA.default.xml"))
- {
- _domADefault.Load(PathManager.GetCfgDir() + "\\SystemConfigA.default.xml");
- }
- if (File.Exists(PathManager.GetCfgDir() + "\\SystemConfigB.default.xml"))
- {
- _domBDefault.Load(PathManager.GetCfgDir() + "\\SystemConfigB.default.xml");
- }
- GetMonitorDataList();
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- throw;
- }
- }
- //dbName, displayName, cnName, isPressureAxis
- public List<Tuple<string, string, string, bool>> GetMonitorDataList()
- {
- PMAMonitorDataList = new List<Tuple<string, string, string, bool>>();
- XmlNodeList nodeAList = _domADefault.SelectNodes("/SystemConfig/DataElements/DataElement");
- if (nodeAList != null)
- {
- foreach (XmlElement dataXmlElement in nodeAList)
- {
- PMAMonitorDataList.Add(Tuple.Create(dataXmlElement.GetAttribute("dbName"),
- dataXmlElement.GetAttribute("displayName"),
- dataXmlElement.GetAttribute("cn"),
- !string.IsNullOrEmpty(dataXmlElement.GetAttribute("isPressureAxis")) && bool.Parse(dataXmlElement.GetAttribute("isPressureAxis"))));
- }
- }
- PMBMonitorDataList = new List<Tuple<string, string, string, bool>>();
- XmlNodeList nodeBList = _domBDefault.SelectNodes("/SystemConfig/DataElements/DataElement");
- if (nodeBList != null)
- {
- foreach (XmlElement dataXmlElement in nodeBList)
- {
- PMBMonitorDataList.Add(Tuple.Create(dataXmlElement.GetAttribute("dbName"),
- dataXmlElement.GetAttribute("displayName"),
- dataXmlElement.GetAttribute("cn"),
- !string.IsNullOrEmpty(dataXmlElement.GetAttribute("isPressureAxis")) && bool.Parse(dataXmlElement.GetAttribute("isPressureAxis"))));
- }
- }
- return PMAMonitorDataList.Union(PMBMonitorDataList).ToList();
- }
- }
- }
|