private async void SyncBackups() { var dbManager = new DatabaseManager(new DroidSqliteConnectionFactory(), new MvxAndroidFileStore()); var accountRepository = new AccountRepository(new AccountDataAccess(dbManager)); var paymentRepository = new PaymentRepository(new PaymentDataAccess(dbManager)); var categoryRepository = new CategoryRepository(new CategoryDataAccess(dbManager)); var paymentManager = new PaymentManager(paymentRepository, new AccountRepository(new AccountDataAccess(dbManager)), new RecurringPaymentRepository(new RecurringPaymentDataAccess(dbManager)), null); var autoBackupManager = new AutoBackupManager( new BackupManager( new RepositoryManager(paymentManager, accountRepository, paymentRepository, categoryRepository), new OneDriveService(new MvxAndroidFileStore(), new OneDriveAuthenticator()), new MvxAndroidFileStore(), dbManager), new GlobalBusyIndicatorState(), new SettingsManager(new Settings())); await autoBackupManager.RestoreBackupIfNewer(); await autoBackupManager.UploadBackupIfNewer(); }
public async void Run(IBackgroundTaskInstance taskInstance) { var deferral = taskInstance.GetDeferral(); try { var dbManager = new DatabaseManager(new WindowsSqliteConnectionFactory(), new MvxWindowsCommonFileStore()); var accountRepository = new AccountRepository(new AccountDataAccess(dbManager)); var paymentRepository = new PaymentRepository(new PaymentDataAccess(dbManager)); var categoryRepository = new CategoryRepository(new CategoryDataAccess(dbManager)); var settingsManager = new SettingsManager(new WindowsCommonSettings()); var paymentManager = new PaymentManager(paymentRepository, new AccountRepository(new AccountDataAccess(dbManager)), new RecurringPaymentRepository(new RecurringPaymentDataAccess(dbManager)), null); var autoBackupManager = new AutoBackupManager( new BackupManager( new RepositoryManager(paymentManager, accountRepository, paymentRepository, categoryRepository), new OneDriveService(new MvxWindowsCommonFileStore(), new OneDriveAuthenticator()), new MvxWindowsCommonFileStore(), dbManager, settingsManager), new GlobalBusyIndicatorState(), settingsManager); await autoBackupManager.RestoreBackupIfNewer(); await autoBackupManager.UploadBackupIfNewer(); } finally { deferral.Complete(); } }