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

@@ -90,26 +90,28 @@ namespace BodyshopPartner.ViewModels
private async Task updateCheck()
{
#if (!DEBUG)
//#if (!DEBUG)
logger.Debug("Checking if updates are available.");
UpdateAvailable = await Utils.UpdateHandler.AreUpdatesAvailable();
if (UpdateAvailable)
{
string msg = "An update to ImEX Online Partner is Available. It will be automatically downloaded and applied.";
Utils.Notifications.notifier.ShowInformation(msg);
logger.Debug("Updates are available! Installing.");
try
{
await Utils.UpdateHandler.ApplyUpdates((val) => UpdateProgress = val, (val) => UpdateProgress = val);
await Utils.UpdateHandler.UpdateAppEasy((val) => UpdateProgress = val);
}
catch (Exception Ex)
{
logger.Error("Error while updating." + Ex.ToString());
//UpdateAvailable = await Utils.UpdateHandler.AreUpdatesAvailable();
//if (UpdateAvailable)
//{
// string msg = "An update to ImEX Online Partner is Available. It will be automatically downloaded and applied.";
// Utils.Notifications.notifier.ShowInformation(msg);
// logger.Debug("Updates are available! Installing.");
// try
// {
// await Utils.UpdateHandler.ApplyUpdates((val) => UpdateProgress = val, (val) => UpdateProgress = val);
}
}
#endif
// }
// catch (Exception Ex)
// {
// logger.Error("Error while updating." + Ex.ToString());
// }
//}
//#endif
}
@@ -201,6 +203,7 @@ namespace BodyshopPartner.ViewModels
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.ValidateNames = false;
openFileDialog.Multiselect = false;
openFileDialog.Filter = "QuickBooks files (*.qbw)|*.qbw|All files (*.*)|*.*";
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);