diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-19 17:08:43 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-19 17:08:43 +0300 |
| commit | 0eca640aa38c5697739f66d1b3e565d46e615b78 (patch) | |
| tree | ec68e302b44ed4f2e624b49caf0d3977a60a867c /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs | |
| parent | 1db87b6d19c6148351b37a32e8ff2b127768e945 (diff) | |
| download | Tango-0eca640aa38c5697739f66d1b3e565d46e615b78.tar.gz Tango-0eca640aa38c5697739f66d1b3e565d46e615b78.zip | |
Improved Keyboard View.
Applies TouchPanel to PPC.
Implemented LoginView for PPC.
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 | 48 |
1 files changed, 47 insertions, 1 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 6962de59d..5086fd323 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs @@ -3,15 +3,61 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.Commands; using Tango.PPC.Common; +using Tango.PPC.Common.Navigation; +using SimpleValidator.Extensions; +using System.ComponentModel.DataAnnotations; namespace Tango.PPC.UI.ViewModels { public class LoginViewVM : PPCViewModel { + public RelayCommand LoginCommand { get; set; } + + private String _email; + [Required(ErrorMessage = "Email is required")] + [EmailAddress(ErrorMessage = "Please enter a valid email address")] + public String Email + { + get { return _email; } + set { _email = value; RaisePropertyChangedAuto(); } + } + + private String _password; + [Required(ErrorMessage = "Password is required")] + public String Password + { + get { return _password; } + set { _password = value; RaisePropertyChangedAuto(); } + } + + public LoginViewVM() + { + LoginCommand = new RelayCommand(Login); + } + public override void OnApplicationStarted() { - + + } + + private void Login() + { + if (Validate()) + { + var user = AuthenticationProvider.Login(Email, Password); + + if (user == null) + { + NotificationProvider.ShowWarning("Email or password are incorrect."); + } + + ApplicationManager.ModulesInitialized += (_, __) => + { + NavigationManager.NavigateTo(NavigationView.HomeModule); + }; + } } } } |
