protected override void Dispose(bool disposing) { if (disposing) { if (base.ProjectPane != null) { base.Services.ViewService().ViewOpened -= new ViewEventHandler(this.ViewService_ViewOpened); base.Services.ViewService().ViewClosed -= new ViewEventHandler(this.ViewService_ViewClosed); base.ProjectPane = null; } if (this.projectItem != null) { this.projectItem.IsDirtyChanged -= new EventHandler(this.ProjectItem_IsDirtyChanged); this.projectItem.IsCutChanged -= new EventHandler(this.ProjectItem_IsCutChanged); this.projectItem.ParentChanged -= new EventHandler(this.ProjectItem_ParentChanged); this.projectItem.FileInformationChanged -= new FileSystemEventHandler(this.ProjectItem_FileInformationChanged); this.projectItem = null; } if (this.knownProjectNode != null) { ((IProject)this.knownProjectNode.Project).StartupItemChanged -= new EventHandler <ProjectItemChangedEventArgs>(this.Project_StartupSceneChanged); } this.projectNode = null; this.knownProjectNode = null; ProjectItemNode projectItemNode = this; base.IsExpandedChanged -= new EventHandler(projectItemNode.ProjectItemNode_IsExpandedChanged); base.Dispose(disposing); } }
protected ProjectItemNode(IProjectItem projectItem, Microsoft.Expression.Project.UserInterface.ProjectPane projectPane, Microsoft.Expression.Project.UserInterface.ProjectNode projectNode) : base(projectItem, projectPane) { this.projectItem = projectItem; base.ProjectPane = projectPane; this.projectNode = projectNode; this.knownProjectNode = this.projectNode as KnownProjectNode; base.Services.ViewService().ViewOpened += new ViewEventHandler(this.ViewService_ViewOpened); base.Services.ViewService().ViewClosed += new ViewEventHandler(this.ViewService_ViewClosed); this.projectItem.IsDirtyChanged += new EventHandler(this.ProjectItem_IsDirtyChanged); this.projectItem.IsCutChanged += new EventHandler(this.ProjectItem_IsCutChanged); this.projectItem.ParentChanged += new EventHandler(this.ProjectItem_ParentChanged); this.projectItem.FileInformationChanged += new FileSystemEventHandler(this.ProjectItem_FileInformationChanged); ProjectItemNode projectItemNode = this; base.IsExpandedChanged += new EventHandler(projectItemNode.ProjectItemNode_IsExpandedChanged); if (this.knownProjectNode != null) { ((IProject)this.knownProjectNode.Project).StartupItemChanged += new EventHandler <ProjectItemChangedEventArgs>(this.Project_StartupSceneChanged); } }
private void Solution_AnyProjectOpened(object sender, NamedProjectEventArgs e) { ProjectNode projectNode; try { IProject namedProject = e.NamedProject as IProject; if (namedProject == null) { projectNode = new ProjectNode(e.NamedProject, this); } else { projectNode = new KnownProjectNode(namedProject, this); } this.projectInsertion.AddChild(projectNode); } finally { this.OnPropertyChanged("RootItem"); } }
private void ProjectManager_SolutionOpened(object sender, SolutionEventArgs e) { ProjectNode projectNode; ISolutionManagement solution = e.Solution as ISolutionManagement; if (solution != null) { solution.AnyProjectOpened += new EventHandler <NamedProjectEventArgs>(this.Solution_AnyProjectOpened); solution.AnyProjectClosed += new EventHandler <NamedProjectEventArgs>(this.Solution_AnyProjectClosed); } this.projectInsertion = new SolutionNode(e.Solution, this); this.root.AddChild(this.projectInsertion); foreach (INamedProject allProject in ((ISolutionManagement)e.Solution).AllProjects) { IProject project = allProject as IProject; if (project == null) { projectNode = new ProjectNode(allProject, this); } else { projectNode = new KnownProjectNode(project, this); } if (solution != null) { object projectProperty = solution.SolutionSettingsManager.GetProjectProperty(allProject, ProjectPane.IsExpanded); if (projectProperty != null && projectProperty is bool) { projectNode.IsExpanded = (bool)projectProperty; } solution.SolutionSettingsManager.ClearProjectProperty(allProject, ProjectPane.IsExpanded); } this.projectInsertion.AddChild(projectNode); } this.EnableSearch = true; this.OnPropertyChanged("RootItem"); }