Microsoft.VisualStudio.Project.NestedProjectNode.GetIconHandle C# (CSharp) Method

GetIconHandle() public method

Gets the icon handle. It tries first the nested to get the icon handle. If that is not supported it will get it from the image list of the nested if that is supported. If neither of these is supported a default image will be shown.
public GetIconHandle ( bool open ) : object
open bool
return object
        public override object GetIconHandle(bool open)
        {
            Debug.Assert(this.nestedHierarchy != null, "The nested hierarchy object must be created before calling this method");

            object iconHandle = null;
            if (ErrorHandler.Failed(this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconHandle, out iconHandle)))
                iconHandle = null;

            if (iconHandle == null)
            {
                if (null == imageHandler)
                {
                    InitImageHandler();
                }
                // Try to get an icon from the nested hierrachy image list.
                if (imageHandler.ImageList != null)
                {
                    object imageIndexAsObject = null;
                    if (this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconIndex, out imageIndexAsObject) == VSConstants.S_OK &&
                        imageIndexAsObject != null)
                    {
                        int imageIndex = (int)imageIndexAsObject;
                        if (imageIndex < imageHandler.ImageList.Images.Count)
                        {
                            iconHandle = imageHandler.GetIconHandle(imageIndex);
                        }
                    }
                }

                if (null == iconHandle)
                {
                    iconHandle = this.ProjectManager.ImageHandler.GetIconHandle((int)ImageName.Application);
                }
            }

            return iconHandle;
        }