Exemplo n.º 1
0
        /// <summary>
        /// Saves the configuration into the XML node.
        /// </summary>
        public void SaveToXml(XmlElement xmlElem)
        {
            if (xmlElem == null)
            {
                throw new ArgumentNullException(nameof(xmlElem));
            }

            xmlElem.SetAttribute("active", Active);
            xmlElem.SetAttribute("isBound", IsBound);
            xmlElem.SetAttribute("number", CommLineNum);
            xmlElem.SetAttribute("name", Name);
            LineOptions.SaveToXml(xmlElem.AppendElem("LineOptions"));
            Channel.SaveToXml(xmlElem.AppendElem("Channel"));
            CustomOptions.SaveToXml(xmlElem.AppendElem("CustomOptions"));

            XmlElement devicePollingElem = xmlElem.AppendElem("DevicePolling");

            foreach (DeviceConfig device in DevicePolling)
            {
                device.SaveToXml(devicePollingElem.AppendElem("Device"));
            }
        }