/// <summary> /// Builds the Sub Menu based on the <paramref name="habaneroMenu"/> definition. /// The Sub Menu items created are added to the menuItems Collection <see cref="IMenuItemCollection"/> /// </summary> /// <param name="habaneroMenu">The definition of the Sub Menu</param> /// <param name="menuItems">The collection to which the Sub Menu items are added</param> public virtual void BuildSubMenu(HabaneroMenu habaneroMenu, IMenuItemCollection menuItems) { foreach (HabaneroMenu submenu in habaneroMenu.Submenus) { menuItems.Add(BuildMenu(submenu)); } }
/// <summary> /// Add the toggle feature menu item. /// </summary> /// <param name="parent">The parent node.</param> /// <param name="items">The menu item collection.</param> /// <param name="featureDetails">The feature info.</param> void AddToggleFeatureMenuItem(IExplorerNode parent, IMenuItemCollection items, FeatureInfo featureDetails) { bool isEnabled = parent.Context.SharePointConnection.ExecuteCommand <FeatureInfo, bool>(FeatureSharePointCommandIds.IsFeatureEnabled, featureDetails); if (isEnabled == false) { IMenuItem item = items.Add( String.Format(CKSProperties.FeatureNodeExtension_ActivateNodeName, featureDetails.Scope)); item.Click += delegate { try { Cursor.Current = Cursors.WaitCursor; parent.Context.SharePointConnection.ExecuteCommand <FeatureInfo>( FeatureSharePointCommandIds.EnableFeature, featureDetails); } finally { Cursor.Current = Cursors.Default; } }; } else { IMenuItem item = items.Add( String.Format(CKSProperties.FeatureNodeExtension_DeactivateNodeName, featureDetails.Scope)); item.Click += delegate { try { Cursor.Current = Cursors.WaitCursor; parent.Context.SharePointConnection.ExecuteCommand <FeatureInfo>( FeatureSharePointCommandIds.DisableFeature, featureDetails); } finally { Cursor.Current = Cursors.Default; } }; } }
/// <summary> /// Add the copy Id menu item. /// </summary> /// <param name="parent">The parent node.</param> /// <param name="items">The menu item collection.</param> /// <param name="nodeInfo">The feature info.</param> void AddCopyIDMenuItem(IExplorerNode parent, IMenuItemCollection items, IFeatureNodeInfo nodeInfo) { IMenuItem copyIdItem = items.Add(CKSProperties.FeatureNodeExtension_CopyIdNodeName, 1); copyIdItem.Click += new EventHandler <MenuItemEventArgs>(CopyIdItem_Click); }