Example #1
0
        /// <summary>
        /// Loads values from the config file
        /// </summary>
        /// <param name="configFile">Full path to the config xml file</param>
        /// <returns>true on success</returns>
        public bool Load(XmlNode node)
        {
            Screen  = XmlUtils.GetXMLAttrString(node, "screen");
            Enabled = XmlUtils.GetXMLAttrBool(node, "enabled", true);

            XmlNodeList actuatorNodes = node.SelectNodes("Actuators/Actuator");

            // load all the elements
            foreach (XmlNode actuatorNode in actuatorNodes)
            {
                var actuatorName = XmlUtils.GetXMLAttrString(actuatorNode, "name");
                Log.Debug("actuatorName:  " + actuatorName);
                if (!String.IsNullOrEmpty(actuatorName))
                {
                    actuatorName = actuatorName.ToLower();
                    var switchMapActuator = new SwitchMapActuator();
                    if (!_actuatorsTable.ContainsKey(actuatorName) && switchMapActuator.Load(actuatorNode))
                    {
                        Log.Debug("Adding actuatorNode " + actuatorName);
                        _actuatorsTable.Add(actuatorName, switchMapActuator);
                    }
                }
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Loads values from the config file
        /// </summary>
        /// <param name="configFile">Full path to the config xml file</param>
        /// <returns>true on success</returns>
        public bool Load(XmlNode node)
        {
            Panel = XmlUtils.GetXMLAttrString(node, "screen");
            Enabled = XmlUtils.GetXMLAttrBool(node, "enabled", true);

            XmlNodeList actuatorNodes = node.SelectNodes("Actuators/Actuator");

            // load all the elements
            foreach (XmlNode actuatorNode in actuatorNodes)
            {
                var actuatorName = XmlUtils.GetXMLAttrString(actuatorNode, "name");
                Log.Debug("actuatorName:  " + actuatorName);
                if (!String.IsNullOrEmpty(actuatorName))
                {
                    actuatorName = actuatorName.ToLower();
                    var switchMapActuator = new SwitchMapActuator();
                    if (!_actuatorsTable.ContainsKey(actuatorName) && switchMapActuator.Load(actuatorNode))
                    {
                        Log.Debug("Adding actuatorNode " + actuatorName);
                        _actuatorsTable.Add(actuatorName, switchMapActuator);
                    }
                }
            }

            return true;
        }