Skip to main content

Close project

To close a project, use the CloseProject method of the IWorkspace object. To display a confirmation dialog, use the ShowConfirmDialog method of the ICommonUI object.

public void CloseProject(ICommandContext c, ICommandParams p) 
{
//Display the confirmation dialog
if ( c.App.Window.UI.ShowConfirmDialog("Are you sure you want to close the project file?") )
{
//Close the project
c.App.Workspace.CloseProject();
}
}
Note

When closing a project using the API, the confirmation dialog will not be displayed even if the project is dirty, and the project will close as is.