Improved updated handler & allow qb file selection when file locked.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user