Improved updated handler & allow qb file selection when file locked.

This commit is contained in:
Patrick Fic
2021-05-26 09:34:14 -07:00
parent ac5dda5528
commit f9d8b18481
3 changed files with 62 additions and 18 deletions

View File

@@ -67,6 +67,47 @@ namespace BodyshopPartner.Utils
public delegate void DownloadProgress(int value);
public delegate void InstallProgress(int value);
public static async Task UpdateAppEasy(InstallProgress InstallProgress)
{
try
{
BackupSettings();
}
catch (Exception ex)
{
logger.Warn(ex, "Unable to backup settings.");
}
try
{
using (var updateManager = new UpdateManager(UpdatePath))
{
await updateManager.UpdateApp(_ =>
{
logger.Debug("Install Progress " + _.ToString());
InstallProgress(_);
});
await UpdateManager.RestartAppWhenExited();
logger.Debug("Ready to restart app with updated version.");
App.Current.Dispatcher.Invoke(() =>
{
App.Current.Shutdown();
});
}
}
catch (Exception Ex)
{
logger.Error(Ex);
}
}
public static async Task ApplyUpdates(DownloadProgress DownloadProgress, InstallProgress InstallProgress)
{
try