Exemplo n.º 1
0
        internal void StartProfiling(ProfilingTarget target, SessionNode session, bool openReport = true)
        {
            if (!Utilities.SaveDirtyFiles())
            {
                // Abort
                return;
            }

            if (target.ProjectTarget != null)
            {
                ProfileProjectTarget(session, target.ProjectTarget, openReport);
            }
            else if (target.StandaloneTarget != null)
            {
                ProfileStandaloneTarget(session, target.StandaloneTarget, openReport);
            }
            else
            {
                if (MessageBox.Show("Profiling session is not configured - would you like to configure now and then launch?", "No Profiling Target", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    var newTarget = session.OpenTargetProperties();
                    if (newTarget != null && (newTarget.ProjectTarget != null || newTarget.StandaloneTarget != null))
                    {
                        StartProfiling(newTarget, session, openReport);
                    }
                }
            }
        }
        internal void StartProfiling(ProfilingTarget target, SessionNode session, bool openReport = true)
        {
            if (!Utilities.SaveDirtyFiles())
            {
                // Abort
                return;
            }

            if (target.ProjectTarget != null)
            {
                ProfileProjectTarget(session, target.ProjectTarget, openReport);
            }
            else if (target.StandaloneTarget != null)
            {
                ProfileStandaloneTarget(session, target.StandaloneTarget, openReport);
            }
            else
            {
                if (MessageBox.Show(Resources.NoProfilingConfiguredMessageText, Resources.NoProfilingConfiguredMessageCaption, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    var newTarget = session.OpenTargetProperties();
                    if (newTarget != null && (newTarget.ProjectTarget != null || newTarget.StandaloneTarget != null))
                    {
                        StartProfiling(newTarget, session, openReport);
                    }
                }
            }
        }
        internal void StartProfiling(ProfilingTarget target, SessionNode session, bool openReport = true) {
            if (!Utilities.SaveDirtyFiles()) {
                // Abort
                return;
            }

            if (target.ProjectTarget != null) {
                ProfileProjectTarget(session, target.ProjectTarget, openReport);
            } else if (target.StandaloneTarget != null) {
                ProfileStandaloneTarget(session, target.StandaloneTarget, openReport);
            } else {
                if (MessageBox.Show("Profiling session is not configured - would you like to configure now and then launch?", "No Profiling Target", MessageBoxButton.YesNo) == MessageBoxResult.Yes) {
                    var newTarget = session.OpenTargetProperties();
                    if (newTarget != null && (newTarget.ProjectTarget != null || newTarget.StandaloneTarget != null)) {
                        StartProfiling(newTarget, session, openReport);
                    }
                }
            }
        }
        internal void StartProfiling(ProfilingTarget target, SessionNode session, bool openReport = true) {
            if (!Utilities.SaveDirtyFiles()) {
                // Abort
                return;
            }

            if (target.ProjectTarget != null) {
                ProfileProjectTarget(session, target.ProjectTarget, openReport);
            } else if (target.StandaloneTarget != null) {
                ProfileStandaloneTarget(session, target.StandaloneTarget, openReport);
            } else {
                if (MessageBox.Show(Resources.NoProfilingConfiguredMessageText, Resources.NoProfilingConfiguredMessageCaption, MessageBoxButton.YesNo) == MessageBoxResult.Yes) {
                    var newTarget = session.OpenTargetProperties();
                    if (newTarget != null && (newTarget.ProjectTarget != null || newTarget.StandaloneTarget != null)) {
                        StartProfiling(newTarget, session, openReport);
                    }
                }
            }
        }
Exemplo n.º 5
0
            public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
            {
                if (pguidCmdGroup == ProfilingGuids.NodejsProfilingCmdSet)
                {
                    switch (nCmdID)
                    {
                    case PkgCmdIDList.cmdidOpenReport:
                        _node.OpenProfile(_itemid);
                        return(VSConstants.S_OK);

                    case PkgCmdIDList.cmdidPerfCtxSetAsCurrent:
                        _node._parent.SetActiveSession(_node);
                        return(VSConstants.S_OK);

                    case PkgCmdIDList.cmdidPerfCtxStartProfiling:
                        _node.StartProfiling();
                        return(VSConstants.S_OK);

                    case PkgCmdIDList.cmdidReportsCompareReports:
                    {
                        CompareReportsView compareView;
                        if (_node.IsReportItem(_itemid))
                        {
                            var report = _node.GetReport(_itemid);
                            compareView = new CompareReportsView(report.Filename);
                        }
                        else
                        {
                            compareView = new CompareReportsView();
                        }

                        var dialog = new CompareReportsWindow(compareView);
                        var res    = dialog.ShowModal() ?? false;
                        if (res && compareView.IsValid)
                        {
                            IVsUIShellOpenDocument sod = NodejsProfilingPackage.GetGlobalService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument;
                            Debug.Assert(sod != null);
                            Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame frame = null;
                            Guid guid     = new Guid("{9C710F59-984F-4B83-B781-B6356C363B96}");     // performance diff guid
                            Guid guidNull = Guid.Empty;

                            sod.OpenSpecificEditor(
                                (uint)(_VSRDTFLAGS.RDT_CantSave | _VSRDTFLAGS.RDT_DontAddToMRU | _VSRDTFLAGS.RDT_NonCreatable | _VSRDTFLAGS.RDT_NoLock),
                                compareView.GetComparisonUri(),
                                ref guid,
                                null,
                                ref guidNull,
                                "Performance Comparison",
                                _node,
                                _itemid,
                                IntPtr.Zero,
                                null,
                                out frame
                                );

                            if (frame != null)
                            {
                                Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(frame.Show());
                            }
                        }
                        return(VSConstants.S_OK);
                    }

                    case PkgCmdIDList.cmdidReportsAddReport:
                    {
                        var dialog = new OpenFileDialog();
                        dialog.Filter          = NodejsProfilingPackage.PerformanceFileFilter;
                        dialog.CheckFileExists = true;
                        var res = dialog.ShowDialog() ?? false;
                        if (res)
                        {
                            _node.AddProfile(dialog.FileName);
                        }
                        return(VSConstants.S_OK);
                    }
                    }
                }
                else if (pguidCmdGroup == VSConstants.GUID_VSStandardCommandSet97)
                {
                    switch ((VSConstants.VSStd97CmdID)nCmdID)
                    {
                    case VSConstants.VSStd97CmdID.PropSheetOrProperties:
                        _node.OpenTargetProperties();
                        return(VSConstants.S_OK);
                    }
                }
                return((int)Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED);
            }