private void CloseProject(INamedProject project) { IProjectItem projectItem2 = null; PerformanceUtility.StartPerformanceSequence(PerformanceEvent.ProjectClose); try { IProject project1 = project as IProject; if (project1 != null) { ((ProjectManager)this.Services.ProjectManager()).OnProjectClosing(new ProjectEventArgs(project1)); } ItemSelectionSet itemSelectionSet = this.Services.ProjectManager().ItemSelectionSet; itemSelectionSet.RemoveSelection((IDocumentItem selection) => { IProjectItem projectItem = selection as IProjectItem; IProjectItem projectItem1 = projectItem; projectItem2 = projectItem; if (projectItem1 == null) { return(false); } return(projectItem2.Project == project); }); itemSelectionSet.RemoveSelection(project); ((ProjectManager)this.Services.ProjectManager()).UpdateCurrentWorkingDirectory(null); project.Dispose(); } finally { this.RemoveProject(project); if (this.StartupProject == project) { this.StartupProject = null; } this.OnAnyProjectClosed(new NamedProjectEventArgs(project)); } PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ProjectClose); }
protected INamedProject OpenProject(IProjectStore projectStore) { INamedProject namedProject = null; ErrorHandling.HandleBasicExceptions(() => namedProject = this.InitializeProject(projectStore), (Exception exception) => { this.Services.MessageDisplayService().ShowError(string.Format(CultureInfo.CurrentCulture, StringTable.DialogFailedMessage, new object[] { string.Format(CultureInfo.CurrentCulture, StringTable.DialogOpenFailedMessage, new object[] { projectStore.DocumentReference.DisplayName }), exception.Message })); namedProject = null; }); if (namedProject != null) { try { this.OpenProjectInternal(namedProject); } catch { namedProject.Dispose(); namedProject = null; throw; } } return(namedProject); }