PS C:\>

Powerfull like PowerShell

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework.

Scripting and Task automation

There are some tasks that you do on a computer that are repetitive and boring. Best solution is to automate those common tasks.

How to apply a theme on your GUI?

Some tips on how to apply a theme on your GUI ...

Monday, 31 July 2017

Find missing driver or disabled device


At one point of our life, we all had an issue with a missing driver on our computer. A problem with the display not shown correctly because the driver installed is not the appropriate one. A problem with a network card or embedded WIFI card and so on …



GitHub link for this project:
Share:

Monday, 24 July 2017

Using MahApps built-in dialogs with PowerShell


Keeping up with the MahApps.Metro theme, this time I’ll show you how to use the built in Dialog with our WPF window.
When you are looking at the guidelines on the MahApps website they explained how to use asynchronous dialogs (Message Dialog, progress dialog …) with async/await.

Unfortunately, it isn’t available in PowerShell because the UI is using the main thread and managing another thread in PowerShell like other programming language is a little bit frustrating.

I struggled to find a way to make it work with runspacepool and other stuff … but in vain. I was about to stop this project and then I found this.



They made an update in the latest release (1.5.0). New methods are available and we can use them with PowerShell.

These are the two types of dialogs available:
-  internal dialogs
 external dialogs

All the async methods are internal dialogs. Technically you can use them but you cannot get the result. You can try it if you want and test your code with the ShowMessageAsync() method.

External dialogs are a bit different. The UI synchronously waits for the dialog before proceeding, so we can get the result.

All dialogs are available in a Class DialogManager:
[MahApps.Metro.Controls.Dialogs.DialogManager

How do we use it?


First, find the button or the control on which you want to attach the event.
I added a textbox in which I store the result.

$btnOpenDialg      = $ExternalXaml.FindName("btnOpenDialg"
# TextBox for result
$dialgResult       = $ExternalXaml.FindName("dialgResult"

There is nothing to do in the xaml file, everything is managed in the script. I chose to use the “OK/cancel” example because this is the most popular used by people 😊.

The next step is to add the action when a click event occurs.



So to show the message, you call the method inside the dialogManager Class, and that’s it. There’s three mandatory parameters though:
$Form (Your main Form), title and message(otherwise there’s no meaning to it). At least like below then

[MahApps.Metro.Controls.Dialogs.DialogManager]::ShowModalMessageExternal($Form,"Title","Your message. ")

And that’s all. Now you can say goodbye to the old MessageBox and use this new one. 😊

Where to download?


I made a complete project here, with the hamburger menu if you want to download.



Share:

Monday, 17 July 2017

HamburgerMenu V2 with PowerShell


Since my last post «MahApps HamburgerMenu & PowerShell», some people asked me on how to use the version with an image and not the canvas resources available in Icons.xaml.

To achieve this, in this post I’ll show you:
- How to set up your project files.
- What needs to be changed compared to the previous version.

Here is a little preview of what you’ll get at the end:


Share:

Thursday, 13 July 2017

Mahapps.Metro HamburgerMenu with PowerShell



I started a long time ago making a tutorial series about using WPF with PowerShell. For theming my apps, I always use Mahapps and really like this theme. This time I’d like to introduce a new Control available in their latest release: the “HamburgerMenu Control”.

As introduced by Jan Karger in his blog: “since v1.4.0 of Mahapps.Metro contains this new control which is mostly the same as the one from the UWP Community Toolkit”.

In this post, I’ll show you how it works and how to use it with PowerShell. So, at the end of this post, you should have something which looks like this:


Share:

Popular Posts

STATS

Contact Form

Name

Email *

Message *

image
Hello,

I'm Kevin RAHETILAHY

I'm a system and desktop engineer who focuses on scripts, development and maintenance of the software and systems on computers. I also like web design and playing with photoshop. Great fan of volley-ball and symphonic metal.

I created this blog for the main purpose of sharing my knowledge, and solved issues on which I spent times and that may help others. Hope you'll appreciate my works and will help you in yours.