Meta.MetaPackage.uiContex1Cmd_BeforeQueryStatus C# (CSharp) Method

uiContex1Cmd_BeforeQueryStatus() private method

private uiContex1Cmd_BeforeQueryStatus ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void uiContex1Cmd_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)
                {
                    if (isProfilingInstantiations == 0 && !VsShellUtilities.IsSolutionBuilding(this) )
                    {
                        if (ProjectHelper.IsCPPProject(projectItemId, hierarchy) || ProjectHelper.IsCPPNode(projectItemId, hierarchy))
                        {
                            menuCommand.Visible = true;
                            menuCommand.Text = isProfilingBuildTime != 0 ? "Cancel Build Profile..." : "Profile Build Time";
                            return;
                        }
                    }
                }

                menuCommand.Visible = false;
            }
        }