예제 #1
0
		/// <summary>
		/// Disposes the project node object.
		/// </summary>
		/// <param name="disposing">Flag determining ehether it was deterministic or non deterministic clean up.</param>
		protected override void Dispose(bool disposing)
		{
			if(this.isDisposed)
			{
				return;
			}

			try
			{
				try
				{
					this.UnRegisterProject();
				}
				finally
				{
					try
					{
						this.RegisterClipboardNotifications(false);
					}
					finally
					{
						try
						{
							if(this.globalPropertyHandler != null)
							{
								this.globalPropertyHandler.ActiveConfigurationChanged -= new EventHandler<ActiveConfigurationChangedEventArgs>(this.OnHandleConfigurationRelatedGlobalProperties);

								this.globalPropertyHandler.Dispose();
							}

							if(this.projectEventsProvider != null)
							{
								this.projectEventsProvider.AfterProjectFileOpened -= this.OnAfterProjectOpen;
							}
							if(this.taskProvider != null)
							{
								taskProvider.Tasks.Clear();
								this.taskProvider.Dispose();
								this.taskProvider = null;
							}
							if(buildLogger != null)
							{
								buildLogger = null;
							}
							this.site = null;
						}
						finally
						{
							if(this.buildEngine != null)
							{
								this.buildEngine.UnregisterAllLoggers();
								this.buildEngine = null;
							}
						}
					}
				}

				if(this.buildProject != null)
				{
					this.buildProject.ParentEngine.UnloadProject(this.buildProject);
					this.buildProject = null;
				}

				if(null != imageHandler)
				{
					imageHandler.Close();
					imageHandler = null;
				}
			}
			finally
			{
				base.Dispose(disposing);
				this.isDisposed = true;
			}
		}
		private void InitImageHandler()
		{
			Debug.Assert(this.nestedHierarchy != null, "The nested hierarchy object must be created before calling this method");

			if(null == imageHandler)
			{
				imageHandler = new ImageHandler();
			}
			object imageListAsPointer = null;
			ErrorHandler.ThrowOnFailure(this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconImgList, out imageListAsPointer));
			if(imageListAsPointer != null)
			{
				this.imageHandler.ImageList = Utilities.GetImageList(imageListAsPointer);
			}
		}