Exemple #1
0
        private void Navigating(NavigatingEventArgs e)
        {
            if (e.Uri.AbsoluteUri.Contains("?code"))
            {
                string code = GetQueryParameter(e.Uri.AbsoluteUri.Substring(e.Uri.AbsoluteUri.IndexOf("?") + 1), "code");

                this.credentials.SetCode(code);

                Action authenticate = async() =>
                {
                    UberAuthenticationDetails response = await uberService.Authenticate(CancellationToken.None, this.credentials);

                    if (response == null)
                    {
                        // Display error
                        ShowPopup(CustomPopupMessageType.Error, AppResources.UberErrorAuthenticating, AppResources.CustomPopupGenericOkMessage, null);

                        return;
                    }

                    user.UberInfo                = new UberInfo(response.AccessToken, response.RefreshToken);
                    user.IsUberAuthenticated     = true;
                    user.DismissedLoginUberPopup = true;
                    UnitOfWork.UserRepository.Update(user);
                    UnitOfWork.Save();

                    InMemoryApplicationSettingModel.UpdateSetting(ApplicationSetting.LoginUber, true);

                    NavigationService.GoBack();
                };

                DispatcherHelper.CheckBeginInvokeOnUI(authenticate);
            }
        }
        private void EnableGps()
        {
            InMemoryApplicationSettingModel.UpdateSetting(ApplicationSetting.AllowLocation, true);

            this.ShowPopup(CustomPopupMessageType.Information, AppResources.SettingsSavedPopupMessage, AppResources.CustomPopupGenericOkMessage, null);

            SetPopupVisibilities();
        }
Exemple #3
0
 private void SaveSetting(ApplicationSetting setting, bool value)
 {
     InMemoryApplicationSettingModel.UpdateSetting(setting, value);
 }