Meta.MetaPackage.BuildProfileCallback C# (CSharp) Method

BuildProfileCallback() private method

This function is the callback used to execute a command when the a menu item is clicked. See the Initialize method to see how the menu item is associated to this function using the OleMenuCommandService service and the MenuCommand class.
private BuildProfileCallback ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void BuildProfileCallback(object sender, EventArgs e)
        {
            IVsMonitorSelection SelectionService;
            SelectionService = (IVsMonitorSelection)GetGlobalService(typeof(SVsShellMonitorSelection));
            IntPtr ppHier;
            uint pitemid;
            IVsMultiItemSelect ppMIS;
            IntPtr ppSC;
            if (SelectionService.GetCurrentSelection(out ppHier, out pitemid, out ppMIS, out ppSC) == VSConstants.S_OK)
            {
                //! Handle single selections only for now.
                if (pitemid != VSConstants.VSITEMID_SELECTION && ppHier != null)
                {
                    IVsHierarchy hierarchy = Marshal.GetTypedObjectForIUnknown(ppHier, typeof(IVsHierarchy)) as IVsHierarchy;
                    if (isProfilingBuildTime==0)
                    {
                        EnvDTE.Project project = ProjectHelper.GetProject(hierarchy);

                        if( ProjectHelper.IsCPPProject(pitemid, hierarchy) )
                            CleanProject(hierarchy);

                        ClaimBuildState();
                        Options opts = GetOptions();
                        if (ProjectHelper.IsCPPNode(pitemid, hierarchy))
                        {
                            object value;
                            hierarchy.GetProperty(pitemid, (int)__VSHPROPID.VSHPROPID_Name, out value);
                            Debug.Assert(value != null);
                            if( value != null )
                                buildProfiler = new BuildProfiler(project, opts.StackMaxSize, GetBuildOutputPane(), GetProfileOutputPane(), this.FreeBuildState, value.ToString());
                        }
                        else
                            buildProfiler = new BuildProfiler(project, opts.StackMaxSize, GetBuildOutputPane(), GetProfileOutputPane(), this.FreeBuildState);
                    }
                    else
                    {
                        buildProfiler.Cancel();
                    }
                }
            }
        }