Obiekt ISEMenuItemCollection

Obiekt ISEMenuItemCollection jest kolekcją obiektów ISEMenuItem . Jest to wystąpienie klasy Microsoft.PowerShell.Host.ISE.ISEMenuItemCollection . Przykładem jest $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus obiekt, który służy do dostosowywania menu Dodatki w zintegrowanym środowisku skryptów środowiska Windows PowerShell® (ISE).

Method

Add(string DisplayName, System.Management.Automation.ScriptBlock Action, System.Windows.Input.KeyGesture Shortcut )

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Dodaje element menu do kolekcji.

DisplayName Nazwa wyświetlana menu do dodania.

Akcja Obiekt System.Management.Automation.ScriptBlock określający akcję skojarzona z tym elementem menu.

Skrót skrót klawiaturowy dla akcji.

Zwraca właśnie dodany obiekt ISEMenuItem.

# Create an Add-ons menu with a fast access key and a shortcut.
# Note the use of "_"  as opposed to the "&" for mapping to the fast access key letter for the menu item.
$menuAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('_Process', {Get-Process}, 'Alt+P')

Clear()

Obsługiwane w programie Windows PowerShell ISE 2.0 lub nowszym.

Usuwa wszystkie podmenu z elementu menu.

# Remove all custom submenu items from the AddOns menu
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear()

Zobacz też