Exemple #1
0
        /// <summary>
        /// Parses the background colors of the status labels defined in the examples XML file.
        /// </summary>
        /// <param name="styleElement"></param>
        private void ParseStatusColors(NXmlElement styleElement)
        {
            m_StatusColorMap = new NMap <string, NColor>();
            if (styleElement == null)
            {
                return;
            }

            for (int i = 0, count = styleElement.ChildrenCount; i < count; i++)
            {
                NXmlElement child = styleElement.GetChildAt(i) as NXmlElement;
                if (child == null || child.Name != "status")
                {
                    continue;
                }

                // Get the status name
                string name = child.GetAttributeValue("name");
                if (name == null)
                {
                    continue;
                }

                // Parse the status color
                string colorStr = child.GetAttributeValue("color");
                NColor color;
                if (NColor.TryParse(colorStr, out color) == false)
                {
                    continue;
                }

                // Add the name/color pair to the status color map
                m_StatusColorMap.Set(name, color);
            }
        }