-
Notifications
You must be signed in to change notification settings - Fork 62
/
App.xaml.cs
32 lines (29 loc) · 1.1 KB
/
App.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
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
namespace CSharpMath.Avalonia.Example {
public class App : Application {
public override void Initialize() {
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted() {
switch (ApplicationLifetime) {
case IClassicDesktopStyleApplicationLifetime desktop:
desktop.MainWindow = new MainWindow();
break;
case ISingleViewApplicationLifetime singleView:
singleView.MainView = new MainView();
break;
}
base.OnFrameworkInitializationCompleted();
}
// This method is needed for IDE previewer infrastructure
public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<App>().UsePlatformDetect();
// The entry point. Things aren't ready yet, so at this point
// you shouldn't use any Avalonia types or anything that expects
// a SynchronizationContext to be ready
public static int Main(string[] args) =>
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
}