/// <summary> /// 从配置文件中加载菜单 /// </summary> public AccordionLayout GetMenu() { var accordionLayout = new AccordionLayout(new AccordionLayout.Config { Animate = true, CollapseFirst = true }); if (String.IsNullOrEmpty(_configFile)) throw new Exception("the path can not be null"); var doc = XElement.Parse(_contentProvider.GetAllText(_configFile)); var menus = doc.Descendants("menu"); foreach (var menu in menus) { var menuPanel = new MenuPanel(new MenuPanel.Config { Title = menu.Attribute("title").Value }); foreach (var submenu in menu.Descendants("submenu")) { var menuItem = new MenuItem { Text = submenu.Attribute("title").Value, Icon = (Icon)(Convert.ToInt32(submenu.Attribute("icon").Value)) }; menuItem.CustomConfig.Add(new ConfigItem { Name = "url", Value = submenu.Attribute("url").Value, Mode = ParameterMode.Value }); menuPanel.Menu.Items.Add(menuItem); } menuPanel.Menu.Listeners.Click.Handler = "Egaplay.Ext.addTab({ title: menuItem.text, url: menuItem.url, icon: menuItem.iconCls });"; accordionLayout.Items.Add(menuPanel); } return accordionLayout; }
public override void Initialize(System.ComponentModel.IComponent component) { base.Initialize(component); if (!this.Disabled) { this.SetViewFlags(ViewFlags.TemplateEditing, true); } this.layout = (AccordionLayout)component; }
public override DesignerActionItemCollection GetSortedActionItems() { this.AddHeaderItem(new DesignerActionHeaderItem("Actions", "600")); DesignerActionMethodItem add = new DesignerActionMethodItem(this, "AddPanel", "Add Panel", "600"); DesignerActionMethodItem remove = new DesignerActionMethodItem(this, "RemovePanel", "Remove panel", "600", "Remove active panel"); AccordionLayout layout = (AccordionLayout)this.Control; this.AddMethodItem(add); if (layout.ExpandedPanelIndex > -1) { this.AddMethodItem(remove); } else { this.RemoveMethodItem(remove); } return(base.GetSortedActionItems()); }
/// <summary> /// /// </summary> public AccordionLayout.Builder AccordionLayout(AccordionLayout component) { return(new AccordionLayout.Builder(component)); }