ConfigMgr: Splash Screen for Driver and BIOS Update

BEFORE YOU BEGIN

In this blog I will be using a Splash Screen script original created by Trevor Jones.

THE SPLASH SCREEN

In my search for a solution to display information to our end users during In-Place Upgrade, I found a blog by Gary Blok, which led me to the original blog from Trevor Jones.
I will not be diving deep into the details, so please read Trevor and Gary's blog above if you want detailed information about the Splash Screen.
My version is based on the original and the modified version by Gary, I started with Trevor's "Take 2" version and took some bit from Gary's version before I modified it to fit my own environment and needs.
During this process I found another purpose for the Splash Screen, why not use it for driver and BIOS update on existing machines in my environment?
Splash Screen - Welcome
Splash Screen - We are doing...
Splash Screen - Should anything go...
A fully integrated Modern Driver and BIOS Management solution by @SCConfigMgr is running behind the scenes.
Changes I've made:
Added:
    Several Task Sequence variables for multi-language purpose
      SG_Welcome_001 = Hi
      SG_Welcome_002 = there
      SG_Information_001 = Don’t turn off your PC
      SG_Progress_001 = Driver and BIOS Update Progress
      SG_Progress_002 = Windows Setup Progress
    MetroProgressBar color
    ProgressBar for Driver and BIOS purpose
Changed:
    GivenName split command
    Renaming some of the Task Sequence variables
    Final sentence to display the Task Sequence SA_002
    ProgressRing color
    ProgressBar Visibility = Default set to hidden, will only show is registry name found
    ProgressBar to MetroProgressBar
    Slowed down the rotating text
    Default Window and Animation color
Removed:
    Stopwatch / Timer

Multi-Language

Splash Screen - Danish
Splash Screen - Norwegian

Task Sequence Settings

Task Sequence - Splash Screen
I've created some new global variables for welcome, progress and general information in different languages.
Task Sequence - Splash Screen
I detect the language from the above registry settings.
Task Sequence - Splash Screen
I've created some update variables that will be added into an array to be displayed in the rotating text screen and in different languages.
Task Sequence - Splash Screen
Because I hide the TS Progress UI during my main Task Sequence, I'm using –process: Explorer.exe instead, since the process TSProgressUI.exe is not running.
1
ServiceUI.exe -process:Explorer.exe %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File "SplashScreen\Show-OSUpgradeBackground.ps1"
Copied!

The ProgressBar

Woah! How did you create the progressbar and the % completed, you might ask?
Task Sequence - Dynamic Driver and BIOS Update
I simply created a registry key with a small PowerShell script and added a value with a parameter that the Splash Screen script reads.
Task Sequence - Dynamic Driver and BIOS Update
I re-use that script and just add new values with the parameter
Task Sequence - Dynamic Driver and BIOS Update
At the end of my Task Sequence, I remove the registry key with another small PowerShell script.

Scripts

Script (Create Progress)
1
Param (
2
[String]$Progress = "0"
3
)
4
5
$Reg = "HKLM:\Software\Splash"
6
$Name = "UpdateProgress"
7
$Value = $Progress
8
$Type = "DWORD"
9
10
if (!(Test-Path $Reg)){
11
New-Item -Path $Reg -Force | Out-Null
12
New-ItemProperty -Path $Reg -Name $Name -PropertyType $Type -Value $Value -Force | Out-Null
13
}
14
else{
15
Set-ItemProperty -Path $Reg -Name $Name -Type $Type -Value $Value -Force | Out-Null
16
}
Copied!
Script (Remove Progress)
1
$Reg = "HKLM:\Software\Splash"
2
if ((Test-Path $Reg)){Remove-Item -Path $Reg -Force | Out-Null}
Copied!
To implement the Splash Screen with my changes, download the original Splash Screen from Trevor's GitHub repo, which includes all the files you need, and then replace the content of the two files with this content:
Script (SplashScreen.xaml)
1
<Window
2
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
5
Title="MainWindow" Background="#00345c" WindowStyle="None" ResizeMode="NoResize" Foreground="White" Topmost="True" Left="0" Top="0" Height="0" Width="0">
6
<Window.Resources>
7
<ResourceDictionary>
8
<ResourceDictionary.MergedDictionaries>
9
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
10
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
11
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
12
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
13
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
14
</ResourceDictionary.MergedDictionaries>
15
</ResourceDictionary>
16
</Window.Resources>
17
<Grid Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
18
<Grid.RowDefinitions>
19
<RowDefinition Height="1*"/>
20
<RowDefinition Height="0.6*"/>
21
<RowDefinition Height="1*"/>
22
<RowDefinition Height="Auto"/>
23
</Grid.RowDefinitions>
24
<Controls:ProgressRing Grid.Row="1" Name="ProgressRing" Opacity="0" IsActive="False" Margin="0,0,0,20" Foreground="#FFFFFF"/>
25
<TextBlock Grid.Row="2" Name="MainTextBlock" Text="" TextWrapping="Wrap" MaxWidth="0" Margin="0,0,0,50" FontSize="50" FontWeight="Light" VerticalAlignment="Top" HorizontalAlignment="Center" Opacity="0" />
26
<StackPanel Grid.Row="3" Margin="0,0,0,60" VerticalAlignment="Bottom">
27
<TextBlock Name="TextBlock2" Text="" TextWrapping="Wrap" MaxWidth="0" Margin="0,0,0,15" FontSize="18" FontWeight="Light" VerticalAlignment="Bottom" HorizontalAlignment="Center" Opacity="0" />
28
<Controls:MetroProgressBar Name="ProgressBar" Value="0" Width="210" Visibility="Hidden" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,15">
29
<Controls:MetroProgressBar.Foreground>
30
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
31
<GradientStop Color="#a7e590" Offset="0"/>
32
<GradientStop Color="#05b024" Offset="1"/>
33
</LinearGradientBrush>
34
</Controls:MetroProgressBar.Foreground>
35
</Controls:MetroProgressBar>
36
<TextBlock Name="TextBlock3" Text="" TextWrapping="Wrap" MaxWidth="0" Margin="0,0,0,40" FontSize="18" FontWeight="Light" VerticalAlignment="Bottom" HorizontalAlignment="Center" Opacity="0" />
37
<TextBlock Name="TextBlock4" Text="" TextWrapping="Wrap" MaxWidth="0" Margin="0,0,0,40" FontSize="25" FontWeight="Light" VerticalAlignment="Bottom" HorizontalAlignment="Center" Opacity="0" />
38
</StackPanel>
39
</Grid>
40
</Window>
Copied!
Script (Create-FullScreenBackground.ps1)
1
<#
2
2019-08-08 Modified by @SuneThomsenDK
3
OSDSune https://www.osdsune.com/home/blog/2019/splash-screen-driver-bios-update
4
Added:
5
- Several TS variables for multi language purpose
6
SG_Welcome_001 = Hi
7
SG_Welcome_002 = there
8
SG_Information_001 = Don't turn off your PC
9
SG_Progress_001 = Driver and BIOS Update Progress
10
SG_Progress_002 = Windows Setup Progress
11
- MetroProgressBar color
12
- ProgressBar for Driver and BIOS purpose
13
14
Changed:
15
- GivenName split command
16
- Renaming some of @gwblok variables eg. SC_ColourBrighterAnimation1 -> SC_ColourBrighterAnimation_001
17
- @gwblok final sentence to display SA_002
18
- ProgressRing color
19
- ProgressBar Visibility = Default set to hidden, will only show is registry name found
20
- ProgressBar to MetroProgressBar
21
- Slowed down the rotating text
22
- Default Window and Animation color
23
24
Removed:
25
- Stopwatch / Timer
26
27
28
2019-08-01 Modified by @trevor_smsagent
29
SMSAgent https://smsagent.blog/2019/08/01/windows-10-upgrade-splash-screen-take-2/
30
- Added a progress bar and percentage for the Windows Setup percent complete
31
- Added a timer so the user knows how long the upgrade has been running
32
- Prevent the monitors from going to sleep while the splash screen is displayed
33
- Added a simple way to close the splash screen in a failure scenario by setting a task sequence variable
34
- Re-wrote the WPF part into XAML code
35
36
37
2019-03-20 Modified by @gwblok
38
GARYTOWN https://garytown.com/windows-splash-screen-for-the-task-sequence-progress
39
- Added Several Text Boxes (3 & 4)
40
Text Box 3 = TS Step Name (Pulled from TS Variable)
41
Text Box 4 = Windows Setup Engine % Complete (Pulled from Registry)
42
43
This now pulls in the Rotating Text from the Task Sequence variables.. use "Set Dynamic Task Sequence Variable" Step, then create as many as you like.
44
- Variable Name must start with SA_ ex: (SA Splash Array)
45
SA_001 This Line never actually displays
46
SA_002 We're upgrading you to Windows 10 %SMSTS_BUILD%
47
SA_003 It may take 60 - 120 minutes
48
WindowBackGroundDefault
49
This now pulls colors from the Task Sequence variables as well. Example TS Vars SC_ (SC Splash Color)
50
SC_WindowBackGroundDefault = Default Color of Back Ground
51
SC_ColourBrighterAnimation1 = Starting Color -> Fades to SC_ColourBrighterAnimation2
52
SC_ColourBrighterAnimation2
53
SC_ColourDarkerAnimation1 = Starting Color -> Fades to SC_ColourDarkerAnimation2
54
SC_ColourDarkerAnimation2
55
56
SC_ColourBrighterAnimation1 Should be set the same as SC_ColourDarkerAnimation2
57
SC_ColourBrighterAnimation2 Should be set the same as SC_ColourDarkerAnimation1
58
59
60
2018-08-21 Created by @trevor_smsagent
61
SMSAgent https://smsagent.blog/2018/08/21/create-a-custom-splash-screen-for-a-windows-10-in-place-upgrade/
62
- Creates a full screen 'background' styled for a Windows 10 upgrade, and hides the task bar
63
- Called by the "Show-OSUpgradeBackground" script
64
65
#>
66
67
Param($DeviceName)
68
69
#===================================================================================================
70
# Create TSEnvironment COM object
71
#===================================================================================================
72
$TSENV = New-Object -COMObject Microsoft.SMS.TSEnvironment
73
74
#===================================================================================================
75
# Set the location we are running from
76
#===================================================================================================
77
$Source = $PSScriptRoot
78
79
Add-Type -AssemblyName PresentationFramework,PresentationCore,WindowsBase,System.Windows.Forms,System.Drawing,System.DirectoryServices.AccountManagement
80
Add-Type -Path "$Source\bin\System.Windows.Interactivity.dll"
81
Add-Type -Path "$Source\bin\ControlzEx.dll"
82
Add-Type -Path "$Source\bin\MahApps.Metro.dll"
83
84
#===================================================================================================
85
# Add custom type to hide the taskbar
86
#===================================================================================================
87
$CSharpTaskbar = @"
88
using System;
89
using System.Runtime.InteropServices;
90
91
public class Taskbar
92
{
93
[DllImport("user32.dll")]
94
private static extern int FindWindow(string className, string windowText);
95
[DllImport("user32.dll")]
96
private static extern int ShowWindow(int hwnd, int command);
97
98
private const int SW_HIDE = 0;
99
private const int SW_SHOW = 1;
100
101
protected static int Handle
102
{
103
get
104
{
105
return FindWindow("Shell_TrayWnd", "");
106
}
107
}
108
109
private Taskbar()
110
{
111
// hide ctor
112
}
113
114
public static void Show()
115
{
116
ShowWindow(Handle, SW_SHOW);
117
}
118
119
public static void Hide()
120
{
121
ShowWindow(Handle, SW_HIDE);
122
}
123
}
124
"@
125
Add-Type -ReferencedAssemblies "System", "System.Runtime.InteropServices" -TypeDefinition $CSharpTaskbar -Language CSharp
126
127
#===================================================================================================
128
# Add custom type to prevent the screen from sleeping
129
#===================================================================================================
131
using System;
132
using System.Runtime.InteropServices;
133
134
public class DisplayState
135
{
136
[DllImport("kernel32.dll", CharSet = CharSet.Auto,SetLastError = true)]
137
public static extern void SetThreadExecutionState(uint esFlags);
138
139
public static void KeepDisplayAwake()
140
{
141
SetThreadExecutionState(
142
0x00000002 | 0x80000000);
143
}
144
145
public static void Cancel()
146
{
147
SetThreadExecutionState(0x80000000);
148
}
149
}
150
'@
151
Add-Type -ReferencedAssemblies "System", "System.Runtime.InteropServices" -TypeDefinition $CSharpScreenSleep -Language CSharp
152
153
#===================================================================================================
154
# Load the main window XAML code
155
#===================================================================================================
156
[XML]$Xaml = [System.IO.File]::ReadAllLines("$Source\Xaml\SplashScreen.xaml")
157
158
#===================================================================================================
159
# Create a synchronized hash table and add the WPF window and its named elements to it
160
#===================================================================================================
161
$UI = [System.Collections.Hashtable]::Synchronized(@{})
162
$UI.Window = [Windows.Markup.XamlReader]::Load((New-Object -TypeName System.Xml.XmlNodeReader -ArgumentList $xaml))
163
$xaml.SelectNodes("//*[@*[contains(translate(name(.),'n','N'),'Name')]]") | ForEach-Object -Process {$UI.$($_.Name) = $UI.Window.FindName($_.Name)}
164
if ($TSENV){$UI.Window.Background = $tsenv.Value("SC_WindowBackGroundDefault")}
165
166
#===================================================================================================
167
# Find screen by DeviceName
168
#===================================================================================================
169
$Screens = [System.Windows.Forms.Screen]::AllScreens
170
$Screen = $Screens | Where {$_.DeviceName -eq $DeviceName}
171
172
#===================================================================================================
173
# Get the bounds of the primary screen
174
#===================================================================================================
175
$Script:Bounds = $Screen.Bounds
176
177
#===================================================================================================
178
# Set some initial values
179
#===================================================================================================
180
$UI.MainTextBlock.MaxWidth = $Bounds.Width
181
$UI.TextBlock2.MaxWidth = $Bounds.Width
182
$UI.TextBlock3.MaxWidth = $Bounds.Width
183
$UI.TextBlock4.MaxWidth = $Bounds.Width
184
if ($TSENV){
185
$Welcome01 = $tsenv.Value("SG_Welcome_001")
186
$Welcome02 = $tsenv.Value("SG_Welcome_002")
187
$UI.TextBlock4.Text = $tsenv.Value("SG_Information_001")
188
}
189
else{
190
$Welcome01 = "Hi"
191
$Welcome02 = "there"
192
$UI.TextBlock4.Text = "Don't turn off your PC"
193
}
194
195
#===================================================================================================
196
# Find the user identity from the domain if possible
197
#===================================================================================================
198
$LoggedOnSID = Get-WmiObject -Namespace ROOT\CCM -Class CCM_UserLogonEvents -Filter "LogoffTime=null" | Select -ExpandProperty UserSID
199
if ($LoggedOnSID.GetType().IsArray){
200
#===================================================================================================
201
# Multiple values returned
202
#===================================================================================================
203
$GivenName = "$Welcome02"
204
}
205
else{
206
$RegKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\SessionData"
207
$DisplayName = (Get-ChildItem -Path $RegKey | Where {$_.GetValue("LoggedOnUserSID") -eq $LoggedOnSID}).GetValue("LoggedOnDisplayName")
208
if ($DisplayName){
209
$GivenName = $DisplayName.Split()[0].Trim()
210
}
211
else{
212
$GivenName = "$Welcome02"
213
}
214
}
215
$UI.MainTextBlock.Text = "$Welcome01 $GivenName"
216
217
#===================================================================================================
218
# Create some animations
219
#===================================================================================================
220
if ($TSENV){
221
$FadeinAnimation = [System.Windows.Media.Animation.DoubleAnimation]::new(0,1,[System.Windows.Duration]::new([Timespan]::FromSeconds(3)))
222
$FadeOutAnimation = [System.Windows.Media.Animation.DoubleAnimation]::new(1,0,[System.Windows.Duration]::new([Timespan]::FromSeconds(3)))
223
$ColourBrighterAnimation = [System.Windows.Media.Animation.ColorAnimation]::new($tsenv.Value("SC_ColourBrighterAnimation_001"),$tsenv.Value("SC_ColourBrighterAnimation_002"),[System.Windows.Duration]::new([Timespan]::FromSeconds(7)))
224
$ColourDarkerAnimation = [System.Windows.Media.Animation.ColorAnimation]::new($tsenv.Value("SC_ColourDarkerAnimation_001"),$tsenv.Value("SC_ColourDarkerAnimation_002"),[System.Windows.Duration]::new([Timespan]::FromSeconds(7)))
225
}
226
else{
227
$FadeinAnimation = [System.Windows.Media.Animation.DoubleAnimation]::new(0,1,[System.Windows.Duration]::new([Timespan]::FromSeconds(3)))
228
$FadeOutAnimation = [System.Windows.Media.Animation.DoubleAnimation]::new(1,0,[System.Windows.Duration]::new([Timespan]::FromSeconds(3)))
229
$ColourBrighterAnimation = [System.Windows.Media.Animation.ColorAnimation]::new("#00345c","#0171c7",[System.Windows.Duration]::new([Timespan]::FromSeconds(7)))
230
$ColourDarkerAnimation = [System.Windows.Media.Animation.ColorAnimation]::new("#0171c7","#00345c",[System.Windows.Duration]::new([Timespan]::FromSeconds(7)))
231
}
232
233
if ($TSENV){
234
$TextArrayVars = (New-Object -COMObject Microsoft.SMS.TSEnvironment).GetVariables() | Where-Object {$_ -Like "SA_*"}
235
$TextArray = ForEach ($Values in $TextArrayVars) {$tsenv.Value($Values)}
236
}
237
else{
238
#===================================================================================================
239
# An array of sentences to display, in order. Leave the first one blank as the 0 index gets skipped.
240
#===================================================================================================
241
$TextArray = @(
242
"This line never actually displays"
243
"We are upgrading your PC to Windows 10"
244
"It may take 30-90 minutes"
245
"Your PC will restart several times"
246
"Should anything go wrong, contact HelpDesk"
247
"Now might be a good time to get a coffee :)"
248
)
249
}
250
$Script:i = 0
251
252
#===================================================================================================
253
# Start a dispatcher timer. This is used to control when the sentences are changed.
254
#===================================================================================================
255
$TimerCode = {
256
$UI.ProgressRing.IsActive = $True
257
if ($tsenv.Value("QuitSplashing") -eq "True"){$UI.Window.Close()}
258
259
#===================================================================================================
260
# The IF statement number should equal the number of sentences in the TextArray
261
#===================================================================================================
262
$NumberofElements = $TextArray.Count -1
263
if ($Script:i -lt $NumberofElements){
264
$FadeoutAnimation.Add_Completed({
265
$UI.MaintextBlock.Opacity = 0
266
$UI.MaintextBlock.Text = $TextArray[$Script:i]
267
$UI.MaintextBlock.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeinAnimation)
268
})
269
$UI.MaintextBlock.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeoutAnimation)
270
}
271
#===================================================================================================
272
# The final sentence to display ongoing
273
#===================================================================================================
274
elseif ($Script:i -eq $NumberofElements){
275
$Script:i = 0
276
$FadeoutAnimation.Add_Completed({
277
if ($TSENV){
278
$UI.MaintextBlock.Opacity = 0
279
$UI.MaintextBlock.Text = $tsenv.Value("SA_002")
280
$UI.MaintextBlock.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeinAnimation)
281
}
282
else{
283
$UI.MaintextBlock.Opacity = 0
284
$UI.MaintextBlock.Text = "We are upgrading your PC to Windows 10"
285
$UI.MaintextBlock.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeinAnimation)
286
}
287
288
})
289
$UI.MaintextBlock.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeoutAnimation)
290
}
291
else{
292
}
293
$ColourBrighterAnimation.Add_Completed({$UI.Window.Background.BeginAnimation([System.Windows.Media.SolidColorBrush]::ColorProperty,$ColourDarkerAnimation)})
294
$UI.Window.Background.BeginAnimation([System.Windows.Media.SolidColorBrush]::ColorProperty,$ColourBrighterAnimation)
295
$Script:i++
296
}
297
#===================================================================================================
298
# Main Text Time
299
#===================================================================================================
300
$DispatcherTimer = New-Object -TypeName System.Windows.Threading.DispatcherTimer
301
$DispatcherTimer.Interval = [TimeSpan]::FromSeconds(14)
302
$DispatcherTimer.Add_Tick($TimerCode)
303
304
#===================================================================================================
305
# Runs at every 1 second to try to make sure it catches all of the progress.
306
#===================================================================================================
307
$TimerCodeProgress = {
308
if ($TSENV){
309
if ($tsenv.Value("InstallationType") -eq "DDBU"){
310
$ProgressValue = Get-ItemProperty -Path HKLM:\Software\MOE -Name UpdateProgress | Select -ExpandProperty UpdateProgress -ErrorAction SilentlyContinue
311
$ProgressText = $tsenv.Value("SG_Progress_001")
312
}
313
else{
314
$ProgressValue = Get-ItemProperty -Path HKLM:\SYSTEM\Setup\MoSetup\Volatile -Name SetupProgress | Select -ExpandProperty SetupProgress -ErrorAction SilentlyContinue
315
$ProgressText = $tsenv.Value("SG_Progress_002")
316
}
317
}
318
else{
319
$ProgressValue = Get-ItemProperty -Path HKLM:\SYSTEM\Setup\MoSetup\Volatile -Name SetupProgress | Select -ExpandProperty SetupProgress -ErrorAction SilentlyContinue
320
$ProgressText = "Windows Setup Progress"
321
}
322
if ($ProgressValue){
323
$UI.ProgressBar.Visibility = "Visible"
324
$UI.ProgressBar.Value = $ProgressValue
325
$UI.TextBlock2.Text = "$ProgressText ($ProgressValue%)"
326
}
327
}
328
#===================================================================================================
329
# Upgrade Text Time
330
#===================================================================================================
331
$DispatcherTimerProgress = New-Object -TypeName System.Windows.Threading.DispatcherTimer
332
$DispatcherTimerProgress.Interval = [TimeSpan]::FromMilliseconds(500)
333
$DispatcherTimerProgress.Add_Tick($TimerCodeProgress)
334
335
#===================================================================================================
336
# Runs at every 1/2 second to try to make sure it catches all of the step names.
337
#===================================================================================================
338
$TimerCodeStep = {
339
$StepInfo = $tsenv.Value("_SMSTSCurrentActionName")
340
$UI.TextBlock3.Text = $StepInfo
341
}
342
#===================================================================================================
343
# Task Sequence Step Text Time
344
#===================================================================================================
345
$DispatcherTimerStep = New-Object -TypeName System.Windows.Threading.DispatcherTimer
346
$DispatcherTimerStep.Interval = [TimeSpan]::FromMilliseconds(500)
347
$DispatcherTimerStep.Add_Tick($TimerCodeStep)
348
349
#===================================================================================================
350
# Event: Window loaded
351
#===================================================================================================
352
$UI.Window.Add_Loaded({
353
#===================================================================================================
354
# Activate the window to bring it to the fore
355
#===================================================================================================
356
$This.Activate()
357
358
#===================================================================================================
359
# Fill the screen
360
#===================================================================================================
361
$This.Left = $Bounds.Left
362
$This.Top = $Bounds.Top
363
$This.Height = $Bounds.Height
364
$This.Width = $Bounds.Width
365
366
#===================================================================================================
367
# Hide the taskbar
368
#===================================================================================================
369
[TaskBar]::Hide()
370
371
#===================================================================================================
372
# Hide the mouse cursor
373
#===================================================================================================
374
[System.Windows.Forms.Cursor]::Hide()
375
376
#===================================================================================================
377
# Keep Display awake
378
#===================================================================================================
379
[DisplayState]::KeepDisplayAwake()
380
381
#===================================================================================================
382
# Begin animations
383
#===================================================================================================
384
$UI.MaintextBlock.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeinAnimation)
385
$UI.TextBlock2.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeinAnimation)
386
$UI.TextBlock3.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeinAnimation)
387
$UI.TextBlock4.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeinAnimation)
388
$UI.ProgressRing.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeinAnimation)
389
$UI.ProgressBar.BeginAnimation([System.Windows.Controls.TextBlock]::OpacityProperty,$FadeinAnimation)
390
$ColourBrighterAnimation.Add_Completed({$UI.Window.Background.BeginAnimation([System.Windows.Media.SolidColorBrush]::ColorProperty,$ColourDarkerAnimation)})
391
$UI.Window.Background.BeginAnimation([System.Windows.Media.SolidColorBrush]::ColorProperty,$ColourBrighterAnimation)
392
})
393
394
#===================================================================================================
395
# Event: Window closing (for testing)
396
#===================================================================================================
397
$UI.Window.Add_Closing({
398
#===================================================================================================
399
# Restore the taskbar
400
#===================================================================================================
401
[Taskbar]::Show()
402
403
#===================================================================================================
404
# Restore the mouse cursor
405
#===================================================================================================
406
[System.Windows.Forms.Cursor]::Show()
407
408
#===================================================================================================
409
# Cancel keeping the display awake
410
#===================================================================================================
411
[DisplayState]::Cancel()
412
413
$DispatcherTimer.Stop()
414
$DispatcherTimerProgress.Stop()
415
$DispatcherTimerStep.Stop()
416
})
417
418
#===================================================================================================
419
# Display the window
420
#===================================================================================================
421
$DispatcherTimer.Start()
422
$DispatcherTimerProgress.Start()
423
$DispatcherTimerStep.Start()
424
$UI.Window.ShowDialog()
Copied!
A special thanks go to Trevor Jones and Gary Blok! If you have any questions regarding this topic, feel free to reach out to me. I am most active on Twitter!
Now go out and impress your boss and colleagues!
Last modified 2yr ago