SoFunction
Updated on 2025-03-10

Powershell uses WPF technology to implement pop-up prompt example


$xaml = @"
<Window
 xmlns='/winfx/2006/xaml/presentation'>

 <Border BorderThickness="20" BorderBrush="Yellow" CornerRadius="9" Background='Red'>
  <StackPanel>
   <Label FontSize="50" FontFamily='Stencil' Background='Red' Foreground='White' BorderThickness='0'>
    System will be rebooted in 15 minutes!
   </Label>

   <Label HorizontalAlignment="Center" FontSize="15" FontFamily='Consolas' Background='Red' Foreground='White' BorderThickness='0'>
    Worried about losing data? Talk to your friendly help desk representative and freely share your concerns!
   </Label>
  </StackPanel>
 </Border>
</Window>
"@

$reader = []::Create([] $xaml)
$window = []::Load($reader)
$ = $True
$ = 'WidthAndHeight'
$ = 'NoResize'
$ = .7
$ = $true
$ = 'CenterScreen'
$ = 'None'
# show message for 5 seconds:
$null = $()
Start-Sleep -Seconds 5
$()