Inheritance: IDisposable
コード例 #1
0
ファイル: NestedProjectNode.cs プロジェクト: mimura1133/vstex
        private void InitImageHandler()
        {
            Debug.Assert(NestedHierarchy != null,
                "The nested hierarchy object must be created before calling this method");

            if (null == imageHandler)
            {
                imageHandler = new ImageHandler();
            }
            object imageListAsPointer = null;
            ErrorHandler.ThrowOnFailure(NestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT,
                (int) __VSHPROPID.VSHPROPID_IconImgList, out imageListAsPointer));
            if (imageListAsPointer != null)
            {
                imageHandler.ImageList = Utilities.GetImageList(imageListAsPointer);
            }
        }
コード例 #2
0
ファイル: ProjectNode.cs プロジェクト: mimura1133/vstex
        /// <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 (isDisposed)
            {
                return;
            }

            try
            {
                try
                {
                    UnRegisterProject();
                }
                finally
                {
                    try
                    {
                        RegisterClipboardNotifications(false);
                    }
                    finally
                    {
                        try
                        {
                            if (projectEventsProvider != null)
                            {
                                projectEventsProvider.AfterProjectFileOpened -= OnAfterProjectOpen;
                            }
                            if (TaskProvider != null)
                            {
                                TaskProvider.Tasks.Clear();
                                TaskProvider.Dispose();
                                TaskProvider = null;
                            }

                            if (buildLogger != null)
                            {
                                buildLogger.Shutdown();
                                buildLogger = null;
                            }

                            if (site != null)
                            {
                                site.Dispose();
                            }
                        }
                        finally
                        {
                            buildEngine = null;
                        }
                    }
                }

                if (buildProject != null)
                {
                    buildProject.ProjectCollection.UnloadProject(buildProject);
                    buildProject.ProjectCollection.UnloadProject(buildProject.Xml);
                    buildProject = null;
                }

                if (null != imageHandler)
                {
                    imageHandler.Close();
                    imageHandler = null;
                }
            }
            finally
            {
                base.Dispose(disposing);
                isDisposed = true;
            }
        }