Powershell & WPF: Build a prerequisites GUI - Part 3

In this post I will show another sample I created to build a prereuiste part in your WPF application. 
See below the first two parts:
- Part 1
- Part 2

Where to find it ?

Why a prerequisite part ?
When you build an application, it could be useful to check some options before running the main code.
For instance if you want to build an application to run an upgrade of your Operating System using SCCM or MDT, it could be useful to check sme parameters as below:
- Is computer supported ?
- Enough RAM ?
- Enough free disk space ?
- Plugged-in or battery ?
- Secure boot enable ?

How it looks like ?
This sample uses the same PowerShell code than in the previous samples, meaning check RAM, disk size...
I changed the XAML orientation in order to display it with an horiontal orientation and not vertical.
See below an overview of the sample:

On the Sources folder there is another XAML, Prerequisites_Icons, which uses icons inside circle.
See below an overview:

Building the XAML
Each prerequisite is composed of a button with icon and a text part to display the step number or name, as below:
Between each part I added a Line Control, as below:
- If the previous and next prerequisites are OK the line will be green.
- If one of the previous or next prerequisite, the line will be red.  

For instance if the Step 1 is OK and Step 2 is KO the result will be as below:

Now if you need to add a new prerequisite, add the below part:

What about the PS1 ?
To change the color of label, button and the line between part, I used the below attributes:
See below the code used to check minimum RAM size and change Step 1 part color: 
See below the code used to check minimum free disk size  and change Step 2 part color: 
See below the code used to set color of the line depending of both above results:
WPF_Guides 5339678785937834647

Enregistrer un commentaire

Accueil item


Endpoint Manager award

Mes articles en français

Author of Books

PowerShell GUI & WPF Group

PowerShell GUI & WPF Group

Join the FPSUGR

Join the FPSUGR