if you want to raise an event by your powershell code use the following command:
$GUI_Manager_rCodeBehind.RaiseEvent((New-Object -TypeName System.Windows.RoutedEventArgs -ArgumentList $([System.Windows.Controls.Button]::ClickEvent)))
The variable (here: $GUI_Manager_rCodeBehind) is the object from which you want to raise the event. In the parameters you have to insert your event in the ArgumentList. This example is for a ButtonClick event – [System.Windows.Controls.Button]::ClickEvent).
May be you will need it at some point.
today i want to show you one of the most essential and powerful ways to fill a GUI with life. Bindings.
in the previous post i described what a dialog consists of and introduced the module PSGUI. Now i will show you some features which will work mostly at the loading time.
3 months ago i started a project to create user interfaces for Powershell with WPF as simple as possible for everyone by using a – POWERSHELL GUI.
Powershell GUI with Powershell GUI?! – sounds paradox – but hey – one example will be ready the whole time. 😀
Many times there had been administrators, customers and friends who asked for a GUI in PS. Probably the loudest group crying had been the administrators who normally should work easily with Powershell. But IT-guys are lazy – and because of these laziness we create powerfull scripts which make life easier. And if a wonderfull looking GUI is on top of this functionality – even better!
Though you should never forget – by adding a GUI to a module / function of yours you can prevent lots of input errors by the user. The user gets happy because he can click and sees a wonderful design and you can add an additional abstraction layer preventing lots of headaches.
The primary aims with this project had been:
- everyone can do it
- structured and separated code by logic
- easy to create and deploy dialogs
- easy to manage multiple dialogs
- free code to use for everyone
- examples for small and easy but also further on more complex solutions
- preconfigured examples for some use-cases
- as many internal functions to avoid manual work
- no dependencies to proprietary programs
Interested? then take a look into!