Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/WinDroid.Studio/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.UI.Xaml;
using Sentry;

namespace WinDroid.Studio;

Expand All @@ -7,16 +8,37 @@ namespace WinDroid.Studio;
/// </summary>
public partial class App : Application
{
private readonly IDisposable _sentry;
private Window? _window;

public App()
{
_sentry = SentrySdk.Init(options =>
{
options.Dsn = Environment.GetEnvironmentVariable("SENTRY_DSN");

#if DEBUG
options.Debug = true;
#else
options.Debug = false;
#endif

options.AutoSessionTracking = true;
});

InitializeComponent();
}

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
_window = new MainWindow();
_window.Closed += OnMainWindowClosed;
_window.Activate();
}
}

private async void OnMainWindowClosed(object sender, WindowEventArgs args)
{
await SentrySdk.FlushAsync(TimeSpan.FromSeconds(2));
_sentry.Dispose();
}
}
1 change: 1 addition & 0 deletions src/WinDroid.Studio/WinDroid.Studio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.2.0" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.28000.1721" />
<PackageReference Include="Sentry" Version="6.6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading