Ejemplo n.º 1
0
        /// <summary>
        /// Saves locally and then uploads premium status to account without waiting
        /// </summary>
        /// <returns></returns>
        public async System.Threading.Tasks.Task SetAsLifetimePremiumAsync()
        {
            PremiumAccountExpiresOn = PowerPlannerSending.DateValues.LIFETIME_PREMIUM_ACCOUNT;

            await AccountsManager.Save(this);

            var dontWait = Sync.SetAsPremiumAccount(this);
        }
Ejemplo n.º 2
0
        private async System.Threading.Tasks.Task <string> RefreshOnlineTokenHelperAsync()
        {
            var resp = await PowerPlannerAppAuthLibrary.PowerPlannerAuth.RefreshOnlineTokenAsync(AccountId, Username, LocalToken);

            if (resp.Error == null)
            {
                Token = resp.Token;
                await AccountsManager.Save(this);

                return(null);
            }
            else
            {
                return(resp.Error);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets current semester and saves changes, also updates primary tile
        /// </summary>
        public async System.Threading.Tasks.Task SetCurrentSemesterAsync(Guid currentSemesterId, bool uploadSettings = true)
        {
            if (CurrentSemesterId == currentSemesterId)
            {
                return;
            }

            // If semester is being cleared (going to Years page), ignore this change.
            // That's to allow easily being able to view overall GPA without losing curr semester.
            if (currentSemesterId == Guid.Empty)
            {
                return;
            }

            CurrentSemesterId = currentSemesterId;

            NeedsToSyncSettings    = true;
            IsAppointmentsUpToDate = false;
#if ANDROID
            DateLastDayBeforeReminderWasSent = DateTime.MinValue;
#endif
            await AccountsManager.Save(this);

            // Upload their changed setting
            if (uploadSettings)
            {
                var dontWait = Sync.SyncSettings(this, Sync.ChangedSetting.SelectedSemesterId);
            }

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

            AppointmentsExtension.Current?.ResetAll(this, dataStore);
            RemindersExtension.Current?.ResetReminders(this, dataStore);

            TilesExtension.Current?.UpdateTileNotificationsForAccountAsync(this, dataStore);
        }
Ejemplo n.º 4
0
 private async System.Threading.Tasks.Task SaveOnThread()
 {
     await AccountsManager.Save(this);
 }