Update: @Jaykul was kind enough to review this code and post an updated (and better) version of this addon with guidelines & best practices. Don’t forget to read the first few lines of text on that page to learn the best practices when scripting WPF UI. A while ago, I wrote about a PowerShell ISE addon that can be used to add items to ISE and load them dynamically by adding the same to ISE profile. This used WinForms to generate the GUI required for the addon functionality. As you may know already, ShowUI 1.1 is available for creating WPF UI in PowerShell. So, I decided to re-write this addon to use ShowUI. Here is the new code: IPMO ShowUI Function New-ISEMenu { New-Grid -Height 310 -Width 525 -AllowDrop:$true -Name "ISEAddonCreator" { $aligmentAttributes = @{ HorizontalAlignment = "Left" VerticalAlignment = "Top" } New-Label -Content "Addon Menu Name" -Height 28 -Width 115 -Margin "12,12,0,0" @aligmentAttributes New-TextBox -Name txtName -Height 23 -Width 231 -Margin "155,14,0,0" @aligmentAttributes New-Label -Height 28 -Width 115 -Margin "12,46,0,0" -Content "Shortcut Key" @aligmentAttributes New-TextBox …
↧