2026-06-28 12:43:17 +08:00
|
|
|
using System;
|
2026-06-28 11:12:26 +08:00
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
2026-06-28 12:40:10 +08:00
|
|
|
namespace BetterSeewoManager;
|
|
|
|
|
|
|
|
|
|
public partial class MainWindow : Window
|
2026-06-28 11:12:26 +08:00
|
|
|
{
|
2026-06-28 12:43:17 +08:00
|
|
|
private bool _isDarkTheme = true;
|
|
|
|
|
|
2026-06-28 12:40:10 +08:00
|
|
|
public MainWindow()
|
2026-06-28 11:12:26 +08:00
|
|
|
{
|
2026-06-28 12:40:10 +08:00
|
|
|
InitializeComponent();
|
2026-06-28 12:43:17 +08:00
|
|
|
ApplyTheme();
|
|
|
|
|
ContentFrame.Navigate(new Uri("Pages/InstallPage.xaml", UriKind.Relative));
|
2026-06-28 12:40:10 +08:00
|
|
|
}
|
2026-06-28 11:12:26 +08:00
|
|
|
|
2026-06-28 12:40:10 +08:00
|
|
|
private void Tab_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (sender is RadioButton rb && rb.Tag is string pageName)
|
2026-06-28 11:12:26 +08:00
|
|
|
{
|
2026-06-28 12:43:17 +08:00
|
|
|
var pageUri = new Uri($"Pages/{pageName}.xaml", UriKind.Relative);
|
2026-06-28 12:40:10 +08:00
|
|
|
ContentFrame.Navigate(pageUri);
|
2026-06-28 11:12:26 +08:00
|
|
|
}
|
|
|
|
|
}
|
2026-06-28 12:43:17 +08:00
|
|
|
|
|
|
|
|
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 ? "已切换到深色主题" : "已切换到浅色主题";
|
|
|
|
|
}
|
2026-06-28 11:12:26 +08:00
|
|
|
}
|