-
Notifications
You must be signed in to change notification settings - Fork 351
/
Copy pathMainWindow.xaml.cs
37 lines (30 loc) · 1.3 KB
/
MainWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using DevHome.Common.Extensions;
using DevHome.Common.Services;
using DevHome.Telemetry;
using DevHome.TelemetryEvents;
using Microsoft.UI.Xaml;
using Serilog;
namespace DevHome;
public sealed partial class MainWindow : WinUIEx.WindowEx
{
private readonly DateTime _mainWindowCreated;
public MainWindow()
{
InitializeComponent();
AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/DevHome.ico"));
Content = null;
Title = Application.Current.GetService<IAppInfoService>().GetAppNameLocalized();
_mainWindowCreated = DateTime.UtcNow;
}
private void MainWindow_Closed(object sender, WindowEventArgs args)
{
Application.Current.GetService<IExtensionService>().SignalStopExtensionsAsync();
TelemetryFactory.Get<ITelemetry>().Log("DevHome_MainWindow_Closed_Event", LogLevel.Critical, new DevHomeClosedEvent(_mainWindowCreated));
Log.Information("Terminating via MainWindow_Closed.");
// WinUI bug is causing a crash on shutdown when FailFastOnErrors is set to true (#51773592).
// Workaround by turning it off before shutdown.
App.Current.DebugSettings.FailFastOnErrors = false;
}
}