using Windows.UI.ViewManagement; using XFEExtension.NetCore.WinUIHelper.Utilities.Helper; namespace XFEWorkflow { /// /// 主窗体 /// public sealed partial class MainWindow : Window { public Services.TrayService? Tray { get; private set; } public static UISettings UISettings { get; set; } = new(); public MainWindow() { this.InitializeComponent(); ExtendsContentIntoTitleBar = true; AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets/appicon.ico")); AppWindow.TitleBar.PreferredHeightOption = Microsoft.UI.Windowing.TitleBarHeightOption.Tall; AppWindow.Resize(new Windows.Graphics.SizeInt32(1540, 980)); UpdateAccent(); UISettings.ColorValuesChanged += (_, _) => DispatcherQueue.TryEnqueue(() => { UpdateAccent(); AppThemeHelper.ChangeTheme(AppThemeHelper.Theme); }); } private static void UpdateAccent() => ((Microsoft.UI.Xaml.Media.SolidColorBrush)Application.Current.Resources["WorkflowAccentBrush"]).Color = UISettings.GetColorValue(UIColorType.Accent); public void InitializeTray() => Tray = new(this); } }