From 099cb04861e293cf675d8b5216448a766eef7954 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 14 Jun 2018 14:56:16 +0300 Subject: Implemented new fast job pie chart rendering using GDI! --- .../DefaultAuthenticationProvider.cs | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs new file mode 100644 index 000000000..8a60caf6d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Core; +using Tango.PPC.Common.Authentication; + +namespace Tango.PPC.UI.Authentication +{ + public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider + { + private User _currentUser; + + public User CurrentUser + { + get { return _currentUser; } + private set + { + _currentUser = value; + RaisePropertyChangedAuto(); + } + } + + public event EventHandler CurrentUserChanged; + + public Task Login(string email, string password) + { + return Task.Factory.StartNew(() => + { + CurrentUser = ObservablesEntitiesAdapter.Instance.Users.SingleOrDefault(x => x.Email.ToLower() == email && x.Password == password); + CurrentUserChanged?.Invoke(this, CurrentUser); + return CurrentUser; + }); + } + + public void Logout() + { + CurrentUser = null; + CurrentUserChanged?.Invoke(this, CurrentUser); + } + } +} -- cgit v1.3.1