Files
tk-electron-ai/resources/waiting.ps1
2025-10-28 19:40:13 +08:00

29 lines
1.1 KiB
PowerShell

param([string]$LogPath = "$env:TEMP\waiting-log.txt")
function Write-Log($m){ try{"[$(Get-Date -Format o)] $m" | Out-File $LogPath -Append -Encoding UTF8}catch{} }
try{
[System.Threading.Thread]::CurrentThread.TrySetApartmentState('STA') | Out-Null
Add-Type -AssemblyName PresentationFramework | Out-Null
$xaml = @'
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Installing..." Width="420" Height="160"
WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Topmost="True">
<Grid Margin="16">
<StackPanel>
<TextBlock Text="Installing the new version, please wait..." Margin="0,0,0,12" FontSize="16" FontWeight="Bold"/>
<ProgressBar IsIndeterminate="True" Height="18"/>
<TextBlock Name="Status" Margin="0,10,0,0" Opacity="0.8" Text="Do not close your computer."/>
</StackPanel>
</Grid>
</Window>
'@
$win = [Windows.Markup.XamlReader]::Parse($xaml)
Write-Log "ShowDialog begin"
$null = $win.ShowDialog()
Write-Log "ShowDialog end"
}catch{
Write-Log "FATAL: $($_.Exception.Message)`n$($_.Exception.StackTrace)"
}