}// onDelete internal override void AddMenuItems(ref IContextMenuCallback piCallback, ref int pInsertionAllowed) { // See if we're allowed to insert an item in the "view" section if (!ReadOnly && (pInsertionAllowed & (int)CCM.INSERTIONALLOWED_TOP) > 0) { // Stuff common to the top menu CONTEXTMENUITEM newitem = new CONTEXTMENUITEM(); newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_TOP; newitem.fFlags = 0; newitem.fSpecialFlags = 0; newitem.strName = CResourceStore.GetString("CSingleCodeGroup:NewOption"); newitem.strStatusBarText = CResourceStore.GetString("CSingleCodeGroup:NewOptionDes"); newitem.lCommandID = COMMANDS.CREATE_CODEGROUP; // Now add this item through the callback piCallback.AddItem(ref newitem); newitem.strName = CResourceStore.GetString("CSingleCodeGroup:DuplicateOption"); newitem.strStatusBarText = CResourceStore.GetString("CSingleCodeGroup:DuplicateOptionDes"); newitem.lCommandID = COMMANDS.DUPLICATE_CODEGROUP; // Now add this item through the callback piCallback.AddItem(ref newitem); } }// AddMenuItems
}// CGenApplications internal override void AddMenuItems(ref IContextMenuCallback piCallback, ref int pInsertionAllowed) { // See if we're allowed to insert an item in the "view" section if ((pInsertionAllowed & (int)CCM.INSERTIONALLOWED_TOP) > 0) { // Stuff common to the top menu CONTEXTMENUITEM newitem = new CONTEXTMENUITEM(); newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_TOP; newitem.fFlags = 0; newitem.fSpecialFlags = 0; newitem.strName = CResourceStore.GetString("CGenApplications:AddApplicationOption"); newitem.strStatusBarText = CResourceStore.GetString("CGenApplications:AddApplicationOptionDes"); newitem.lCommandID = COMMANDS.ADD_APPLICATION; // Now add this item through the callback piCallback.AddItem(ref newitem); newitem.strName = CResourceStore.GetString("CGenApplications:FixApplicationOption"); newitem.strStatusBarText = CResourceStore.GetString("CGenApplications:FixApplicationOptionDes"); newitem.lCommandID = COMMANDS.FIX_APPLICATION; // Now add this item through the callback piCallback.AddItem(ref newitem); } }// AddMenuItems
}// ResultItemSelected internal override void AddMenuItems(ref IContextMenuCallback piCallback, ref int pInsertionAllowed, Object oResultItem) { CONTEXTMENUITEM newitem = new CONTEXTMENUITEM(); // See if we're allowed to insert an item in the "view" section if ((pInsertionAllowed & (int)CCM.INSERTIONALLOWED_TOP) > 0) { // Stuff common to the top menu newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_TOP; newitem.fFlags = 0; newitem.fSpecialFlags = 0; if (oResultItem == null) { newitem.strName = CResourceStore.GetString("CSharedAssemblies:AddOption"); newitem.strStatusBarText = CResourceStore.GetString("CSharedAssemblies:AddOptionDes"); newitem.lCommandID = COMMANDS.ADD_GACASSEMBLY; // Now add this item through the callback piCallback.AddItem(ref newitem); } } // See if we can insert in the view menu if ((pInsertionAllowed & (int)CCM.INSERTIONALLOWED_VIEW) > 0) { newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_VIEW; newitem.fFlags = 0; newitem.fSpecialFlags = 0; // If we're showing the taskpad right now if (m_oResults is CGenericTaskPad) { newitem.strName = CResourceStore.GetString("CSharedAssemblies:ViewAssembliesOption"); newitem.strStatusBarText = CResourceStore.GetString("CSharedAssemblies:ViewAssembliesOptionDes"); newitem.lCommandID = COMMANDS.SHOW_LISTVIEW; } // Currently, we're showing the list view else { newitem.strName = CResourceStore.GetString("CSharedAssemblies:ViewHTMLOption"); newitem.strStatusBarText = CResourceStore.GetString("CSharedAssemblies:ViewHTMLOptionDes"); newitem.lCommandID = COMMANDS.SHOW_TASKPAD; } // Now add this item through the callback piCallback.AddItem(ref newitem); // Add a 'Refresh' menu item newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_VIEW; newitem.fFlags = 0; newitem.fSpecialFlags = 0; newitem.strName = CResourceStore.GetString("CSharedAssemblies:RefreshOption"); newitem.strStatusBarText = CResourceStore.GetString("CSharedAssemblies:RefreshOptionDes"); newitem.lCommandID = COMMANDS.REFRESH_DISPLAY; piCallback.AddItem(ref newitem); } }// AddMenuItems
}// ResultItemSelected internal override void AddMenuItems(ref IContextMenuCallback piCallback, ref int pInsertionAllowed, Object oResultItem) { CONTEXTMENUITEM newitem = new CONTEXTMENUITEM(); // See if we're allowed to insert an item in the "view" section if ((pInsertionAllowed & (int)CCM.INSERTIONALLOWED_TOP) > 0) { if (!m_fIKnowMyDependencies) { // Stuff common to the top menu newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_TOP; newitem.fFlags = 0; newitem.fSpecialFlags = 0; newitem.strName = CResourceStore.GetString("CApplicationDepends:DiscoverNowMenuOption"); newitem.strStatusBarText = CResourceStore.GetString("CApplicationDepends:DiscoverNowMenuOptionDes"); newitem.lCommandID = COMMANDS.FIND_DEPENDENTASSEMBLIES; piCallback.AddItem(ref newitem); } } // See if we can insert in the view menu if ((pInsertionAllowed & (int)CCM.INSERTIONALLOWED_VIEW) > 0) { newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_VIEW; newitem.fFlags = 0; newitem.fSpecialFlags = 0; // If we're showing the taskpad right now if (m_oResults is CGenericTaskPad && m_fAllowListView) { newitem.strName = CResourceStore.GetString("CApplicationDepends:ViewAssembliesOption"); newitem.strStatusBarText = CResourceStore.GetString("CApplicationDepends:ViewAssembliesOptionDes"); newitem.lCommandID = COMMANDS.SHOW_LISTVIEW; } // Currently, we're showing the list view else if (!(m_oResults is CGenericTaskPad)) { newitem.strName = CResourceStore.GetString("CApplicationDepends:ViewHTMLOption"); newitem.strStatusBarText = CResourceStore.GetString("CApplicationDepends:ViewHTMLOptionDes"); newitem.lCommandID = COMMANDS.SHOW_TASKPAD; } // Now add this item through the callback piCallback.AddItem(ref newitem); } }// AddMenuItems
private void AddItem(IContextMenuCallback piCallback, ContextSubMenuItem subMenuItem, ContextMenuItem menuItem) { MmcContextMenuItem item = new MmcContextMenuItem(); item.Name = menuItem.Name; item.StatusBarText = menuItem.StatusText; item.CommandId = menuItem.CommandId; item.InsertionPointId = (uint)subMenuItem.CommandId; item.Flags = 0; item.SpecialFlags = 0; piCallback.AddItem(ref item); }
}// SavePolicy internal override void AddMenuItems(ref IContextMenuCallback piCallback, ref int pInsertionAllowed) { CONTEXTMENUITEM newitem = new CONTEXTMENUITEM(); // See if we're allowed to insert an item in the "view" section if (!ReadOnly && (pInsertionAllowed & (int)CCM.INSERTIONALLOWED_TOP) > 0) { newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_TOP; newitem.fFlags = 0; newitem.fSpecialFlags = 0; newitem.strName = CResourceStore.GetString("CSecurityPolicy:ResetOption"); newitem.strStatusBarText = CResourceStore.GetString("CSecurityPolicy:ResetOptionDes"); newitem.lCommandID = COMMANDS.RESET_POLICY; // Now add this item through the callback piCallback.AddItem(ref newitem); if (!isNoSave) { // See if we can have a recover policy option if (m_fUndo && File.Exists(m_pl.StoreLocation + ".old")) { // Add the save... item to the menu if (m_fRedo) { newitem.strName = CResourceStore.GetString("CSecurityPolicy:RedoOption"); newitem.strStatusBarText = CResourceStore.GetString("CSecurityPolicy:RedoOptionDes"); } else { newitem.strName = CResourceStore.GetString("CSecurityPolicy:UndoOption"); newitem.strStatusBarText = CResourceStore.GetString("CSecurityPolicy:UndoOptionDes"); } newitem.lCommandID = COMMANDS.UNDO_SECURITYPOLICY; // Now add this item through the callback piCallback.AddItem(ref newitem); } } } }// AddMenuItems
private void AddItem(IContextMenuCallback piCallback, ContextMenuItem menuItem, InsertionPointId insertionPointId) { MmcContextMenuItem newItem = new MmcContextMenuItem(); newItem.Name = menuItem.Name; newItem.StatusBarText = menuItem.StatusText; newItem.CommandId = menuItem.CommandId; newItem.InsertionPointId = (uint)insertionPointId; if (menuItem.IsSeparator) { newItem.Flags = (int)ContextMenuFlags.Separator; } else { newItem.Flags = (menuItem.IsChecked ? (int)ContextMenuFlags.Checked : (int)ContextMenuFlags.Unchecked) | (menuItem.IsEnabled ? (int)ContextMenuFlags.Enabled : (int)(ContextMenuFlags.Grayed | ContextMenuFlags.Disabled)); } newItem.SpecialFlags = menuItem.IsDefault ? (int)ContextMenuFlags.SpecialDefaultItem : 0; piCallback.AddItem(ref newItem); }
}// GetPermissionIndex internal override void AddMenuItems(ref IContextMenuCallback piCallback, ref int pInsertionAllowed, Object oResultItem) { // See if we're allowed to insert an item in the "view" section if ((pInsertionAllowed & (int)CCM.INSERTIONALLOWED_VIEW) > 0 && oResultItem == null) { CONTEXTMENUITEM newitem; newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_VIEW; newitem.fFlags = 0; newitem.fSpecialFlags = 0; // If we're showing the taskpad right now if (m_oResults != this) { newitem.strName = CResourceStore.GetString("CSinglePermissionSet:ViewPermissionsOption"); newitem.strStatusBarText = CResourceStore.GetString("CSinglePermissionSet:ViewPermissionsOptionDes"); newitem.lCommandID = COMMANDS.SHOW_LISTVIEW; } // Currently, we're showing the list view else { newitem.strName = CResourceStore.GetString("CSinglePermissionSet:ViewHTMLOption"); newitem.strStatusBarText = CResourceStore.GetString("CSinglePermissionSet:ViewHTMLOptionDes"); newitem.lCommandID = COMMANDS.SHOW_TASKPAD; } // Now add this item through the callback piCallback.AddItem(ref newitem); } // See if we can insert on the top if ((pInsertionAllowed & (int)CCM.INSERTIONALLOWED_TOP) > 0) { CONTEXTMENUITEM newitem = new CONTEXTMENUITEM(); // Stuff common to the top menu newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_TOP; newitem.fFlags = 0; newitem.fSpecialFlags = 0; // If they are right clicking on the node item if (oResultItem == null) { if (!ReadOnly) { newitem.strName = CResourceStore.GetString("CSinglePermissionSet:AddPermOption"); newitem.strStatusBarText = CResourceStore.GetString("CSinglePermissionSet:AddPermOptionDes"); newitem.lCommandID = COMMANDS.ADD_PERMISSIONS; // Now add this item through the callback piCallback.AddItem(ref newitem); } // We only care if the policy level is read only in this case... if the // permission set is read only, we still want to display this menu option if (!base.ReadOnly) { newitem.strName = CResourceStore.GetString("CSinglePermissionSet:DuplicateOption"); newitem.strStatusBarText = CResourceStore.GetString("CSinglePermissionSet:DuplicateOptionDes"); newitem.lCommandID = COMMANDS.DUPLICATE_PERMISSIONSET; // Now add this item through the callback piCallback.AddItem(ref newitem); } } // They right-clicked on one of the permissions shown in the result view else { // If this is a read-only permission set, then provide an option to view the current permission if (ReadOnly) { newitem.strName = CResourceStore.GetString("CSinglePermissionSet:ViewPermOption"); newitem.strStatusBarText = CResourceStore.GetString("CSinglePermissionSet:ViewPermOptionDes"); newitem.lCommandID = COMMANDS.VIEW_PERMISSION; // Now add this item through the callback piCallback.AddItem(ref newitem); } } } }// AddMenuItems
}// CGenSecurity internal override void AddMenuItems(ref IContextMenuCallback piCallback, ref int pInsertionAllowed) { // See if we're allowed to insert an item in the "view" section if ((pInsertionAllowed & (int)CCM.INSERTIONALLOWED_TOP) > 0) { // Stuff common to the top menu CONTEXTMENUITEM newitem = new CONTEXTMENUITEM(); newitem.lInsertionPointID = CCM.INSERTIONPOINTID_PRIMARY_TOP; newitem.fFlags = 0; newitem.fSpecialFlags = 0; // Add the new... item to the menu newitem.strName = CResourceStore.GetString("CGenSecurity:NewOption"); newitem.strStatusBarText = CResourceStore.GetString("CGenSecurity:NewOptionDes"); newitem.lCommandID = COMMANDS.NEW_SECURITYPOLICY; // Now add this item through the callback piCallback.AddItem(ref newitem); // Add the open... item to the menu newitem.strName = CResourceStore.GetString("CGenSecurity:OpenOption"); newitem.strStatusBarText = CResourceStore.GetString("CGenSecurity:OpenOptionDes"); newitem.lCommandID = COMMANDS.OPEN_SECURITYPOLICY; // Now add this item through the callback piCallback.AddItem(ref newitem); // Add the Reset... item to the menu newitem.strName = CResourceStore.GetString("CGenSecurity:ResetOption"); newitem.strStatusBarText = CResourceStore.GetString("CGenSecurity:ResetOptionDes"); newitem.lCommandID = COMMANDS.RESET_POLICY; // Now add this item through the callback piCallback.AddItem(ref newitem); // This option should only be available if the user can write to either // the machine policy level or the user policy level if (!MachineNode.ReadOnly || !UserNode.ReadOnly) { // Add the Adjust Security Policy... item to the menu newitem.strName = CResourceStore.GetString("CGenSecurity:AdjustSecurityOption"); newitem.strStatusBarText = CResourceStore.GetString("CGenSecurity:AdjustSecurityOptionDes"); newitem.lCommandID = COMMANDS.ADJUST_SECURITYPOLICY; // Now add this item through the callback piCallback.AddItem(ref newitem); } // Add the evaulate... item to the menu newitem.strName = CResourceStore.GetString("CGenSecurity:EvaluateAssemOption"); newitem.strStatusBarText = CResourceStore.GetString("CGenSecurity:EvaluateAssemOptionDes"); newitem.lCommandID = COMMANDS.EVALUATE_ASSEMBLY; // Now add this item through the callback piCallback.AddItem(ref newitem); // This option should only be available if the user can write to either // the machine policy level or the user policy level if (!MachineNode.ReadOnly || !UserNode.ReadOnly) { // Add the Add fully trusted... item to the menu newitem.strName = CResourceStore.GetString("CGenSecurity:TrustAssemOption"); newitem.strStatusBarText = CResourceStore.GetString("CGenSecurity:TrustAssemOptionDes"); newitem.lCommandID = COMMANDS.TRUST_ASSEMBLY; // Now add this item through the callback piCallback.AddItem(ref newitem); } // Add the Create Deployment Package... item to the menu newitem.strName = CResourceStore.GetString("CGenSecurity:CreateDeployOption"); newitem.strStatusBarText = CResourceStore.GetString("CGenSecurity:CreateDeployOptionDes"); newitem.lCommandID = COMMANDS.CREATE_MSI; // Now add this item through the callback piCallback.AddItem(ref newitem); } }// AddMenuItems