public CompareReportsWindow(CompareReportsView viewModel) { _viewModel = viewModel; InitializeComponent(); DataContext = viewModel; }
internal CompareReportsWindow(CompareReportsView viewModel) { _viewModel = viewModel; InitializeComponent(); DataContext = viewModel; }
public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { if (pguidCmdGroup == GuidList.guidPythonProfilingCmdSet) { 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 = _node._serviceProvider.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument; if (sod == null) { return VSConstants.E_FAIL; } 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 = PythonProfilingPackage.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; }
public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { if (pguidCmdGroup == GuidList.guidPythonProfilingCmdSet) { 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 = _node._serviceProvider.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument; if (sod == null) { return(VSConstants.E_FAIL); } 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 = PythonProfilingPackage.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); }