Ejemplo n.º 1
0
        public override async Task InitAsync()
        {
            await AuthManager.LoadAsync();

            if (AuthManager.IsAuthenticated)
            {
                if (EntityHeader.IsNullOrEmpty(AuthManager.User.CurrentOrganization))
                {
                    Logger.AddKVPs(new KeyValuePair <string, string>("Email", AuthManager.User.Email));
                }
                else
                {
                    Logger.AddKVPs(new KeyValuePair <string, string>("Email", AuthManager.User.Email), new KeyValuePair <string, string>("OrgId", AuthManager.User.CurrentOrganization.Text));
                }

                if (!AuthManager.User.EmailConfirmed || !AuthManager.User.PhoneNumberConfirmed)
                {
                    await ViewModelNavigation.SetAsNewRootAsync <VerifyUserViewModel>();
                }
                else if (EntityHeader.IsNullOrEmpty(AuthManager.User.CurrentOrganization))
                {
                    await ViewModelNavigation.SetAsNewRootAsync <Orgs.OrgEditorViewModel>();
                }
                else
                {
                    await ViewModelNavigation.SetAsNewRootAsync(_clientAppInfo.MainViewModel);
                }
            }
            else
            {
                NotLoggedIn = true;
                IsLoading   = false;
            }
        }
Ejemplo n.º 2
0
        public async void LoginAsync()
        {
            var loginResult = await PerformNetworkOperation(PerformLoginAsync);

            if (loginResult.Successful)
            {
                if (AuthManager.User.EmailConfirmed && AuthManager.User.PhoneNumberConfirmed)
                {
                    // If no org, have them add an org....
                    if (EntityHeader.IsNullOrEmpty(AuthManager.User.CurrentOrganization))
                    {
                        await ViewModelNavigation.SetAsNewRootAsync <OrgEditorViewModel>();
                    }
                    else
                    {
                        // We are good, so show main screen.
                        await ViewModelNavigation.SetAsNewRootAsync(_clientAppInfo.MainViewModel);
                    }
                }
                else
                {
                    // Show verify user screen.
                    await ViewModelNavigation.SetAsNewRootAsync <VerifyUserViewModel>();
                }
            }
        }
Ejemplo n.º 3
0
 public override void Save()
 {
     base.Save();
     if (FormAdapter.Validate())
     {
         ViewToModel(FormAdapter, Model);
         PerformNetworkOperation(async() =>
         {
             await ViewModelNavigation.SetAsNewRootAsync(_clientAppInfo.MainViewModel);
         });
     }
 }
Ejemplo n.º 4
0
 public async Task TransitionToNextView()
 {
     if (AuthManager.User.EmailConfirmed && AuthManager.User.PhoneNumberConfirmed)
     {
         if (EntityHeader.IsNullOrEmpty(AuthManager.User.CurrentOrganization))
         {
             await ViewModelNavigation.SetAsNewRootAsync <OrgEditorViewModel>();
         }
         else
         {
             await ViewModelNavigation.SetAsNewRootAsync(_clientAppInfo.MainViewModel);
         }
     }
 }
Ejemplo n.º 5
0
        public async void Logout()
        {
            await AuthManager.LogoutAsync();

            await ViewModelNavigation.SetAsNewRootAsync <Auth.LoginViewModel>();
        }
Ejemplo n.º 6
0
 public override Task PostSaveAsync()
 {
     return(ViewModelNavigation.SetAsNewRootAsync(_clientAppInfo.MainViewModel));
 }
Ejemplo n.º 7
0
 public async void Login()
 {
     await ViewModelNavigation.SetAsNewRootAsync <Auth.LoginViewModel>();
 }