Example #1
0
        public async Task <bool> ResetWorkspaces()
        {
            if (await _messageService.Show("Resetting workspaces will delete all your current workspaces. This action cannot be undone. Are you sure you want to reset the workspaces?", string.Empty, MessageButton.YesNo) == MessageResult.No)
            {
                return(false);
            }

            Log.Info("Resetting workspaces");

            var workspaces = _workspaceManager.Workspaces;

            foreach (var workspace in workspaces)
            {
                if (workspace.CanDelete)
                {
                    _workspaceManager.Remove(workspace);
                }
            }

            var newWorkspace = _workspaceManager.Workspaces.FirstOrDefault();

            if (newWorkspace != null)
            {
                _workspaceManager.Workspace = newWorkspace;
            }

            return(true);
        }