Esempio n. 1
0
        public override string GetValue(string itemName)
        {
            if (!ServiceManager.DesignMode)
            {
                lock (_thisLock)
                {
                    string     val  = null;
                    SimAddress addr = Find(itemName);
                    if (addr != null)
                    {
                        val = _addrList[addr];
                    }
                    else if (addr == null && AutoCreateAddr)
                    {
                        Add(itemName);
                        val = _addrList[Find(itemName)];
                    }

                    return(val);
                }
            }
            else
            {
                return(string.Empty);
            }
        }
Esempio n. 2
0
        public override void Add(string itemName)
        {
            lock (_addrList)
            {
                SimAddress addr = new SimAddress();
                addr.ItemName = itemName;
                _addrList.Add(addr, "0");

                WriteXml();
            }
        }
Esempio n. 3
0
 public override void Remove(string itemName)
 {
     lock (_addrList)
     {
         SimAddress addr = Find(itemName);
         if (addr != null)
         {
             _addrList.Remove(addr);
         }
         WriteXml();
     }
 }
Esempio n. 4
0
 public override void ReadXml()
 {
     if (!ServiceManager.DesignMode)
     {
         XmlElement docRoot = _xmlDocument.DocumentElement;
         foreach (XmlNode driverNode in docRoot.ChildNodes)
         {
             if (driverNode.Attributes["Id"].Value.Equals("998C338B-2FB7-4780-8DF6-FF1531EC0DA6"))
             {
                 foreach (XmlNode itemNode in driverNode.ChildNodes)
                 {
                     Add(itemNode.Attributes["Name"].Value);
                     SimAddress addr = Find(itemNode.Attributes["Name"].Value);
                 }
             }
         }
     }
 }
Esempio n. 5
0
        public void Load(XmlDocument xmlDocument)
        {
            _bs.Clear();
            XmlElement docRoot = xmlDocument.DocumentElement;

            foreach (XmlNode driverNode in docRoot.ChildNodes)
            {
                if (driverNode.Attributes["Id"].Value.Equals("998C338B-2FB7-4780-8DF6-FF1531EC0DA6"))
                {
                    foreach (XmlNode itemNode in driverNode.ChildNodes)
                    {
                        SimAddress row = _bs.AddNew() as SimAddress;
                        row.ItemName = itemNode.Attributes["Name"].Value;
                        _bs.EndEdit();
                    }
                }
            }

            _bs.ListChanged += delegate { OnDataChanged(EventArgs.Empty); };
        }
Esempio n. 6
0
        public override void SetValue(string itemName, string value)
        {
            if (!ServiceManager.DesignMode)
            {
                lock (_thisLock)
                {
                    Console.Out.WriteLine(itemName + " " + value);

                    SimAddress addr = Find(itemName);
                    if (addr != null)
                    {
                        _addrList[addr] = value;
                        OnDataChanged(new DataChangedEventArgs(itemName, value));
                    }
                    else if (addr == null && AutoCreateAddr)
                    {
                        Add(itemName);
                        _addrList[Find(itemName)] = value;
                        OnDataChanged(new DataChangedEventArgs(itemName, value));
                    }
                }
            }
        }
Esempio n. 7
0
		public override void Add(string itemName)
		{
			lock (_addrList)
			{
				SimAddress addr = new SimAddress();
				addr.ItemName = itemName;
				_addrList.Add(addr, "0");

				WriteXml();
			}
		}