Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
54 lines (48 loc) · 1.47 KB
/
Copy pathProgram.cs
File metadata and controls
54 lines (48 loc) · 1.47 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Styling;
using Avalonia.Themes.Fluent;
namespace Scopie;
internal sealed class Program : Application
{
[STAThread]
private static int Main(string[] args)
{
TaskScheduler.UnobservedTaskException += (_, eventArgs) =>
{
ExceptionReporter.Report(eventArgs.Exception);
eventArgs.SetObserved();
};
return AppBuilder
.Configure<Program>()
.UseHarfBuzz()
.UseSkia()
.UseWayland()
.StartWithClassicDesktopLifetime(args);
}
public Program()
{
Styles.Add(new FluentTheme());
RequestedThemeVariant = ThemeVariant.Light;
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = MakeWindow();
ExceptionReporter.SetLifetime(desktop);
}
base.OnFrameworkInitializationCompleted();
}
private static Window MakeWindow()
{
var window = new Window { Title = "Scopie" };
ExceptionReporter.SetWindow(window);
window.Closing += (_, _) => ExceptionReporter.SetWindow(null);
var tabs = new TabControl();
window.Content = tabs;
_ = new MainTab(tabs);
return window;
}
}