7
7
using System . Windows . Controls ;
8
8
using System . Windows . Documents ;
9
9
using System . Windows . Navigation ;
10
- using EnvDTE ;
11
10
using Microsoft . CodeAnalysis . Diagnostics . Log ;
12
11
using Microsoft . VisualStudio . LanguageServices . Implementation . Utilities ;
13
12
using Roslyn . Utilities ;
14
13
using Microsoft . CodeAnalysis . Editor . Implementation . Preview ;
14
+ using IVsUIShell = Microsoft . VisualStudio . Shell . Interop . IVsUIShell ;
15
+ using OLECMDEXECOPT = Microsoft . VisualStudio . OLE . Interop . OLECMDEXECOPT ;
15
16
16
17
namespace Microsoft . VisualStudio . LanguageServices . Implementation . PreviewPane
17
18
{
@@ -24,7 +25,7 @@ internal partial class PreviewPane : UserControl, IDisposable
24
25
25
26
private readonly string _id ;
26
27
private readonly bool _logIdVerbatimInTelemetry ;
27
- private readonly DTE _dte ;
28
+ private readonly IVsUIShell _uiShell ;
28
29
29
30
private bool _isExpanded ;
30
31
private double _heightForThreeLineTitle ;
@@ -39,14 +40,14 @@ public PreviewPane(
39
40
string helpLinkToolTipText ,
40
41
IReadOnlyList < object > previewContent ,
41
42
bool logIdVerbatimInTelemetry ,
42
- DTE dte ,
43
+ IVsUIShell uiShell ,
43
44
Guid optionPageGuid = default ( Guid ) )
44
45
{
45
46
InitializeComponent ( ) ;
46
47
47
48
_id = id ;
48
49
_logIdVerbatimInTelemetry = logIdVerbatimInTelemetry ;
49
- _dte = dte ;
50
+ _uiShell = uiShell ;
50
51
51
52
// Initialize header portion.
52
53
if ( ( severityIcon != null ) && ! string . IsNullOrWhiteSpace ( id ) && ! string . IsNullOrWhiteSpace ( title ) )
@@ -358,7 +359,11 @@ private void OptionsButton_Click(object sender, RoutedEventArgs e)
358
359
{
359
360
if ( _optionPageGuid != default ( Guid ) )
360
361
{
361
- _dte . ExecuteCommand ( "Tools.Options" , _optionPageGuid . ToString ( ) ) ;
362
+ ErrorHandler . ThrowOnFailure ( _uiShell . PostExecCommand (
363
+ VSConstants . GUID_VSStandardCommandSet97 ,
364
+ ( uint ) VSConstants . VSStd97CmdID . ToolsOptions ,
365
+ ( uint ) OLECMDEXECOPT . OLECMDEXECOPT_DODEFAULT ,
366
+ _optionPageGuid . ToString ( ) ) ) ;
362
367
}
363
368
}
364
369
}
0 commit comments