コード例 #1
0
        /// <summary>
        /// get all need monitor address
        /// </summary>
        /// <returns></returns>
        public Dictionary <string, List <MonitorAddress> > GetMonitorAddrList()
        {
            var infoNode = XML_Tool.xdoc.Root.Element("InfoConfig");
            var dic      = new Dictionary <string, List <MonitorAddress> >();

            foreach (var lineElement in infoNode.Elements("line"))
            {
                var opcList = lineElement.Descendants("opcitem").ToList();

                List <MonitorAddress> maList = new List <MonitorAddress>();

                foreach (var item in opcList)
                {
                    Dictionary <string, string> para = new Dictionary <string, string>
                    {
                        { "line", item.Parent.Parent.Parent.Attribute("name").Value },
                        { "station", item.Parent.Parent.Attribute("name").Value },
                        { "type", item.Parent.Name.LocalName }
                    };
                    foreach (var at in item.Attributes())
                    {
                        para.Add(at.Name.LocalName, at.Value);
                    }
                    MonitorAddress ma = new MonitorAddress(item.Attribute("addr").Value, item.Attribute("AddrType").Value, para);
                    maList.Add(ma);
                }
                dic.Add(lineElement.Attribute("name").Value, maList);
            }
            return(dic);
        }
コード例 #2
0
        public void OnABPLCDataChanged(MonitorAddress ma, object objValue)
        {
            string itemValue = objValue.ToString().Replace("\0", "");

            ThreadPool.QueueUserWorkItem(new WaitCallback(DealABPLCEvent),
                                         new ABPLCParameter(ma, itemValue));
        }
コード例 #3
0
 public ABPLCParameter(MonitorAddress ma_, string itemValue_)//带参数的构造函数
 {
     ma        = ma_;
     itemValue = itemValue_;
 }