예제 #1
0
        public async Task LogoutAsync()
        {
            bool logout = await _dialogService.ShowConfirmationDialogAsync(
                "Confirmation",
                "Are you sure you want to log out?",
                "Yes",
                "No");

            if (logout)
            {
                //TODO: DELETE ALL !!
                //delete all from the db
                //delete user settings
                //delete all view models
                OpenPane(false);
                ShowLoading(true, "Logging out... Please wait..");
                BackgroundTasksManager.UnregisterBackgroundTask();
                _appSettings.ResetAppSettings();

                await _dataService
                .UserService
                .ChangeCurrentUserStatus(false);

                string currentLoggedUsername = _userCredentialService.GetCurrentLoggedUsername();
                if (string.IsNullOrEmpty(currentLoggedUsername))
                {
                    currentLoggedUsername = _userCredentialService.DefaultUsername;
                }

                _userCredentialService.DeleteUserCredential(ResourceType.ALL, currentLoggedUsername);
                _navigationService.GoBack();
                ShowLoading(false);
            }
        }