aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-06-19 17:08:43 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-06-19 17:08:43 +0300
commit0eca640aa38c5697739f66d1b3e565d46e615b78 (patch)
treeec68e302b44ed4f2e624b49caf0d3977a60a867c /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
parent1db87b6d19c6148351b37a32e8ff2b127768e945 (diff)
downloadTango-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')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs9
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs48
2 files changed, 49 insertions, 8 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
index 5bc02f829..f14fb7283 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
@@ -34,14 +34,9 @@ namespace Tango.PPC.UI.ViewModels
/// <summary>
/// Called when the application has been started.
/// </summary>
- public async override void OnApplicationStarted()
+ public override void OnApplicationStarted()
{
- ApplicationManager.ModulesInitialized += (_, __) =>
- {
- NavigationManager.NavigateTo(NavigationView.HomeModule);
- };
-
- await AuthenticationProvider.Login("roy@twine-s.com", "1234");
+ NavigationManager.NavigateTo(NavigationView.LoginView);
}
}
}
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);
+ };
+ }
}
}
}