/// <summary> /// Restores an existing backup from the backupservice. /// If it was an old backup, it will delete the existing db an make an migration. /// After the restore it will perform a reload of the data so that the cache works with the new data. /// </summary> public async Task RestoreBackup() { var backupNames = GetBackupName(await backupService.GetFileNames()); await backupService.Restore(backupNames.Item1, backupNames.Item2); if (oldBackupRestored && fileStore.Exists(DatabaseConstants.DB_NAME)) { fileStore.DeleteFile(DatabaseConstants.DB_NAME); } databaseManager.CreateDatabase(); databaseManager.MigrateDatabase(); repositoryManager.ReloadData(); SettingsHelper.LastDatabaseUpdate = DateTime.Now; }
private async void RestoreBackup() { await Login(); if (!await ShowOverwriteDataInfo()) { return; } IsLoading = true; await BackupService.Restore(); repositoryManager.ReloadData(); await ShowCompletionNote(); IsLoading = false; }
/// <summary> /// Restores the backup from OneDrive when the backup is newer then the last modification. /// </summary> public async Task RestoreBackupIfNewer() { try { if (!roamingSettings.IsBackupAutouploadEnabled) { return; } var backupDate = await backupService.GetBackupDate(); if (backupDate > Settings.LastDatabaseUpdate) { await backupService.Restore(); repositoryManager.ReloadData(); Settings.LastDatabaseUpdate = backupDate; } } catch (OneDriveException ex) { Insights.Report(ex); } }
/// <summary> /// Restores the backup from OneDrive when the backup is newer then the last modification. /// </summary> public async Task RestoreBackupIfNewer() { try { if (!Settings.IsBackupAutouploadEnabled) { return; } var backupDate = await backupService.GetBackupDate(); if (backupDate > Settings.LastDatabaseUpdate) { await backupService.Restore(); repositoryManager.ReloadData(); Settings.LastDatabaseUpdate = backupDate; } } catch (OneDriveException ex) { new TelemetryClient().TrackException(ex); } }