Пример #1
0
        private void loadMenuItemsRec(Item root, Control ctl)
        {
            ChildList menuitems = root.Children;

            foreach (Item mItem in menuitems)
            {
                Control child = null;
                switch (mItem.Template.Key)
                {
                case "toolmenu":
                    //Toolmenu tm = new Toolmenu();
                    ASR.Controls.Toolmenu tm = new ASR.Controls.Toolmenu();
                    tm.ID = Control.GetUniqueID("T");
                    tm.LoadFromItem(mItem);
                    loadMenuItemsRec(mItem, tm);
                    child = tm;
                    break;

                case "toolbar divider":
                    Tooldivider td = new Tooldivider();
                    child = td;
                    break;

                case "toolbutton":
                    ASR.Controls.ToolButton tb = new ASR.Controls.ToolButton();
                    //Toolbutton tb = new Toolbutton();
                    tb.LoadFromItem(mItem);
                    child = tb;
                    break;

                case "toolmenubutton":
                    //Toolmenubutton tmb = new Toolmenubutton();
                    ASR.Controls.ToolMenuButton tmb = new ASR.Controls.ToolMenuButton();
                    tmb.LoadFromItem(mItem);
                    child = tmb;
                    break;

                case "menu item":
                    MenuItem mi = new MenuItem();
                    mi.LoadFromItem(mItem);
                    child = mi;
                    break;

                default:
                    break;
                }
                if (child != null)
                {
                    ctl.Controls.Add(child);
                }
            }
        }
Пример #2
0
 private void loadMenuItemsRec(Item root, Control ctl)
 {
     ChildList menuitems = root.Children;
     foreach (Item mItem in menuitems)
     {
         Control child = null;
         switch (mItem.Template.Key)
         {
             case "toolmenu":
                 //Toolmenu tm = new Toolmenu();
                 ASR.Controls.Toolmenu tm = new ASR.Controls.Toolmenu();
                 tm.ID = Control.GetUniqueID("T");
                 tm.LoadFromItem(mItem);
                 loadMenuItemsRec(mItem, tm);
                 child = tm;
                 break;
             case "toolbar divider":
                 Tooldivider td = new Tooldivider();
                 child = td;
                 break;
             case "toolbutton":
                 ASR.Controls.ToolButton tb = new ASR.Controls.ToolButton();
                 //Toolbutton tb = new Toolbutton();
                 tb.LoadFromItem(mItem);
                 child = tb;
                 break;
             case "toolmenubutton":
                 //Toolmenubutton tmb = new Toolmenubutton();
                 ASR.Controls.ToolMenuButton tmb = new ASR.Controls.ToolMenuButton();
                 tmb.LoadFromItem(mItem);
                 child = tmb;
                 break;
             case "menu item":
                 MenuItem mi = new MenuItem();
                 mi.LoadFromItem(mItem);
                 child = mi;
                 break;
             default:
                 break;
         }
         if (child != null)
         {
             ctl.Controls.Add(child);
         }
     }
 }