using System; using System.Windows; using System.Windows.Controls; namespace BetterSeewoManager; public partial class MainWindow : Window { private bool _isDarkTheme = true; public MainWindow() { InitializeComponent(); ApplyTheme(); ContentFrame.Navigate(new Uri("Pages/InstallPage.xaml", UriKind.Relative)); } private void Tab_Click(object sender, RoutedEventArgs e) { if (sender is RadioButton rb && rb.Tag is string pageName) { var pageUri = new Uri($"Pages/{pageName}.xaml", UriKind.Relative); ContentFrame.Navigate(pageUri); } } private void BtnThemeToggle_Click(object sender, RoutedEventArgs e) { _isDarkTheme = !_isDarkTheme; ApplyTheme(); } private void ApplyTheme() { var app = (App)Application.Current; app.Resources.MergedDictionaries.Clear(); app.Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(_isDarkTheme ? "Themes/DarkTheme.xaml" : "Themes/LightTheme.xaml", UriKind.Relative) }); BtnThemeToggle.Content = _isDarkTheme ? "☀️" : "🌙"; StatusText.Text = _isDarkTheme ? "已切换到深色主题" : "已切换到浅色主题"; } }