Meta.MetaPackage.TemplateProfileCallback C# (CSharp) Method

TemplateProfileCallback() private method

private TemplateProfileCallback ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void TemplateProfileCallback(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;

                    object value;
                    hierarchy.GetProperty(pitemid, (int)__VSHPROPID.VSHPROPID_Name, out value);

                    object svalue;
                    hierarchy.GetProperty(pitemid, (int)__VSHPROPID.VSHPROPID_ExtObject, out svalue);

                    //! Get the filename.
                    string filename = value.ToString();

                    EnvDTE.Project project = ProjectHelper.GetProject(hierarchy);
                    if (isProfilingInstantiations == 0)
                    {
                        ClaimInstantiationState();
                        Options opts = GetOptions();
                        templateProfiler = new TemplateProfiler(project, filename, opts.StackMaxSize, GetProfileOutputPane(), this.FreeInstantiationState);
                    }
                    else
                    {
                        templateProfiler.Cancel();
                    }
                }
            }
        }