Skip to content

Commit 0cad0ba

Browse files
author
Ravi Chande
committed
Revert "Revert "Merge pull request #20592 from sharwell/fix-options-page""
This reverts commit 64b95c6.
1 parent 6dedf00 commit 0cad0ba

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPane.xaml.cs

+10-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
using System.Windows.Controls;
88
using System.Windows.Documents;
99
using System.Windows.Navigation;
10-
using EnvDTE;
1110
using Microsoft.CodeAnalysis.Diagnostics.Log;
1211
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
1312
using Roslyn.Utilities;
1413
using Microsoft.CodeAnalysis.Editor.Implementation.Preview;
14+
using IVsUIShell = Microsoft.VisualStudio.Shell.Interop.IVsUIShell;
15+
using OLECMDEXECOPT = Microsoft.VisualStudio.OLE.Interop.OLECMDEXECOPT;
1516

1617
namespace Microsoft.VisualStudio.LanguageServices.Implementation.PreviewPane
1718
{
@@ -24,7 +25,7 @@ internal partial class PreviewPane : UserControl, IDisposable
2425

2526
private readonly string _id;
2627
private readonly bool _logIdVerbatimInTelemetry;
27-
private readonly DTE _dte;
28+
private readonly IVsUIShell _uiShell;
2829

2930
private bool _isExpanded;
3031
private double _heightForThreeLineTitle;
@@ -39,14 +40,14 @@ public PreviewPane(
3940
string helpLinkToolTipText,
4041
IReadOnlyList<object> previewContent,
4142
bool logIdVerbatimInTelemetry,
42-
DTE dte,
43+
IVsUIShell uiShell,
4344
Guid optionPageGuid = default(Guid))
4445
{
4546
InitializeComponent();
4647

4748
_id = id;
4849
_logIdVerbatimInTelemetry = logIdVerbatimInTelemetry;
49-
_dte = dte;
50+
_uiShell = uiShell;
5051

5152
// Initialize header portion.
5253
if ((severityIcon != null) && !string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(title))
@@ -358,7 +359,11 @@ private void OptionsButton_Click(object sender, RoutedEventArgs e)
358359
{
359360
if (_optionPageGuid != default(Guid))
360361
{
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()));
362367
}
363368
}
364369
}

0 commit comments

Comments
 (0)