Exemplo n.º 1
0
        private void loadMenuItemsRec(Item root, System.Web.UI.Control ctl)
        {
            var menuitems = root.Children;

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

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

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

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

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

                default:
                    break;
                }
                if (child != null)
                {
                    ctl.Controls.Add(child);
                }
            }
        }
Exemplo n.º 2
0
 private void loadMenuItemsRec(Item root, System.Web.UI.Control ctl)
 {
     var menuitems = root.Children;
       foreach (Item mItem in menuitems)
       {
     Control child = null;
     switch (mItem.Template.Key)
     {
       case "toolmenu":
     //Toolmenu tm = new Toolmenu();
     var tm = new Toolmenu { ID = Control.GetUniqueID("T") };
     tm.LoadFromItem(mItem);
     this.loadMenuItemsRec(mItem, tm);
     child = tm;
     break;
       case "toolbar divider":
     var td = new Tooldivider();
     child = td;
     break;
       case "toolbutton":
     var tb = new ToolButton();
     //Toolbutton tb = new Toolbutton();
     tb.LoadFromItem(mItem);
     child = tb;
     break;
       case "toolmenubutton":
     //Toolmenubutton tmb = new Toolmenubutton();
     var tmb = new ToolMenuButton();
     tmb.LoadFromItem(mItem);
     child = tmb;
     break;
       case "menu item":
     var mi = new MenuItem();
     mi.LoadFromItem(mItem);
     child = mi;
     break;
       default:
     break;
     }
     if (child != null)
     {
       ctl.Controls.Add(child);
     }
       }
 }