Skip to content

Commit

Permalink
Use internal browser window (finally figured it out!)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikEJ committed May 15, 2024
1 parent d580af2 commit 24bc74b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.204",
"version": "8.0.205",
"rollForward": "disable"
}
}
25 changes: 21 additions & 4 deletions src/GUI/Shared/Handlers/DacpacAnalyzerHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using EFCorePowerTools.Handlers.ReverseEngineer;
using EFCorePowerTools.Helpers;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using RevEng.Common;

namespace EFCorePowerTools.Handlers
Expand Down Expand Up @@ -44,7 +45,10 @@ public async Task GenerateAsync(string path, bool isConnectionString)

await VS.StatusBar.ShowProgressAsync("Generating DACPAC Analysis report...", 3, 3);

ShowReport(reportPath);
if (File.Exists(reportPath))
{
await OpenVsWebBrowserAsync(reportPath);
}

Telemetry.TrackEvent("PowerTools.GenerateDacpacReport");
}
Expand All @@ -64,12 +68,25 @@ private async Task<string> GetDacpacReportAsync(string path, bool isConnectionSt
return await launcher.GetReportPathAsync(path, isConnectionString);
}

private void ShowReport(string path)
private void OpenWebBrowser(string path)
{
Process.Start(path);
}

private async Task OpenVsWebBrowserAsync(string path)
{
if (File.Exists(path))
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

var service = await VS.GetServiceAsync<SVsWebBrowsingService, IVsWebBrowsingService>();

if (service == null)
{
Process.Start(path);
OpenWebBrowser(path);
return;
}

service.Navigate(path, (uint)__VSWBNAVIGATEFLAGS.VSNWB_ForceNew, out var frame);
frame.Show();
}
}
}

0 comments on commit 24bc74b

Please sign in to comment.