pull/508/head
romanitho 2023-12-06 01:05:18 +01:00
parent 9f165a8b3d
commit 4890e51a69
1 changed files with 7 additions and 4 deletions

11
Gui.ps1
View File

@ -300,7 +300,7 @@ function Get-WAUConfiguratorLatestVersion {
mc:Ignorable="d" mc:Ignorable="d"
Title="WAU Configurator {0} - Update available" ResizeMode="NoResize" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen" Topmost="True"> Title="WAU Configurator {0} - Update available" ResizeMode="NoResize" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen" Topmost="True">
<Grid> <Grid>
<TextBlock x:Name="TextBlock" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Center" Margin="26,26,26,60" MaxWidth="480" Text="A New WAUConfigurator version is available. Version $WAUConfiguratorLatestVersion"/> <TextBlock x:Name="TextBlock" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Center" Margin="26,26,26,60" MaxWidth="480" Text="A New WAU Configurator version is available. Version $WAUConfiguratorLatestVersion"/>
<StackPanel Height="32" Orientation="Horizontal" UseLayoutRounding="False" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="6"> <StackPanel Height="32" Orientation="Horizontal" UseLayoutRounding="False" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="6">
<Button x:Name="GithubButton" Content="See on GitHub" Margin="4" Width="100"/> <Button x:Name="GithubButton" Content="See on GitHub" Margin="4" Width="100"/>
<Button x:Name="DownloadButton" Content="Download" Margin="4" Width="100"/> <Button x:Name="DownloadButton" Content="Download" Margin="4" Width="100"/>
@ -336,17 +336,20 @@ function Get-WAUConfiguratorLatestVersion {
$DownloadButton.add_click( $DownloadButton.add_click(
{ {
$WAUConfiguratorSaveFile = New-Object System.Windows.Forms.SaveFileDialog $WAUConfiguratorSaveFile = New-Object System.Windows.Forms.SaveFileDialog
$WAUConfiguratorSaveFile.Filter = "Exe file (*.exe)|*.exe" $WAUConfiguratorSaveFile.Filter = "Zip file (*.zip)|*.zip"
$WAUConfiguratorSaveFile.FileName = "WAUConfigurator_$WAUConfiguratorLatestVersion.exe" $WAUConfiguratorSaveFile.FileName = "WAU_$WAUConfiguratorLatestVersion.zip"
$response = $WAUConfiguratorSaveFile.ShowDialog() # $response can return OK or Cancel $response = $WAUConfiguratorSaveFile.ShowDialog() # $response can return OK or Cancel
if ( $response -eq 'OK' ) { if ( $response -eq 'OK' ) {
Start-PopUp "Downloading WAUConfigurator $WAUConfiguratorLatestVersion..." Start-PopUp "Downloading WAU Configurator $WAUConfiguratorLatestVersion..."
$WAUConfiguratorDlLink = "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$WAUConfiguratorLatestVersion/WAU.zip" $WAUConfiguratorDlLink = "https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v$WAUConfiguratorLatestVersion/WAU.zip"
Invoke-WebRequest -Uri $WAUConfiguratorDlLink -OutFile $WAUConfiguratorSaveFile.FileName -UseBasicParsing Invoke-WebRequest -Uri $WAUConfiguratorDlLink -OutFile $WAUConfiguratorSaveFile.FileName -UseBasicParsing
$UpdateWindow.DialogResult = [System.Windows.Forms.DialogResult]::OK $UpdateWindow.DialogResult = [System.Windows.Forms.DialogResult]::OK
$UpdateWindow.Close() $UpdateWindow.Close()
Start-Sleep 3 Start-Sleep 3
#Open folder
Start-Process (Split-Path -parent $WAUConfiguratorSaveFile.FileName)
Close-PopUp Close-PopUp
Exit 0 Exit 0
} }