当前位置: 首页>>代码示例>>C#>>正文


C# MenuItemCollection.Clear方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.MenuItemCollection.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# MenuItemCollection.Clear方法的具体用法?C# MenuItemCollection.Clear怎么用?C# MenuItemCollection.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.MenuItemCollection的用法示例。


在下文中一共展示了MenuItemCollection.Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: setMenuItemChild

 private void setMenuItemChild(MenuItemCollection mic, params MenuInfo[] menuItems)
 {
     try
     {
         mic.Clear();
         foreach (MenuInfo menuItem in menuItems)
         {
             if (menuItem.Text != "-")
             {
                 MenuItem mi = new MenuItem(menuItem.Text, menuItem.Text);
                 mi.Enabled = menuItem.Enabled;
                 if (
                     String.IsNullOrEmpty(menuItem.NavigateUrl)
                     && menuItem.Text != "Storage connection"
                     && menuItem.Text != "Refresh"
                     && menuItem.SubMenus.Count == 0
                     )
                 {
                     mi.NavigateUrl = String.Format("javascript:openDialog('ModalDialogHandler.aspx?MenuItem={0}&MenuValue={1}');", mi.Text, mi.Value);
                 }
                 else if (!String.IsNullOrEmpty(menuItem.NavigateUrl))
                 {
                     mi.NavigateUrl = menuItem.NavigateUrl;
                     if (!mi.NavigateUrl.StartsWith("javascript:", StringComparison.CurrentCultureIgnoreCase))
                         mi.Target = "_blank";
                 }
                 mi.ToolTip = menuItem.ToolTip;
                 switch (menuItem.Text)
                 {
                     case "Storage connection": mi.ImageUrl = this.getImageUrl("db.gif"); break;
                     case "Options": mi.ImageUrl = this.getImageUrl("Options_16x16.gif"); break;
                     case "Invalidate WCF Cache Service": mi.ImageUrl = this.getImageUrl("Cache_16x16.gif"); break;
                     case "New Store":
                     case "New Application":
                     case "New Store Group":
                     case "New Application Group":
                     case "New Role":
                     case "New Task":
                     case "New Operation":
                         mi.ImageUrl = this.getImageUrl("new.gif"); break;
                     case "Import Store from AzMan":
                         mi.ImageUrl = this.getImageUrl("azman.gif"); break;
                     case "Import Stores":
                     case "Import Store Groups/Application":
                     case "Import Application Groups/Items":
                     case "Import Store Groups":
                     case "Import Application Groups":
                     case "Import Items":
                         mi.ImageUrl = this.getImageUrl("import.gif"); break;
                     case "Export Stores":
                     case "Export Store":
                     case "Export Application":
                     case "Export Store Group":
                     case "Export Application Group":
                     case "Export Items":
                         mi.ImageUrl = this.getImageUrl("export.gif"); break;
                     case "Refresh": mi.ImageUrl = this.getImageUrl("refresh.gif"); break;
                     case "Store Properties": mi.ImageUrl = this.getImageUrl("Store_16x16.gif"); break;
                     case "Items Hierarchical View":
                     case "Items Hierarchy":
                         mi.ImageUrl = this.getImageUrl("Hierarchy_16x16.gif"); break;
                     case "Reports": mi.ImageUrl = this.getImageUrl("print.gif"); break;
                     case "Delete": mi.ImageUrl = this.getImageUrl("delete.gif"); break;
                     case "Items Authorizations": mi.ImageUrl = this.getImageUrl("ItemAuthorization_16x16.gif"); break;
                     case "Mode and Logging": mi.ImageUrl = this.getImageUrl("NetSqlAzMan_16x16.gif"); break;
                     case "Auditing": mi.ImageUrl = this.getImageUrl("SqlAudit_16x16.gif"); break;
                     case "Application Properties": mi.ImageUrl = this.getImageUrl("Application_16x16.gif"); break;
                     case "Generate CheckAccessHelper": mi.ImageUrl = this.getImageUrl("vsnet_16x16.gif"); break;
                     case "Check Access Test": mi.ImageUrl = this.getImageUrl("CheckAccessTest_16x16.gif"); break;
                     case "Application Group Properties":
                     case "Store Group Properties": mi.ImageUrl = this.getImageUrl("StoreApplicationGroup_16x16.gif"); break;
                     case "Role Properties": mi.ImageUrl = this.getImageUrl("Role_16x16.gif"); break;
                     case "Task Properties": mi.ImageUrl = this.getImageUrl("Task_16x16.gif"); break;
                     case "Operation Properties": mi.ImageUrl = this.getImageUrl("Operation_16x16.gif"); break;
                     case "Effective Permissions": mi.ImageUrl = this.getImageUrl("EffectivePermissions_16x16.gif"); break;
                     case "Manage Authorizations": mi.ImageUrl = this.getImageUrl("ItemAuthorization_16x16.gif"); break;
                     default: mi.ImageUrl = this.getImageUrl("blank.gif"); break;
                 }
                 mic.Add(mi);
                 this.setMenuItemChild(mi.ChildItems, menuItem.SubMenus.ToArray());
             }
             else
             {
                 mic[mic.Count - 1].SeparatorImageUrl = "Images/Separator.jpg";
             }
         }
     }
     catch (Exception ex)
     {
         this.ShowError(ex.Message);
     }
 }
开发者ID:JamesTryand,项目名称:NetSqlAzMan,代码行数:92,代码来源:WebConsole.aspx.cs


注:本文中的System.Web.UI.WebControls.MenuItemCollection.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。