Updates to logging and v1.0.3 release.

This commit is contained in:
Patrick Fic
2020-12-03 10:41:57 -08:00
parent 12b095a406
commit 2acc8faa5b
9 changed files with 113 additions and 26 deletions

View File

@@ -135,6 +135,26 @@ namespace BodyshopPartner.ViewModels
}
}
private ICommand _installUpdatesCommand;
public ICommand InstallUpdatesCommand
{
get
{
if (_installUpdatesCommand == null)
{
_installUpdatesCommand = new RelayCommand(
p => UpdateAvailable,
async p =>
{
await InstallUpdates();
});
}
return _installUpdatesCommand;
}
}
private ICommand _quitCommand;
public ICommand QuitCommand
{

View File

@@ -91,13 +91,20 @@ namespace BodyshopPartner.ViewModels
private async Task updateCheck()
{
logger.Debug("Checking if updates are available.");
if (await Utils.UpdateHandler.AreUpdatesAvailable())
UpdateAvailable = await Utils.UpdateHandler.AreUpdatesAvailable();
if (UpdateAvailable)
{
logger.Debug("Updates are available! Installing.");
await Utils.UpdateHandler.ApplyUpdates(Progress, Progress);
string msg = "An update to ImEX Online Partner is Available";
Utils.Notifications.notifier.ShowInformation(msg);
}
}
private async Task InstallUpdates()
{
logger.Debug("Updates are available! Installing.");
await Utils.UpdateHandler.ApplyUpdates(UpdateProgress, UpdateProgress);
}
private async void _updateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
await updateCheck();

View File

@@ -63,5 +63,19 @@ namespace BodyshopPartner.ViewModels
get { return _appVersion; }
set { SetProperty(ref _appVersion, value); }
}
private bool _updateAvailable = false;
public bool UpdateAvailable
{
get { return _updateAvailable; }
set { SetProperty(ref _updateAvailable, value); }
}
private int _updateProgress;
public int UpdateProgress
{
get { return _updateProgress; }
set { SetProperty(ref _updateProgress, value); }
}
}
}