Esempio n. 1
0
        private UIDropDownButton ParseUIDropDownButton(XElement ele)
        {
            UIDropDownButton btn = new UIDropDownButton();

            btn.Text  = ele.Attribute("text").Value;
            btn.Image = ele.Attribute("image").Value;
            if (ele.Attribute("font") != null)
            {
                btn.Font = ele.Attribute("font").Value;
            }
            btn.ExpandArrowButton = bool.Parse(ele.Attribute("expandarrowbutton").Value);
            btn.ArrowPosition     = ele.Attribute("arrowposition").Value;
            if (ele.Attribute("textaligment") != null)
            {
                btn.TextAligment = ele.Attribute("textaligment").Value;
            }
            if (ele.Attribute("imagealigment") != null)
            {
                btn.ImageAligment = ele.Attribute("imagealigment").Value;
            }
            List <UIItem> items = new List <UIItem>();

            foreach (XElement e in ele.Elements())
            {
                switch (e.Name.LocalName)
                {
                case "MenuHeaderItem":
                    items.Add(new UIMenuHeader(e.Attribute("text").Value));
                    break;

                case "MenuItem":
                    UIMenuItem it = new UIMenuItem();
                    it.Text = e.Attribute("text").Value;
                    int id = 0;
                    int.TryParse(e.Attribute("identify").Value, out id);
                    it.Identify = id;
                    it.Image    = e.Attribute("image").Value;
                    it.Argument = e.Attribute("argument").Value;
                    items.Add(it);
                    break;
                }
            }
            btn.MenuItems = items.Count > 0 ? items.ToArray() : null;
            return(btn);
        }
Esempio n. 2
0
        private UIMenuItem ParseMenuItem(XElement e)
        {
            UIMenuItem it = new UIMenuItem();

            it.Text = e.Attribute("text").Value;
            if (e.Attribute("identify") != null)
            {
                int id = 0;
                int.TryParse(e.Attribute("identify").Value, out id);
                it.Identify = id;
            }
            it.Image = e.Attribute("image").Value;
            if (e.Attribute("argument") != null)
            {
                it.Argument = e.Attribute("argument").Value;
            }
            if (e.Attribute("page") != null)
            {
                it.Provider = e.Attribute("page").Value;
            }
            return(it);
        }