Meta.MetaPackage.uiContex2Cmd_BeforeQueryStatus C# (CSharp) Method

uiContex2Cmd_BeforeQueryStatus() private method

private uiContex2Cmd_BeforeQueryStatus ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void uiContex2Cmd_BeforeQueryStatus(object sender, EventArgs e)
        {
            OleMenuCommand menuCommand = sender as OleMenuCommand;
            if (menuCommand != null)
            {
                IntPtr hierarchyPtr, selectionContainerPtr;
                uint projectItemId;
                IVsMultiItemSelect mis;
                IVsMonitorSelection monitorSelection = (IVsMonitorSelection)Package.GetGlobalService(typeof(SVsShellMonitorSelection));
                monitorSelection.GetCurrentSelection(out hierarchyPtr, out projectItemId, out mis, out selectionContainerPtr);

                IVsHierarchy hierarchy = Marshal.GetTypedObjectForIUnknown(hierarchyPtr, typeof(IVsHierarchy)) as IVsHierarchy;
                if (hierarchy != null && isProfilingBuildTime == 0 && !VsShellUtilities.IsSolutionBuilding(this) && ProjectHelper.IsCPPNode(projectItemId, hierarchy))
                {
                    menuCommand.Visible = true;
                    menuCommand.Text = isProfilingInstantiations != 0 ? "Cancel Instantiation Profile..." : "Profile Template Instantiations";
                    return;
                }

                menuCommand.Visible = false;
            }
        }