Esempio n. 1
0
        /*************************************************************************************************/
        public void DisplayLogOutResult(LogOutResult result)
        {
            switch (result)
            {
            case LogOutResult.Failed:
                UIHelper.UpdateStatusLabel("Log out failed!", userStatusLabel, ErrorLevel.Neutral);
                break;

            case LogOutResult.Success:
                _loggedIn = false;
                passwordDataGridView.DataSource = null;
                passwordDataGridView.Rows.Clear();
                userStatusLabel.Text                    = "";
                applicationTextBox.Enabled              = false;
                descriptionTextBox.Enabled              = false;
                websiteTextBox.Enabled                  = false;
                passphraseTextBox.Enabled               = false;
                usernameTextBox.Enabled                 = false;
                emailTextBox.Enabled                    = false;
                addButton.Enabled                       = false;
                deleteButton.Enabled                    = false;
                editButton.Enabled                      = false;
                filterTextBox.Enabled                   = false;
                deleteToolStripMenuItem.Enabled         = false;
                changePasswordToolStripMenuItem.Enabled = false;
                editToolStripMenuItem.Enabled           = false;
                loginToolStripMenuItem.Text             = "Login";
                UIHelper.UpdateStatusLabel("Logged off.", userStatusLabel, ErrorLevel.Neutral);
                break;
            }
        }
Esempio n. 2
0
        /*=================================================================================================
        *       PUBLIC METHODS
        *================================================================================================*/
        /*************************************************************************************************/

        /*=================================================================================================
        *       PRIVATE METHODS
        *================================================================================================*/
        /*************************************************************************************************/

        /*************************************************************************************************/
        private void DeleteAccount()
        {
            User         user   = _passwordService.GetCurrentUser();
            LogOutResult result = LogoutUser();

            if (result == LogOutResult.Success)
            {
                _passwordService.DeleteUser(user);
            }
        }
Esempio n. 3
0
        /*************************************************************************************************/
        private LogOutResult LogoutUser()
        {
            LogOutResult result = _passwordService.Logout();

            if (result == LogOutResult.Success)
            {
                _mainView.RequestPasswordsOnLoginEvent += UpdateUsernameWelcomeUI;
            }

            _mainView.DisplayLogOutResult(result);

            return(result);
        }
Esempio n. 4
0
        /*************************************************************************************************/
        public LogOutResult Logout()
        {
            LogOutResult result = LogOutResult.Failed;

            if (IsLoggedIn())
            {
                _passwordList.Clear();
                _currentUser = new User(false);

                result = LogOutResult.Success;
            }

            return(result);
        }
Esempio n. 5
0
        public async Task LogOutAsync()
        {
            await Task.Run(async() => {
                try {
                    string url         = BaseSingleton <GlobalSetting> .Instance.RestEndpoints.IdentityEndpoints.LogOutEndPoint;
                    string accessToken = BaseSingleton <GlobalSetting> .Instance.UserProfile.AccesToken;

                    LogOutResult logOutResult = await _requestProvider.PostAsync <LogOutResult, object>(url, null, accessToken);

                    if (logOutResult != null)
                    {
                    }
                }
                catch (Exception ex) {
                    Debug.WriteLine($"ERROR LogOutAsync():{ex.Message}");
                }
            });

            try {
                BaseSingleton <GlobalSetting> .Instance.UserProfile.ClearUserProfile();

                BaseSingleton <GlobalSetting> .Instance.UserProfile.SaveChanges();

                await StopSocketServicesAsync();

                Device.BeginInvokeOnMainThread(async() => {
                    await _navigationService.InitializeAsync(new BottomTabIndexArgs()
                    {
                        TargetTab = typeof(ProfileViewModel)
                    });
                });
            }
            catch (Exception exc) {
                Crashes.TrackError(exc);
                Debugger.Break();
                throw;
            }
        }