Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
 private void Logout(object obj)
 {
     _authorizationProvider.Logout();
     _navigationPage.NavigateTo(ViewPageLocator.LoginPage);
 }