WPF (Windows presentation Foundation) technology allows you to create windows and dialog boxes. Its advantage is that it can be separated from the code when designing a form.
Here's a simple display pop-up message exercise. This message is defined in XAML code as its implementation is similar to HTML (but please be case-sensitive). You can easily adjust the font size, content, color, and so on. You do not need to embed any code.
Copy Code code as follows:
$xaml = @ "
<window
xmlns= ' http://schemas.microsoft.com/winfx/2006/xaml/presentation ' >
<border borderthickness= "borderbrush=" Yellow "cornerradius=" 9 "background= ' Red ' >
<StackPanel>
<label fontsize= "fontfamily= ' stencil ' background= ' Red ' foreground= ' white ' borderthickness= ' 0 ' >
System'll is rebooted in minutes!
</Label>
<label horizontalalignment= "Center" fontsize= "fontfamily= ' Consolas ' background= ' Red ' foreground= ' white ' borderthickness= ' 0 ' >
Worried about losing data? Talk to your friendly Help desk representative and freely share your
</Label>
</StackPanel>
</Border>
</Window>
"@
$reader = [System.xml.xmlreader]::create ([System.IO.StringReader] $xaml)
$window = [System.windows.markup.xamlreader]::load ($reader)
$Window. allowstransparency = $True
$window. sizetocontent = ' Widthandheight '
$window. ResizeMode = ' noresize '
$Window. Opacity =. 7
$window. topmost = $true
$window. windowstartuplocation = ' Centerscreen '
$window. WindowStyle = ' None '
# Show message for 5 seconds:
$null = $window. Show ()
Start-sleep-seconds 5
$window. Close ()