- 新增 LightTheme.xaml 浅色主题资源 - 标题栏添加主题切换按钮(☀️/🌙) - Manager 支持深浅主题互换 - 发布 Manager.exe (292KB) 和 Installer.exe (171KB) - 插件安装包 Better-Seewo.2.0.0.exe (11.6MB)
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
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 ? "已切换到深色主题" : "已切换到浅色主题";
|
|
}
|
|
}
|