All posts filed under: WPF

A simple PowerShell script explorer addon using ShowUI

Update: The select-ViaUI function is no more in ShowUI module starting version 1.2. So, if you plan to run this, you need to go back to ShowUI 1.1. Okay, there is nothing really fancy here. This is all done in just ten lines of PowerShell code. In fact, only 3 lines for the real logic. I am not even creating my own UI to do this. This is all done using the Select-ViaUI cmdlet in ShowUI module. Here is how it looks: So, within this addon, I list all ps1, psm1, and xml files at a pre-defined location. At the bottom, you see a search box. If you find it difficult to scroll to the item you want, you can just type the name ( or partial name) and filter the list. Once you select the item, just click OK to open that file(s) in ISE. Simple! Here is the code:

Just execute the above code or add the above code to your ISE profile and restart ISE. Now, when you press Ctrl+Alt+E, this …

PowerShell ISE addon menu generator – The ShowUI way

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:

The WinForms implementation of this addon had 235 lines of PowerShell code. Where as, ShowUI version has only 48 lines! This shows that the value per line of PowerShell code is amazing when using ShowUI. ShowUI really makes it easy. Thanks to James Brundage and Joel Bennett. Now, to use this addon: Copy the contents of above script …

Windows Presentation Foundation via PowerShell – Introduction

I did a survey (on GUI for PowerShell Scripts) a while ago to understand what frameworks do people use when they need to create a user interface (UI) for their PowerShell scripts. The responses clearly showed WinForms was one of the favorite choices for several reasons I mentioned in that post. Most used UI frameworks Both WPK and PowerBoots were powerful frameworks which enabled creation of Windows Presentation Framework (WPF) based user interfaces in PowerShell. But, in my opinion, lack of community examples and WPF awareness made people to stay away from these frameworks. However, this perception may slowly change. The brains behind WPK and PowerBoots, came together to create what is known as ShowUI. This new framework promises to make the complicated world of WPF easy to use in PowerShell. ShowUI is currently in version 1.0 and can be downloaded from http://showui.codeplex.com/.  James, Joel, and Doug have been doing several blog posts and videos to show the power of ShowUI. So, this is the right time to start exploring ShowUI, ask questions, or provide …