internal ToolbarItemDef(ComponentDef componentDef, XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "Style":
                    _Style = componentDef.GetStyle(reader.Value);
                    break;

                case "Align":
                    _Align = (ToolbarItemAlign)Enum.Parse(typeof(ToolbarItemAlign), reader.Value);
                    break;

                case "HasText":
                    _HasText = bool.Parse(reader.Value);
                    break;

                case "Command":
                    _Command = reader.Value;
                    break;

                default:
                    Log.Warning("Unknown attribute {0}", reader.LocalName);
                    break;
                }
            }

            reader.MoveToElement();

            if (reader.IsEmptyElement)
            {
                return;
            }

            _Children = new List <ToolbarItemDef>();

            while (reader.Read())
            {
                if (reader.MoveToContent() == XmlNodeType.EndElement)
                {
                    break;
                }

                switch (reader.LocalName)
                {
                case "Item":
                    ToolbarItemDef MyItem = new ToolbarItemDef(componentDef, reader);

                    _Children.Add(MyItem);
                    break;

                default:
                    reader.Skip();
                    break;
                }
            }
        }
예제 #2
0
        internal ToolbarDef(ComponentDef componentDef, XmlReader reader)
        {
            _Items = new List <ToolbarItemDef>();

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "Name":
                    _Name = reader.Value;
                    break;

                default:
                    Log.Warning("Unknown attribute {0}", reader.LocalName);
                    break;
                }
            }

            reader.MoveToElement();

            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.MoveToContent() == XmlNodeType.EndElement)
                {
                    break;
                }

                switch (reader.LocalName)
                {
                case "Item":
                    ToolbarItemDef MyItem = new ToolbarItemDef(componentDef, reader);

                    _Items.Add(MyItem);
                    break;

                default:
                    reader.Skip();
                    break;
                }
            }
        }