atomui/packages/AtomUI/AppBuilderExtensions.cs

33 lines
954 B
C#
Raw Normal View History

using System.Globalization;
using AtomUI.Controls;
2024-09-03 12:00:24 +08:00
using AtomUI.Utils;
using Avalonia;
2024-07-30 00:14:36 +08:00
namespace AtomUI.Theme;
public static class AtomUIExtensions
{
public static AppBuilder ConfigureAtomUI(this AppBuilder builder)
{
builder.AfterSetup(builder =>
{
var themeManager = ThemeManager.Current;
themeManager.ConfigureAtomUIControls();
themeManager.Configure();
});
return builder;
}
2024-09-10 00:09:07 +08:00
public static AppBuilder UseAtomUI(this AppBuilder builder)
{
builder.AfterSetup(builder =>
{
var themeManager = ThemeManager.Current;
themeManager.CultureInfo = new CultureInfo(LanguageCode.en_US);
2024-09-10 00:09:07 +08:00
themeManager.LoadTheme(ThemeManager.DEFAULT_THEME_ID);
themeManager.SetActiveTheme(ThemeManager.DEFAULT_THEME_ID);
builder.Instance!.Styles.Add(themeManager);
});
return builder;
}
}