AskUserToSaveWorkspaceOrCancel() public method

Requests a message box asking the user to save the workspace and allows saving.
public AskUserToSaveWorkspaceOrCancel ( Dynamo.Models.WorkspaceModel workspace, bool allowCancel = true ) : bool
workspace Dynamo.Models.WorkspaceModel The workspace for which to show the dialog
allowCancel bool
return bool
示例#1
0
        private void Hide(object parameters)
        {
            // Closing of custom workspaces will simply close those workspaces,
            // but closing Home workspace has a different meaning. First off,
            // Home workspace cannot be closed or hidden, it can only be cleared.
            // As of this revision, pressing the "X" button on Home workspace
            // tab simply clears the Home workspace, and bring up the Start Page
            // if there are no other custom workspace that is opened.
            //

            if (this.IsHomeSpace)
            {
                if (DynamoViewModel.CloseHomeWorkspaceCommand.CanExecute(null))
                {
                    DynamoViewModel.CloseHomeWorkspaceCommand.Execute(null);
                }
            }
            else
            {
                if (!Model.HasUnsavedChanges || DynamoViewModel.AskUserToSaveWorkspaceOrCancel(Model))
                {
                    DynamoViewModel.Model.RemoveWorkspace(Model);
                }
            }
        }