From 36d1edb4f9cc4fbd9c134d3b387bcfec05424537 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 8 Jul 2018 17:55:46 +0300 Subject: Doing some work on PPC + Mirta integration. --- .../PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels') 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 293435d0b..dd54873ce 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs @@ -8,6 +8,7 @@ using Tango.PPC.Common; using Tango.PPC.Common.Navigation; using SimpleValidator.Extensions; using System.ComponentModel.DataAnnotations; +using Tango.SharedUI.Helpers; namespace Tango.PPC.UI.ViewModels { @@ -32,6 +33,17 @@ namespace Tango.PPC.UI.ViewModels set { _password = value; RaisePropertyChangedAuto(); } } + private bool _isLoading; + /// + /// Gets or sets a value indicating whether the application is busy with loading modules. + /// + public bool IsLoading + { + get { return _isLoading; } + set { _isLoading = value; RaisePropertyChangedAuto(); } + } + + public LoginViewVM() { LoginCommand = new RelayCommand(Login); @@ -49,10 +61,14 @@ namespace Tango.PPC.UI.ViewModels { if (Validate()) { + IsLoading = true; + UIHelper.DoEvents(); + var user = AuthenticationProvider.Login(Email, Password); if (user == null) { + IsLoading = false; NotificationProvider.ShowWarning("Email or password are incorrect."); } @@ -60,6 +76,7 @@ namespace Tango.PPC.UI.ViewModels { await Task.Delay(500); await NavigationManager.NavigateTo(NavigationView.HomeModule); + IsLoading = false; }; } } -- cgit v1.3.1