private async void Login(object obj) { Error = string.Empty; var password = (obj as PasswordBox).SecurePassword; var state = await _authorizationProvider.Login(Email, password); if (!state.IsAuthentication) { Error = state.ErrorMessage; return; } _navigationPage.NavigateTo(ViewPageLocator.MainPage); }
public MainWindowViewModel(IAuthoriazationProvider authoriazationProvider, NavigationPageService pageService) { _authorizationProvider = authoriazationProvider; _pageService = pageService; _pageService.OnPageChanged += (page) => CurrentPage = page; //progress session logic, but this code need refactoring var state = _authorizationProvider.AuthenticationState; _authorizationProvider.ExtendSession(); if (state.IsAuthentication) { _pageService.NavigateTo(ViewPageLocator.MainPage); } else { pageService.NavigateTo(ViewPageLocator.LoginPage); } }
private void Logout(object obj) { _authorizationProvider.Logout(); _navigationPage.NavigateTo(ViewPageLocator.LoginPage); }