This commit is contained in:
2025-11-08 16:36:40 +01:00
parent 065d915d46
commit 3e6b70bc4c
5 changed files with 26 additions and 14 deletions

View File

@@ -267,26 +267,38 @@ public partial class MainForm : Window
private async void MainForm_Loaded(object? sender, RoutedEventArgs e) private async void MainForm_Loaded(object? sender, RoutedEventArgs e)
{ {
#if !DISABLE_UPDATE #if !DISABLE_UPDATE
var myAppPath = EnvironmentEx.ProcessPath; #if !DEBUG
try
{
#endif
var myAppPath = EnvironmentEx.ProcessPath!;
var updater = new UpdateClient(Program.UpdateUrl, Assembly.GetEntryAssembly()!.GetAppVersion(), AppChannel.Stable) var updater = new UpdateClient(Program.UpdateUrl, Assembly.GetEntryAssembly()!.GetAppVersion(), AppChannel.Stable)
{ {
Distro = RuntimeInformationsEx.GetRuntimeIdentifier(), Distro = RuntimeInformationsEx.GetRuntimeIdentifier(),
}; };
if (await updater.CheckForUpdate() is {} packageToInstall if (await updater.CheckForUpdate() is {} packageToInstall
&& await MessageBoxManager.GetMessageBoxStandard(MsgBoxLangRes.UpdateAvailable_Title, MsgBoxLangRes.UpdateAvailable, ButtonEnum.YesNo).ShowWindowDialogAsync(this) == ButtonResult.Ok) && await MessageBoxManager.GetMessageBoxStandard(MsgBoxLangRes.UpdateAvailable_Title, MsgBoxLangRes.UpdateAvailable, ButtonEnum.YesNo, MsBox.Avalonia.Enums.Icon.Info).ShowWindowDialogAsync(this) == ButtonResult.Yes)
{ {
SetStatus(GeneralLangRes.DownloadProgramUpdate, Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer)); SetStatus(GeneralLangRes.DownloadProgramUpdate, Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer));
IsEnabled = false; IsEnabled = false;
if (await updater.DownloadPackageAsync(packageToInstall) if (await updater.DownloadPackageAsync(packageToInstall)
&& await updater.InstallPackageAsync(packageToInstall, myAppPath)) && await updater.InstallPackageAsync(packageToInstall, myAppPath))
{ {
Process.Start(myAppPath); IsVisible = false;
await Process.Start(myAppPath).WaitForExitAsync();
Environment.Exit(0); Environment.Exit(0);
return; return;
} }
IsEnabled = true; IsEnabled = true;
} }
#if !DEBUG
}
catch
{
IsEnabled = true;
}
#endif
#endif #endif
CheckStatusAndUpdate(true); CheckStatusAndUpdate(true);

View File

@@ -81,7 +81,7 @@
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets> <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Pilz.Updating" Version="4.3.4" /> <PackageReference Include="Pilz.Updating" Version="4.3.4" />
<PackageReference Include="Pilz.Updating.Client" Version="4.4.1" /> <PackageReference Include="Pilz.Updating.Client" Version="4.4.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -0,0 +1,9 @@
pupnet -y -v "$1[1]" -r linux-x64 -k appimage
pupnet -y -v "$1[1]" -r linux-x64 -k flatpak -p DefineConstants=DISABLE_UPDATE
#pupnet -y -v "$1[1]"-r linux-x64 -k deb -p DefineConstants=DISABLE_UPDATE
#pupnet -y -v "$1[1]"-r linux-x64 -k rpm -p DefineConstants=DISABLE_UPDATE
pupnet -y -v "$1[1]" -r linux-arm64 -k appimage
pupnet -y -v "$1[1]" -r linux-arm64 -k flatpak -p DefineConstants=DISABLE_UPDATE
#pupnet -y -v "$1[1]"-r linux-arm64 -k deb -p DefineConstants=DISABLE_UPDATE
#pupnet -y -v "$1[1]"-r linux-arm64 -k rpm -p DefineConstants=DISABLE_UPDATE
pupnet -y -v "$1[1]" -r win-x64 -k zip

View File

@@ -1,3 +1,3 @@
using Pilz; using Pilz;
[assembly: AssemblyAppVersion("1.10.0")] [assembly: AssemblyAppVersion(AssemblyAppVersionAttribute.EntryAssemblyVersionKey)]

View File

@@ -1,9 +0,0 @@
pupnet -y -r linux-x64 -k appimage
pupnet -y -r linux-x64 -k flatpak -p DefineConstants=DISABLE_UPDATE
#pupnet -y -r linux-x64 -k deb -p DefineConstants=DISABLE_UPDATE
#pupnet -y -r linux-x64 -k rpm -p DefineConstants=DISABLE_UPDATE
pupnet -y -r linux-arm64 -k appimage
pupnet -y -r linux-arm64 -k flatpak -p DefineConstants=DISABLE_UPDATE
#pupnet -y -r linux-arm64 -k deb -p DefineConstants=DISABLE_UPDATE
#pupnet -y -r linux-arm64 -k rpm -p DefineConstants=DISABLE_UPDATE
pupnet -y -r win-x64 -k zip