fixes
This commit is contained in:
@@ -267,26 +267,38 @@ public partial class MainForm : Window
|
||||
private async void MainForm_Loaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
#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)
|
||||
{
|
||||
Distro = RuntimeInformationsEx.GetRuntimeIdentifier(),
|
||||
};
|
||||
|
||||
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));
|
||||
IsEnabled = false;
|
||||
if (await updater.DownloadPackageAsync(packageToInstall)
|
||||
&& await updater.InstallPackageAsync(packageToInstall, myAppPath))
|
||||
{
|
||||
Process.Start(myAppPath);
|
||||
IsVisible = false;
|
||||
await Process.Start(myAppPath).WaitForExitAsync();
|
||||
Environment.Exit(0);
|
||||
return;
|
||||
}
|
||||
IsEnabled = true;
|
||||
}
|
||||
#if !DEBUG
|
||||
}
|
||||
catch
|
||||
{
|
||||
IsEnabled = true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CheckStatusAndUpdate(true);
|
||||
|
||||
Reference in New Issue
Block a user