예제 #1
0
파일: CStation.cs 프로젝트: tomyqg/SemiGC
        public bool LoadAlarmFromNode(XmlElement Node)//读取报警配置
        {
            ListCond.Clear();
            string     xpath   = "Alarms/Conditions";
            XmlElement PrjNode = (XmlElement)Node.SelectSingleNode(xpath);

            foreach (XmlElement StaNode in PrjNode.ChildNodes)
            {
                Ccondition nCond = new Ccondition();
                nCond.LoadFromNode(StaNode);
                ListCond.Add(nCond);
            }
            xpath   = "Alarms/Vars";
            PrjNode = (XmlElement)Node.SelectSingleNode(xpath);
            if (PrjNode != null)
            {
                foreach (XmlElement StaNode in PrjNode.ChildNodes)
                {
                    foreach (CVar nVar in StaDevice.ListDevVar)
                    {
                        if (nVar.Name == StaNode.GetAttribute("Name"))
                        {
                            nVar.nVarAlarm          = new CVarAlarm();
                            nVar.nVarAlarm.staName  = Name;
                            nVar.nVarAlarm.staAlarm = staAlarm;
                            nVar.nVarAlarm.Name     = StaNode.GetAttribute("Name");
                            nVar.nVarAlarm.LoadFromNode(StaNode);
                        }
                    }
                }
            }
            return(true);
        }
예제 #2
0
파일: CAlarm.cs 프로젝트: tomyqg/SemiGC
        public bool LoadFromNode(XmlElement Node)
        {
            ListSubCond.Clear();
            foreach (XmlElement StaNode in Node.ChildNodes)
            {
                switch (StaNode.Name)
                {
                case "Expression": Expression = StaNode.InnerText; break;

                case "Description": Description = StaNode.InnerText; break;

                case "Response": Response = StaNode.InnerText; break;

                case "Priority": Priority = Convert.ToInt32(StaNode.InnerText); break;

                case "SubConditions":
                    if (StaNode.ChildNodes.Count > 0)
                    {
                        foreach (XmlElement SubNode in StaNode.ChildNodes)
                        {
                            Ccondition nCond = new Ccondition();
                            nCond.LoadFromNode(SubNode);
                            ListSubCond.Add(nCond);
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            return(true);
        }