Further improvements for update handling. IO-408
This commit is contained in:
@@ -148,7 +148,7 @@ namespace BodyshopPartner.ViewModels
|
||||
async p =>
|
||||
{
|
||||
await InstallUpdates();
|
||||
UpdateAvailable = false;
|
||||
|
||||
});
|
||||
}
|
||||
return _installUpdatesCommand;
|
||||
@@ -203,7 +203,7 @@ namespace BodyshopPartner.ViewModels
|
||||
p => true,
|
||||
p =>
|
||||
{
|
||||
ToggleStartWithWindows((bool)(p));
|
||||
Utils.UpdateHandler.ToggleStartWithWindows((bool)(p));
|
||||
});
|
||||
}
|
||||
return _startWithWindowsCommand;
|
||||
|
||||
@@ -97,12 +97,13 @@ namespace BodyshopPartner.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async Task InstallUpdates()
|
||||
{
|
||||
logger.Debug("Updates are available! Installing.");
|
||||
try
|
||||
{
|
||||
await Utils.UpdateHandler.ApplyUpdates(UpdateProgress, UpdateProgress);
|
||||
await Utils.UpdateHandler.ApplyUpdates((val) => UpdateProgress = val, (val) => UpdateProgress = val);
|
||||
|
||||
}
|
||||
catch (Exception Ex)
|
||||
@@ -198,22 +199,6 @@ namespace BodyshopPartner.ViewModels
|
||||
App.Current.Shutdown();
|
||||
}
|
||||
|
||||
public void ToggleStartWithWindows(bool shouldStart)
|
||||
{
|
||||
|
||||
RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
|
||||
if (shouldStart)
|
||||
{
|
||||
// Add the value in the registry so that the application runs at startup
|
||||
rkApp.SetValue(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, System.Reflection.Assembly.GetEntryAssembly().Location);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove the value from the registry so that the application doesn't start
|
||||
rkApp.DeleteValue(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task LoadBodyshopData()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user