コード例 #1
0
        private async void Initialize()
        {
            try
            {
                GetEmailResponse response = await Account.PostAuthenticatedAsync <GetEmailRequest, GetEmailResponse>(
                    Website.URL + "getemailmodern",
                    new GetEmailRequest());

                if (response != null)
                {
                    if (response.Error != null)
                    {
                        SetError(response.Error);
                    }

                    else
                    {
                        Email             = response.Email;
                        IsRetrievingEmail = false;
                    }

                    return;
                }
            }

            catch
            {
            }

            SetError(PowerPlannerResources.GetString("Settings_ChangeEmailPage_Errors_FailedGrabEmail"));
        }
コード例 #2
0
            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);
                }
            }