diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs index 812f10121..9d17a4a76 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs @@ -84,6 +84,16 @@ namespace Tango.PPC.UI.ViewModels AuthenticationProvider.CurrentUserChanged += AuthenticationProvider_CurrentUserChanged; } + public override async void OnApplicationReady() + { + base.OnApplicationReady(); + + await Task.Delay(500); + LogManager.Log("Application is ready! Navigating to home module..."); + await NavigationManager.NavigateTo(NavigationView.HomeModule); + IsLoading = false; + } + #endregion #region Event Handlers @@ -108,7 +118,7 @@ namespace Tango.PPC.UI.ViewModels /// <summary> /// Login to the application using the user name and password. /// </summary> - private void Login() + private async void Login() { LogManager.Log("Login command pressed."); @@ -117,21 +127,13 @@ namespace Tango.PPC.UI.ViewModels IsLoading = true; UIHelper.DoEvents(); - var user = AuthenticationProvider.Login(Email, Password); + var user = await AuthenticationProvider.Login(Email, Password); if (user == null) { IsLoading = false; - NotificationProvider.ShowWarning("Email or password are incorrect."); + await NotificationProvider.ShowWarning("Email or password are incorrect."); } - - ApplicationManager.ModulesInitialized += async (_, __) => - { - await Task.Delay(500); - LogManager.Log("Modules initialized. Navigating to home module..."); - await NavigationManager.NavigateTo(NavigationView.HomeModule); - IsLoading = false; - }; } else { |
