-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
39 lines (35 loc) · 1.13 KB
/
Copy pathApp.xaml.cs
File metadata and controls
39 lines (35 loc) · 1.13 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
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Avalonia.Styling;
namespace SkillChat.Client
{
public class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = SkillChatClientBootstrap.CreateMainWindow();
}
base.OnFrameworkInitializationCompleted();
}
/// <summary>
/// Switches the application theme between Dark and Light variants at runtime.
/// </summary>
/// <param name="isDark">True for Dark theme, false for Light theme.</param>
public static void SetThemeVariant(bool isDark)
{
if (Application.Current != null)
{
Application.Current.RequestedThemeVariant = isDark
? ThemeVariant.Dark
: ThemeVariant.Light;
}
}
}
}