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); } }
public override void Add(string itemName) { lock (_addrList) { SimAddress addr = new SimAddress(); addr.ItemName = itemName; _addrList.Add(addr, "0"); WriteXml(); } }
public override void Remove(string itemName) { lock (_addrList) { SimAddress addr = Find(itemName); if (addr != null) { _addrList.Remove(addr); } WriteXml(); } }
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); } } } } }
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); }; }
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)); } } } }