Ejemplo n.º 1
0
        public override AbstractStyleElement Clone()
        {
            AbstractStyleElement clone = new StyleElementPenSize(m_iPenSize);

            clone.Bind(this);
            return(clone);
        }
Ejemplo n.º 2
0
        public void ReadXml(XmlReader _xmlReader)
        {
            m_StyleElements.Clear();

            _xmlReader.ReadStartElement();              // <ToolPreset Key="ToolName"> or <DrawingStyle>
            while (_xmlReader.NodeType == XmlNodeType.Element)
            {
                AbstractStyleElement styleElement = null;
                string key = _xmlReader.GetAttribute("Key");

                switch (_xmlReader.Name)
                {
                case "Color":
                    styleElement = new StyleElementColor(_xmlReader);
                    break;

                case "FontSize":
                    styleElement = new StyleElementFontSize(_xmlReader);
                    break;

                case "PenSize":
                    styleElement = new StyleElementPenSize(_xmlReader);
                    break;

                case "LineSize":
                    styleElement = new StyleElementLineSize(_xmlReader);
                    break;

                case "Arrows":
                    styleElement = new StyleElementLineEnding(_xmlReader);
                    break;

                case "TrackShape":
                    styleElement = new StyleElementTrackShape(_xmlReader);
                    break;

                default:
                    log.ErrorFormat("Could not import style element \"{0}\"", _xmlReader.Name);
                    log.ErrorFormat("Content was: {0}", _xmlReader.ReadOuterXml());
                    break;
                }

                if (styleElement != null)
                {
                    m_StyleElements.Add(key, styleElement);
                }
            }

            _xmlReader.ReadEndElement();
        }