public static async Task UpdateTilesAsync(AccountDataItem account, AccountDataStore data, IEnumerable <SecondaryTile> tilesForAccount)
        {
            foreach (var tile in tilesForAccount)
            {
                var args = ArgumentsHelper.Parse(tile.Arguments) as ViewClassArguments;

                if (args != null)
                {
                    await UpdateTileAsync(tile, account, data, args.ItemId);
                }
            }
        }
Exemple #2
0
        private async void UpdateRealTile()
        {
            try
            {
                await ClassTileHelper.UpdateTileAsync(ViewModel.Account, await AccountDataStore.Get(ViewModel.Account.LocalAccountId), ViewModel.Class.Identifier);
            }

            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// Thread safe, but will lock the thread
        /// </summary>
        /// <param name="localAccountId"></param>
        /// <returns></returns>
        public static async Task Delete(Guid localAccountId)
        {
            await Task.Run(async delegate
            {
                using (await Locks.LockAccounts())
                {
                    using (await Locks.LockDataForWriteAsync("AccountsManager.Delete"))
                    {
                        IFolder accountFolder = await FileHelper.GetAccountFolder(localAccountId);

                        if (accountFolder != null)
                        {
                            AccountDataStore.Dispose(localAccountId);

                            try
                            {
                                await accountFolder.DeleteAsync();
                            }

                            catch { }
                        }
                    }

                    _cachedAccounts.Remove(localAccountId);
                }
            });

            OnAccountDeleted?.Invoke(null, localAccountId);

            // Clear reminders
            try
            {
                RemindersExtension.Current?.ClearReminders(localAccountId);
            }
            catch { }

            // Clear calendar integration
            try
            {
                if (AppointmentsExtension.Current != null)
                {
                    await AppointmentsExtension.Current.DeleteAsync(localAccountId);
                }
            }
            catch { }

            // Unpin tiles
            try
            {
                TilesExtension.Current?.UnpinAllTilesForAccount(localAccountId);
            }
            catch { }
        }
        public async Task When_DeleteByIdAsync()
        {
            // Arrange

            var cosmosDatabase =
                _cosmosClient.GetDatabase(
                    _configuration["AzureCosmosDocumentStoreOptions:DatabaseId"]);

            var cosmosContainer =
                cosmosDatabase.GetContainer("accounts");

            var accountData =
                new AccountData(
                    _faker.Random.Number(10000, 99999).ToString());

            accountData.SystemOfRecord =
                _faker.PickRandom(
                    AccountData.SYSTEMOFRECORD_AUTOSUITE,
                    AccountData.SYSTEMOFRECORD_FISERVE,
                    AccountData.SYSTEMOFRECORD_ISERIES,
                    AccountData.SYSTEMOFRECORD_LEASEMASTER);
            accountData.PhoneNumber =
                _faker.Person.Phone;

            await cosmosContainer.CreateItemAsync(
                accountData,
                new PartitionKey(accountData.AccountNumber));

            var accountDataStoreOptions =
                new AccountDataStoreOptions(
                    _configuration["AzureCosmosDocumentStoreOptions:DatabaseId"],
                    _cosmosClient);

            var accountDataStore =
                new AccountDataStore(
                    accountDataStoreOptions);

            // Act

            await accountDataStore.DeleteByIdAsync(
                accountData.Id,
                accountData.AccountNumber);

            // Assert

            Func <Task> action = async() =>
                                 await cosmosContainer.ReadItemAsync <AccountData>(
                accountData.Id.ToString(),
                new PartitionKey(accountData.AccountNumber));

            action.Should().Throw <CosmosException>().WithMessage("*Resource Not Found*");;
        }
Exemple #5
0
 public Account Create(string debtorAccountNumber)
 {
     if (_dataStoreType == "Backup")
     {
         var accountDataStore = new BackupAccountDataStore();
         return(accountDataStore.GetAccount(debtorAccountNumber));
     }
     else
     {
         var accountDataStore = new AccountDataStore();
         return(accountDataStore.GetAccount(debtorAccountNumber));
     }
 }
        public async Task When_FetchByIdAsync()
        {
            // Arrange

            var cosmosDatabase =
                _cosmosClient.GetDatabase(
                    _configuration["AzureCosmosDocumentStoreOptions:DatabaseId"]);

            var cosmosContainer =
                cosmosDatabase.GetContainer("accounts");

            var accountData =
                new AccountData(
                    _faker.Random.Number(10000, 99999).ToString());

            accountData.SystemOfRecord =
                _faker.PickRandom(
                    AccountData.SYSTEMOFRECORD_AUTOSUITE,
                    AccountData.SYSTEMOFRECORD_FISERVE,
                    AccountData.SYSTEMOFRECORD_ISERIES,
                    AccountData.SYSTEMOFRECORD_LEASEMASTER);
            accountData.PhoneNumber =
                _faker.Person.Phone;

            await cosmosContainer.CreateItemAsync(
                accountData,
                new PartitionKey(accountData.AccountNumber));

            var accountDataStoreOptions =
                new AccountDataStoreOptions(
                    _configuration["AzureCosmosDocumentStoreOptions:DatabaseId"],
                    _cosmosClient);

            var accountDataStore =
                new AccountDataStore(
                    accountDataStoreOptions);

            // Act

            var accountDataFetched =
                await accountDataStore.FetchByIdAsync(
                    accountData.Id);

            // Assert

            accountDataFetched.Should().NotBeNull();
            accountDataFetched.AccountNumber.Should().Be(accountData.AccountNumber);
            accountDataFetched.Id.Should().Be(accountData.Id);
            accountDataFetched.PhoneNumber.Should().Be(accountData.PhoneNumber);
            accountDataFetched.SystemOfRecord.Should().Be(accountData.SystemOfRecord);
        }
 private static Task <ClassData> LoadDataAsync(AccountDataStore data, Guid classId, DateTime todayAsUtc, ClassTileSettings settings)
 {
     try
     {
         return(Task.Run(delegate
         {
             return LoadDataBlocking(data, classId, todayAsUtc, settings);
         }));
     }
     catch (SemesterNotFoundException)
     {
         return(Task.FromResult <ClassData>(null));
     }
 }
Exemple #8
0
        public IDataStore Create(string dataStoreType)
        {
            IDataStore datastore = null;

            if (dataStoreType == "Backup")
            {
                datastore = new BackupAccountDataStore();
            }
            else
            {
                datastore = new AccountDataStore();
            }
            return(datastore);
        }
        public HttpResponseMessage DeleteAccount(string accountNo)
        {
            bool retVal = false;
            HttpResponseMessage response         = new HttpResponseMessage(HttpStatusCode.BadRequest);
            IAccountDataStore   accountDataStore = new AccountDataStore();

            retVal = accountDataStore.DeleteAccount(accountNo);
            if (retVal == true)
            {
                response = Request.CreateResponse(HttpStatusCode.OK);
            }

            return(response);
        }
        public HttpResponseMessage UpdateAccount([FromBody] Account value)
        {
            bool retVal = false;
            HttpResponseMessage response         = new HttpResponseMessage(HttpStatusCode.BadRequest);
            IAccountDataStore   accountDataStore = new AccountDataStore();

            retVal = accountDataStore.UpdateAccount(value);
            if (retVal == true)
            {
                response = Request.CreateResponse(HttpStatusCode.OK);
            }

            return(response);
        }
        public HttpResponseMessage GetAccount(string accountNo)
        {
            Account             account          = null;
            HttpResponseMessage response         = Request.CreateResponse(HttpStatusCode.NotFound, account);
            IAccountDataStore   accountDataStore = new AccountDataStore();

            account = accountDataStore.GetAccount(accountNo);
            if (account != null)
            {
                response = Request.CreateResponse(HttpStatusCode.OK, account);
            }

            return(response);
        }
        public async Task HandleBeingReturnedTo()
        {
            // Update the time left at just like when we're left, since on iOS in certain cases
            // returned to gets called when being left didn't get called, so it permanently thinks
            // we left the app a long time ago otherwise
            var timeLeftAt = _timeLeftAt;

            _timeLeftAt = DateTime.Now;

            // If the day has changed (went from yesterday to today), reset the entire view model
            if (timeLeftAt.Date != DateTime.Now.Date || AccountDataStore.RetrieveAndResetWasUpdatedByBackgroundTask())
            {
                await HandleNormalLaunchActivation();

                return;
            }

            // If it's been gone for more than a minute, do a sync
            if (DateTime.Now.AddMinutes(-1) > timeLeftAt)
            {
                try
                {
                    if (CurrentAccount != null)
                    {
                        try
                        {
                            var dontWait = SyncLayer.Sync.SyncAccountAsync(CurrentAccount);
                        }
                        catch { }
                    }
                }

                catch { }
            }

            try
            {
                if (RemindersExtension.Current != null && CurrentAccount != null)
                {
                    var dontWait = RemindersExtension.Current.ClearCurrentReminders(CurrentAccount.LocalAccountId);
                }
            }

            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }

            TelemetryExtension.Current?.ReturnedToApp();
        }
Exemple #13
0
        public IDataStore CreateDataStore(string storeType)
        {
            IDataStore accountDataStore = null;

            if (storeType == "Backup")
            {
                accountDataStore = new BackupAccountDataStore();
            }
            else
            {
                accountDataStore = new AccountDataStore();
            }

            return(accountDataStore);
        }
        private static async Task <ClassData> LoadDataBlocking(AccountDataStore data, Guid classId, DateTime todayAsUtc, ClassTileSettings settings)
        {
            DateTime dateToStartDisplayingFrom = DateTime.SpecifyKind(settings.GetDateToStartDisplayingOn(todayAsUtc), DateTimeKind.Local);

            Guid semesterId = Guid.Empty;

            // We lock the outside, since we are allowing trackChanges on the view items groups (so we have a chance of loading a cached one)... and since we're on a background thread, the lists inside the
            // view items groups could change while we're enumerating, hence throwing an exception. So we lock it to ensure this won't happen, and then we return a copy of the items that we need.
            using (await Locks.LockDataForReadAsync())
            {
                // First we need to obtain the semester id
                var c = data.TableClasses.FirstOrDefault(i => i.Identifier == classId);

                if (c == null)
                {
                    return(null);
                }

                semesterId = c.UpperIdentifier;
            }

            // We need all classes loaded, to know what time the end of day is
            var scheduleViewItemsGroup = await ScheduleViewItemsGroup.LoadAsync(data.LocalAccountId, semesterId, trackChanges : true, includeWeightCategories : false);

            var classViewItemsGroup = await ClassViewItemsGroup.LoadAsync(
                localAccountId : data.LocalAccountId,
                classId : classId,
                today : DateTime.SpecifyKind(todayAsUtc, DateTimeKind.Local),
                viewItemSemester : scheduleViewItemsGroup.Semester,
                includeWeights : false);

            classViewItemsGroup.LoadTasksAndEvents();
            await classViewItemsGroup.LoadTasksAndEventsTask;

            List <ViewItemTaskOrEvent> copied;

            using (await classViewItemsGroup.DataChangeLock.LockForReadAsync())
            {
                // Class view group sorts the items, so no need to sort
                copied = classViewItemsGroup.Class.TasksAndEvents.Where(i => i.Date.Date >= dateToStartDisplayingFrom).ToList();
            }

            return(new ClassData()
            {
                Class = classViewItemsGroup.Class,
                AllUpcoming = copied
            });
        }
            public override async Task <bool> ShouldShowAsync(AccountDataItem account)
            {
                // Don't show for offline accounts or for devices that aren't Desktop
                if (account == null || !account.IsOnlineAccount || InterfacesUWP.DeviceInfo.DeviceFamily != InterfacesUWP.DeviceFamily.Desktop)
                {
                    return(false);
                }

                if (ApplicationData.Current.RoamingSettings.Values.ContainsKey(SETTING_HAS_PROMOTED_ANDROID_AND_IOS))
                {
                    return(false);
                }

                var dataStore = await AccountDataStore.Get(account.LocalAccountId);

                // If they actually have some classes
                bool hasContent;

                using (await Locks.LockDataForReadAsync())
                {
                    hasContent = dataStore.TableClasses.Count() > 1;
                }

                if (hasContent)
                {
                    // Try downloading and then show
                    ShouldSuggestOtherPlatformsResponse response = await account.PostAuthenticatedAsync <ShouldSuggestOtherPlatformsRequest, ShouldSuggestOtherPlatformsResponse>(
                        Website.URL + "shouldsuggestotherplatforms",
                        new ShouldSuggestOtherPlatformsRequest()
                    {
                        CurrentPlatform = "Windows 10"
                    });

                    if (response.ShouldSuggest)
                    {
                        return(true);
                    }

                    // No need to suggest in the future nor show now
                    MarkShown(account);
                    return(false);
                }
                else
                {
                    // Not enough content to show right now
                    return(false);
                }
            }
        public async Task When_AddAsync()
        {
            // Arrange

            var accountData =
                new AccountData(
                    _faker.Random.Number(10000, 99999).ToString());

            accountData.SystemOfRecord =
                _faker.PickRandom(
                    AccountData.SYSTEMOFRECORD_AUTOSUITE,
                    AccountData.SYSTEMOFRECORD_FISERVE,
                    AccountData.SYSTEMOFRECORD_ISERIES,
                    AccountData.SYSTEMOFRECORD_LEASEMASTER);
            accountData.PhoneNumber =
                _faker.Person.Phone;

            var accountDataStoreOptions =
                new AccountDataStoreOptions(
                    _configuration["AzureCosmosDocumentStoreOptions:DatabaseId"],
                    _cosmosClient);

            var accountDataStore =
                new AccountDataStore(
                    accountDataStoreOptions);

            // Act

            await accountDataStore.AddAsync(
                accountData);

            // Assert

            var cosmosDatabase =
                _cosmosClient.GetDatabase(
                    accountDataStoreOptions.DatabaseId);

            var cosmosContainer =
                cosmosDatabase.GetContainer(
                    "accounts");

            var accountDataResponse =
                await cosmosContainer.ReadItemAsync <AccountData>(
                    accountData.Id.ToString(),
                    new PartitionKey(accountData.AccountNumber));

            accountDataResponse.StatusCode.Should().Be(HttpStatusCode.OK);
        }
        public HttpResponseMessage GetAccounts(int rowCount, string sort)
        {
            IEnumerable <Account> accounts = null;
            HttpResponseMessage   response = Request.CreateResponse(HttpStatusCode.NotFound, accounts);

            IAccountDataStore accountDataStore = new AccountDataStore();

            accounts = accountDataStore.GetAccounts(rowCount, sort);

            if (accounts != null)
            {
                response = Request.CreateResponse(HttpStatusCode.OK, accounts);
            }

            return(response);
        }
Exemple #18
0
        public async void Handle(BackgroundActivatedEventArgs args)
        {
            var taskInstance = args.TaskInstance;

            taskInstance.Canceled += TaskInstance_Canceled;

            var deferral = taskInstance.GetDeferral();

            try
            {
                var accounts = await AccountsManager.GetAllAccounts();

                var cancellationToken = _cancellationTokenSource.Token;

                try
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    foreach (var a in accounts)
                    {
                        var data = await AccountDataStore.Get(a.LocalAccountId);

                        cancellationToken.ThrowIfCancellationRequested();

                        await ClassRemindersExtension.Current?.ResetAllRemindersAsync(a);

                        await RemindersExtension.Current?.ResetReminders(a, data);

                        await TileHelper.UpdateTileNotificationsForAccountAsync(a, data);

                        cancellationToken.ThrowIfCancellationRequested();
                    }
                }

                catch (OperationCanceledException) { }
            }

            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }

            finally
            {
                deferral.Complete();
            }
        }
 public async Task ResetReminders(AccountDataItem account, AccountDataStore data)
 {
     try
     {
         await _workQueue.QueueOrMergeAsync(
             channelIdentifier : account.LocalAccountId,
             mergeIdentifier : WorkTypes.ResetReminders,
             workerFunction : delegate
         {
             return(ActuallyResetReminders(account, data));
         });
     }
     catch (Exception ex)
     {
         TelemetryExtension.Current?.TrackException(ex);
     }
 }
        public async System.Threading.Tasks.Task SaveChanges(AccountDataItem account, DataChanges changes)
        {
            if (account == null)
            {
                throw new NullReferenceException("account was null. Windows: " + Windows.Count);
            }

            var dataStore = await AccountDataStore.Get(account.LocalAccountId);

            await dataStore.ProcessLocalChanges(changes);

            // Don't await this, we don't want it blocking
            if (account.IsOnlineAccount)
            {
                SyncWithoutBlocking(account);
            }
        }
        /// <summary>
        /// Updates the class tile, if it exists.
        /// </summary>
        /// <param name="account"></param>
        /// <param name="data"></param>
        /// <param name="classId"></param>
        /// <returns></returns>
        public static async Task UpdateTileAsync(AccountDataItem account, AccountDataStore data, Guid classId)
        {
            try
            {
                SecondaryTile tile = (await SecondaryTile.FindAllAsync()).FirstOrDefault(i => i.TileId.Equals(GenerateTileId(account.LocalAccountId, classId)));

                if (tile == null)
                    return;

                await UpdateTileAsync(tile, account, data, classId);
            }

            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }
        }
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            SharedInitialization.Initialize();
            InitializeUWP.Initialize();

            taskInstance.Canceled += TaskInstance_Canceled;

            var deferral = taskInstance.GetDeferral();

            try
            {
                var accounts = await AccountsManager.GetAllAccounts();

                var cancellationToken = _cancellationTokenSource.Token;

                try
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    foreach (var a in accounts)
                    {
                        var data = await AccountDataStore.Get(a.LocalAccountId);

                        cancellationToken.ThrowIfCancellationRequested();

                        await TileHelper.UpdateTileNotificationsForAccountAsync(a, data);

                        cancellationToken.ThrowIfCancellationRequested();
                    }
                }

                catch (OperationCanceledException) { }
            }

            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }

            // TODO: Re-schedule toast notifications?

            finally
            {
                deferral.Complete();
            }
        }
        public virtual Account Get(MakePaymentRequest request)
        {
            var     dataStoreType = Config.DataStoreType;
            Account account       = null;

            if (dataStoreType == "Backup")
            {
                var accountDataStore = new BackupAccountDataStore();
                account = accountDataStore.GetAccount(request.DebtorAccountNumber);
            }
            else
            {
                var accountDataStore = new AccountDataStore();
                account = accountDataStore.GetAccount(request.DebtorAccountNumber);
            }
            return(account);
        }
        public void ProcessPayment(MakePaymentRequest request, string dataStoreType, Account account, MakePaymentResult result)
        {
            if (result.Success)
            {
                account.Balance -= request.Amount;

                if (dataStoreType == "Backup")
                {
                    var accountDataStore = new BackupAccountDataStore();
                    accountDataStore.UpdateAccount(account);
                }
                else
                {
                    var accountDataStore = new AccountDataStore();
                    accountDataStore.UpdateAccount(account);
                }
            }
        }
        /// <summary>
        /// Saves changes, then triggers updates to reminders/tiles, and triggers a settings sync
        /// </summary>
        /// <param name="schoolTimeZone"></param>
        /// <returns></returns>
        public async System.Threading.Tasks.Task SetSchoolTimeZone(TimeZoneInfo schoolTimeZone)
        {
            SchoolTimeZone      = schoolTimeZone;
            NeedsToSyncSettings = true;

            // Save
            await SaveOnThread();

            AccountDataStore data = await AccountDataStore.Get(this.LocalAccountId);

            var dontWait = RemindersExtension.Current?.ResetReminders(this, data);

            var dontWaitThread = System.Threading.Tasks.Task.Run(delegate
            {
                // Update schedule tile
                var dontWaitScheduleTile = ScheduleTileExtension.Current?.UpdateScheduleTile(this, data);
            });

            dontWait = Sync.SyncSettings(this, Sync.ChangedSetting.SchoolTimeZone);
        }
Exemple #26
0
        public async System.Threading.Tasks.Task SaveChanges(AccountDataItem account, DataChanges changes, bool waitForSaveAndSyncTasks = false)
        {
            if (account == null)
            {
                throw new NullReferenceException("account was null. Windows: " + Windows.Count);
            }

            var dataStore = await AccountDataStore.Get(account.LocalAccountId);

            var saveChangeTasks = await dataStore.ProcessLocalChanges(changes);

            System.Threading.Tasks.Task <SyncResult> syncTask = null;

            // Don't await this, we don't want it blocking
            if (account.IsOnlineAccount)
            {
                if (waitForSaveAndSyncTasks)
                {
                    syncTask = Sync.SyncAccountAsync(account);
                }
                else
                {
                    SyncWithoutBlocking(account);
                }
            }

            if (waitForSaveAndSyncTasks)
            {
                // Need to wait for the tile/toast tasks to finish
                await saveChangeTasks.WaitForAllTasksAsync();

                if (syncTask != null)
                {
                    var syncResult = await syncTask;
                    if (syncResult != null && syncResult.SaveChangesTask != null)
                    {
                        await syncResult.SaveChangesTask.WaitForAllTasksAsync();
                    }
                }
            }
        }
            public override async Task <bool> ShouldShowAsync(AccountDataItem account)
            {
                if (account == null)
                {
                    return(false);
                }

                // If we've already shown
                if (Helpers.Settings.HasShownPromoContribute)
                {
                    return(false);
                }

                var dataStore = await AccountDataStore.Get(account.LocalAccountId);

                // If they actually have lots of tasks
                using (await Locks.LockDataForReadAsync())
                {
                    return(dataStore.ActualTableMegaItems.Count() > 60);
                }
            }
Exemple #28
0
        /// <summary>
        /// Automatically updates display, resets reminders, starts settings sync, and submits changes
        /// </summary>
        /// <param name="startsOn"></param>
        /// <param name="currentWeek"></param>
        public async System.Threading.Tasks.Task SetWeek(DayOfWeek startsOn, Schedule.Week currentWeek)
        {
            // Clear cached schedules on day since they don't subscribe to these changes.
            // Ideally I would have the lists subscribe to the account, but this will do for now.
            ViewLists.SchedulesOnDay.ClearCached();
            ViewLists.DayScheduleItemsArranger.ClearCached();

            DateTime today = DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc);

            if (currentWeek == Schedule.Week.WeekTwo)
            {
                today = today.AddDays(-7);
            }

            DateTime answer = DateTools.Last(startsOn, today);

            if (answer != WeekOneStartsOn)
            {
                WeekOneStartsOn     = answer;
                NeedsToSyncSettings = true;

                // Save
                await SaveOnThread();

                //make upcoming update
                OnPropertyChanged("ShowSchedule");

                AccountDataStore data = await AccountDataStore.Get(this.LocalAccountId);

                var dontWait = RemindersExtension.Current?.ResetReminders(this, data);

                var dontWaitThread = System.Threading.Tasks.Task.Run(delegate
                {
                    // Update schedule tile
                    var dontWaitScheduleTile = ScheduleTileExtension.Current?.UpdateScheduleTile(this, data);
                });

                dontWait = Sync.SyncSettings(this, Sync.ChangedSetting.WeekOneStartsOn);
            }
        }
        private async void TryAskingForRatingIfNeeded()
        {
            try
            {
                // If we haven't asked for rating yet
                if (!PowerPlannerAppDataLibrary.Helpers.Settings.HasAskedForRating)
                {
                    if (ViewModel.CurrentAccount != null)
                    {
                        var dataStore = await AccountDataStore.Get(ViewModel.CurrentLocalAccountId);

                        // If they actually have a decent amount of homework
                        if (await System.Threading.Tasks.Task.Run(async delegate
                        {
                            using (await Locks.LockDataForReadAsync())
                            {
                                return(dataStore.TableMegaItems.Count() > 30 && dataStore.TableMegaItems.Any(i => i.DateCreated < DateTime.Today.AddDays(-60)));
                            }
                        }))
                        {
                            var builder = new Android.App.AlertDialog.Builder(Context);

                            builder
                            .SetTitle("★ Review App ★")
                            .SetMessage("Thanks for using Power Planner! If you love the app, please leave a rating in the Store! If you have any suggestions or issues, please email me!")
                            .SetNeutralButton("Review", delegate { OpenReview(); })     // Neutral is displayed more prominently
                            .SetPositiveButton("Email Dev", delegate { AboutView.EmailDeveloper(Context, base.ViewModel); })
                            .SetNegativeButton("Close", delegate { });

                            builder.Create().Show();

                            PowerPlannerAppDataLibrary.Helpers.Settings.HasAskedForRating = true;
                        }
                    }
                }
            }

            catch { }
        }
        public virtual IAccountDataStore GetAccountDataStore()
        {
            IAccountDataStore accountDataStore = null;

            var dataStoreType = _appConfig.GetValueByKey("DataStoreType");

            switch (dataStoreType)
            {
            case "Backup":
            {
                accountDataStore = new BackupAccountDataStore();
                break;
            }

            default:
            {
                accountDataStore = new AccountDataStore();
                break;
            }
            }

            return(accountDataStore);
        }