feat: 管理器支持深浅主题切换,发布 exe
- 新增 LightTheme.xaml 浅色主题资源 - 标题栏添加主题切换按钮(☀️/🌙) - Manager 支持深浅主题互换 - 发布 Manager.exe (292KB) 和 Installer.exe (171KB) - 插件安装包 Better-Seewo.2.0.0.exe (11.6MB)
This commit is contained in:
@@ -57,7 +57,12 @@
|
||||
<TextBlock Text="Better-Seewo" FontSize="18" FontWeight="SemiBold" Foreground="{StaticResource AccentBrush}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text=" 管理器" FontSize="14" Foreground="{StaticResource TextSecondaryBrush}" VerticalAlignment="Center" Margin="8,0,0,0"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="v2.0.0" FontSize="11" Foreground="{StaticResource TextSecondaryBrush}" HorizontalAlignment="Right" VerticalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<TextBlock Text="v2.0.0" FontSize="11" Foreground="{StaticResource TextSecondaryBrush}" VerticalAlignment="Center" Margin="0,0,12,0"/>
|
||||
<Button x:Name="BtnThemeToggle" Content="🌙" Width="28" Height="28" FontSize="14"
|
||||
Background="Transparent" Foreground="{StaticResource TextPrimaryBrush}" BorderThickness="0"
|
||||
Cursor="Hand" Click="BtnThemeToggle_Click"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
@@ -5,18 +6,42 @@ namespace BetterSeewoManager;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private bool _isDarkTheme = true;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
ContentFrame.Navigate(new System.Uri("Pages/InstallPage.xaml", System.UriKind.Relative));
|
||||
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 System.Uri($"Pages/{pageName}.xaml", System.UriKind.Relative);
|
||||
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 ? "已切换到深色主题" : "已切换到浅色主题";
|
||||
}
|
||||
}
|
||||
|
||||
25
Manager/Themes/LightTheme.xaml
Normal file
25
Manager/Themes/LightTheme.xaml
Normal file
@@ -0,0 +1,25 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<SolidColorBrush x:Key="BackgroundBrush" Color="#F5F5F5"/>
|
||||
<SolidColorBrush x:Key="SurfaceBrush" Color="#FFFFFF"/>
|
||||
<SolidColorBrush x:Key="CardBrush" Color="#FAFAFA"/>
|
||||
<SolidColorBrush x:Key="BorderBrush" Color="#E0E0E0"/>
|
||||
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#1A1A1A"/>
|
||||
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#666666"/>
|
||||
<SolidColorBrush x:Key="AccentBrush" Color="#7C6BF0"/>
|
||||
<SolidColorBrush x:Key="AccentHoverBrush" Color="#6A5AD8"/>
|
||||
<SolidColorBrush x:Key="SuccessBrush" Color="#4CAF50"/>
|
||||
<SolidColorBrush x:Key="WarningBrush" Color="#FF9800"/>
|
||||
<SolidColorBrush x:Key="DangerBrush" Color="#F44336"/>
|
||||
<SolidColorBrush x:Key="TabActiveBrush" Color="#7C6BF0"/>
|
||||
<SolidColorBrush x:Key="TabInactiveBrush" Color="#FFFFFF"/>
|
||||
<SolidColorBrush x:Key="ButtonSecondaryBrush" Color="#E8E8E8"/>
|
||||
|
||||
<CornerRadius x:Key="CornerRadiusSmall">4</CornerRadius>
|
||||
<CornerRadius x:Key="CornerRadiusMedium">8</CornerRadius>
|
||||
<CornerRadius x:Key="CornerRadiusLarge">12</CornerRadius>
|
||||
|
||||
<FontFamily x:Key="DefaultFont">Microsoft YaHei UI, Segoe UI</FontFamily>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user