Skip to content

Commit 9090c54

Browse files
Added Sentry and WebView2
1 parent d964d61 commit 9090c54

8 files changed

Lines changed: 60 additions & 33 deletions

File tree

VBAudioRouter.Host/Program.cs

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,45 @@
1-
using ShortDev.Uwp.FullTrust.Core.Xaml;
1+
using Sentry;
22
using System;
3-
using Windows.UI.Xaml;
3+
using System.Runtime.InteropServices;
44

55
namespace VBAudioRouter.Host
66
{
77
static class Program
88
{
99
[STAThread]
10-
static void Main()
10+
static void Main(string[] args)
1111
{
12-
XamlApplicationWrapper.Run<App, WelcomePage>(() =>
12+
using (SentrySdk.Init(o =>
1313
{
14-
Window.Current.GetSubclass().CloseRequested += Program_CloseRequested;
15-
});
14+
o.Dsn = "https://ba91eccb16f94401895d04e20e0db0f0@o646413.ingest.sentry.io/6409713";
15+
// When configuring for the first time, to see what the SDK is doing:
16+
o.Debug = true;
17+
// Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring.
18+
// We recommend adjusting this value in production.
19+
o.TracesSampleRate = 1.0;
20+
}))
21+
{
22+
try
23+
{
24+
VBAudioRouter.Program.WinMain(args);
25+
}
26+
catch (Exception ex)
27+
{
28+
MessageBox(IntPtr.Zero, ex.Message, "Error", MB_ICONERROR);
29+
throw;
30+
}
31+
}
1632
}
1733

18-
private static async void Program_CloseRequested(object sender, ShortDev.Uwp.FullTrust.Core.Xaml.Navigation.XamlWindowCloseRequestedEventArgs e)
19-
{
20-
var deferral = e.GetDeferral();
21-
e.Handled = await App.HandleCloseRequest();
22-
deferral.Complete();
23-
}
34+
const int MB_OKCANCEL = 0x00000001;
35+
const int MB_ICONERROR = 0x00000010;
36+
37+
[DllImport("user32.dll")]
38+
static extern void MessageBox(
39+
IntPtr hWnd,
40+
string text,
41+
string caption,
42+
uint type
43+
);
2444
}
25-
}
45+
}

VBAudioRouter.Host/Properties/launchSettings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"profiles": {
33
"XamlIslands (VBAudioRouter.Host)": {
44
"commandName": "Project",
5-
"commandLineArgs": "-ServerName:Microsoft.ZuneMusic.Appx48dcrcgzqqdshm3kf61t0cm5e9pyd6h6.mca",
65
"nativeDebugging": true
76
}
87
}
-36 KB
Binary file not shown.

VBAudioRouter.Host/VBAudioRouter.Host.csproj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
55
<TargetFramework>netcoreapp3.1</TargetFramework>
6-
<UseWindowsForms>true</UseWindowsForms>
76
<AssetTargetFallback>uap10.0.19041</AssetTargetFallback>
87
<TargetPlatformVersion>10.0.19041</TargetPlatformVersion>
98
<LangVersion>9</LangVersion>
@@ -18,18 +17,16 @@
1817
</PropertyGroup>
1918

2019
<ItemGroup>
21-
<PackageReference Include="Microsoft.Toolkit.Forms.UI.XamlHost" Version="6.1.2" />
22-
<PackageReference Include="Microsoft.UI.Xaml" Version="2.7.0" />
20+
<PackageReference Include="Microsoft.Toolkit.Win32.UI.SDK" Version="6.1.2" />
21+
<PackageReference Include="Sentry" Version="3.17.1" />
2322
</ItemGroup>
2423

2524
<ItemGroup>
2625
<ProjectReference Include="..\VBAudioRouter.UWP\VBAudioRouter.UWP.vbproj" />
2726
</ItemGroup>
2827

2928
<ItemGroup>
30-
<Reference Include="ShortDev.Uwp.FullTrust">
31-
<HintPath>ShortDev.Uwp.FullTrust.dll</HintPath>
32-
</Reference>
29+
<PackageReference Update="Microsoft.VCRTForwarders.140" Version="1.0.7" />
3330
</ItemGroup>
3431

3532
</Project>

VBAudioRouter.UWP/HelpPage.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
xmlns:local="using:VBAudioRouter"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
89
mc:Ignorable="d"
910
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1011

11-
<WebView Source="https://github.com/ShortDevelopment/VB-Audio-Router/wiki" />
12+
<controls:WebView2 Source="https://github.com/ShortDevelopment/VB-Audio-Router/wiki" />
1213
</Page>

VBAudioRouter.UWP/HelpPage.xaml.vb

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
' The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
2-
3-
Imports Windows.UI.WindowManagement
4-
Imports Windows.UI.Xaml.Hosting
5-
''' <summary>
6-
''' An empty page that can be used on its own or navigated to within a Frame.
7-
''' </summary>
1+
82
Public NotInheritable Class HelpPage
93
Inherits Page
104

11-
Private Async Sub HelpPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
12-
Dim window = Await AppWindow.TryCreateAsync()
13-
ElementCompositionPreview.SetAppWindowContent(window, New Button())
14-
window.TryShowAsync()
15-
End Sub
165
End Class

VBAudioRouter.UWP/Program.vb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Imports ShortDev.Uwp.FullTrust.Core.Xaml
2+
3+
Partial Public Class Program
4+
5+
Public Shared Sub WinMain(args As String())
6+
XamlApplicationWrapper.Run(Of App, WelcomePage)(Sub()
7+
AddHandler Window.Current.GetSubclass().CloseRequested, AddressOf Program_CloseRequested
8+
End Sub)
9+
End Sub
10+
11+
Private Shared Async Sub Program_CloseRequested(ByVal sender As Object, ByVal e As Navigation.XamlWindowCloseRequestedEventArgs)
12+
Dim deferral = e.GetDeferral()
13+
e.Handled = Await App.HandleCloseRequest()
14+
deferral.Complete()
15+
End Sub
16+
17+
End Class

VBAudioRouter.UWP/VBAudioRouter.UWP.vbproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
<Compile Include="Interop\IAudioEndpointVolumeCallback.vb" />
169169
<Compile Include="Interop\IAudioSessionEnumerator.vb" />
170170
<Compile Include="Interop\IAudioSessionManager.vb" />
171+
<Compile Include="Program.vb" />
171172
<Compile Include="SpeakerControlPage.xaml.vb">
172173
<DependentUpon>SpeakerControlPage.xaml</DependentUpon>
173174
</Compile>
@@ -453,6 +454,9 @@
453454
<PackageReference Include="Newtonsoft.Json">
454455
<Version>13.0.1</Version>
455456
</PackageReference>
457+
<PackageReference Include="ShortDev.Uwp.FullTrust">
458+
<Version>0.1.0</Version>
459+
</PackageReference>
456460
<PackageReference Include="UWPAudioVisualizer">
457461
<Version>1.0.38</Version>
458462
</PackageReference>

0 commit comments

Comments
 (0)