Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }