兼容win7版应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

376 lines
19 KiB

<UserControl x:Class="AIK.Views.MenuPages.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:AIK.Views.MenuPages"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<!-- 淡蓝色主题颜色 -->
<Color x:Key="PrimaryBlue">#0078D7</Color>
<Color x:Key="LightBlue">#E3F2FD</Color>
<Color x:Key="SoftBlue">#BBDEFB</Color>
<Color x:Key="AccentBlue">#2196F3</Color>
<Color x:Key="BorderBlue">#90CAF9</Color>
<Color x:Key="TextDark">#1E3A5F</Color>
<Color x:Key="TextGray">#546E7A</Color>
<Color x:Key="BackgroundLight">#FAFBFC</Color>
<Color x:Key="HoverBlue">#E1F5FE</Color>
<Color x:Key="SelectedBlue">#F3F9FF</Color>
<Color x:Key="FocusBlue">#D4EDFF</Color>
<SolidColorBrush x:Key="PrimaryBlueBrush" Color="{StaticResource PrimaryBlue}"/>
<SolidColorBrush x:Key="LightBlueBrush" Color="{StaticResource LightBlue}"/>
<SolidColorBrush x:Key="SoftBlueBrush" Color="{StaticResource SoftBlue}"/>
<SolidColorBrush x:Key="AccentBlueBrush" Color="{StaticResource AccentBlue}"/>
<SolidColorBrush x:Key="BorderBlueBrush" Color="{StaticResource BorderBlue}"/>
<SolidColorBrush x:Key="TextDarkBrush" Color="{StaticResource TextDark}"/>
<SolidColorBrush x:Key="TextGrayBrush" Color="{StaticResource TextGray}"/>
<SolidColorBrush x:Key="BackgroundLightBrush" Color="{StaticResource BackgroundLight}"/>
<SolidColorBrush x:Key="HoverBlueBrush" Color="{StaticResource HoverBlue}"/>
<SolidColorBrush x:Key="SelectedBlueBrush" Color="{StaticResource SelectedBlue}"/>
<SolidColorBrush x:Key="FocusBlueBrush" Color="{StaticResource FocusBlue}"/>
<!-- 现代化下拉箭头图标 -->
<PathGeometry x:Key="ModernArrow">M 0,0 L 5,5 L 10,0 Z</PathGeometry>
<!-- 现代化下拉框模板 -->
<ControlTemplate x:Key="ModernComboBoxTemplate" TargetType="ComboBox">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- 主边框 -->
<Border x:Name="Border"
Grid.ColumnSpan="2"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6"
SnapsToDevicePixels="True"/>
<!-- 内容区域 -->
<ContentPresenter x:Name="ContentSite"
Grid.Column="0"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"/>
<!-- 下拉箭头按钮 -->
<ToggleButton x:Name="ToggleButton"
Grid.Column="1"
Background="Transparent"
BorderThickness="0"
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
Focusable="False"
Width="36">
<ToggleButton.Content>
<Path Data="{StaticResource ModernArrow}"
Fill="{StaticResource TextGrayBrush}"
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="12" Height="8"/>
</ToggleButton.Content>
</ToggleButton>
<!-- 下拉面板 -->
<Popup x:Name="Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
PopupAnimation="Slide"
VerticalOffset="4">
<Border x:Name="DropDownBorder"
Background="White"
BorderBrush="{StaticResource BorderBlueBrush}"
BorderThickness="1"
CornerRadius="6"
MaxHeight="300"
MinWidth="{TemplateBinding ActualWidth}">
<ScrollViewer VerticalScrollBarVisibility="Auto" Template="{StaticResource MyScrollViewer}">
<ItemsPresenter/>
</ScrollViewer>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource AccentBlueBrush}"/>
<Setter TargetName="Border" Property="Background" Value="{StaticResource HoverBlueBrush}"/>
<Setter TargetName="ToggleButton" Property="Background" Value="{StaticResource HoverBlueBrush}"/>
</Trigger>
<Trigger Property="IsDropDownOpen" Value="True">
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PrimaryBlueBrush}"/>
<Setter TargetName="Border" Property="Background" Value="White"/>
<Setter TargetName="ToggleButton" Property="Background" Value="{StaticResource FocusBlueBrush}"/>
<Setter TargetName="ToggleButton" Property="Content">
<Setter.Value>
<Path Data="{StaticResource ModernArrow}"
Fill="{StaticResource PrimaryBlueBrush}"
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="12" Height="8"
RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<RotateTransform Angle="180"/>
</Path.RenderTransform>
</Path>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PrimaryBlueBrush}"/>
<Setter TargetName="Border" Property="Background" Value="{StaticResource FocusBlueBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Background" Value="{StaticResource BackgroundLightBrush}"/>
<Setter TargetName="Border" Property="BorderBrush" Value="#E0E0E0"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- 现代化下拉框样式 -->
<Style x:Key="ModernComboBoxStyle" TargetType="ComboBox">
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="{StaticResource TextDarkBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource BorderBlueBrush}"/>
<Setter Property="BorderThickness" Value="1.5"/>
<Setter Property="Padding" Value="12,10"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="Segoe UI, system-ui, sans-serif"/>
<Setter Property="MinHeight" Value="40"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template" Value="{StaticResource ModernComboBoxTemplate}"/>
</Style>
<!-- 现代化下拉项样式 -->
<Style x:Key="ModernComboBoxItemStyle" TargetType="ComboBoxItem">
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="{StaticResource TextDarkBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="16,12"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="Segoe UI, system-ui, sans-serif"/>
<Setter Property="MinHeight" Value="44"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource LightBlueBrush}"/>
<Setter Property="Foreground" Value="{StaticResource PrimaryBlueBrush}"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{StaticResource SelectedBlueBrush}"/>
<Setter Property="Foreground" Value="{StaticResource PrimaryBlueBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" Value="{StaticResource SoftBlueBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 卡片样式 -->
<Style x:Key="ModernCardStyle" TargetType="Border">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="{StaticResource BorderBlueBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0,0,0,16"/>
</Style>
<!-- 标签样式 -->
<Style x:Key="ModernLabelStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource TextDarkBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="16,12,12,12"/>
<!--<Setter Property="Width" Value="100"/>-->
</Style>
<!-- 设置项容器样式 -->
<Style x:Key="ModernSettingItemStyle" TargetType="Grid">
<Setter Property="Margin" Value="0,12"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="PrimaryButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#90CAF9"/>
<!-- 更淡的蓝 -->
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="24,12"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="6"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1E88E5"/>
<!-- 悬停用稍深一点的 Blue 600 -->
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#1976D2"/>
<!-- 按下回到你的标题色 -->
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#B0BEC5"/>
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid Margin="10,10,20,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 页面标题 -->
<StackPanel Grid.Row="0" Margin="0,0,0,20">
<TextBlock Text="{DynamicResource AppSettings}"
FontSize="16"
FontWeight="Bold"
Foreground="{StaticResource TextDarkBrush}"/>
<TextBlock Text="{DynamicResource AppSettingsDescription}"
FontSize="12"
Foreground="{StaticResource TextGrayBrush}"
Margin="0,4,0,0"/>
</StackPanel>
<!-- 设置内容区域 -->
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" Template="{StaticResource MyScrollViewer}">
<StackPanel>
<!-- 界面设置卡片 -->
<Border Style="{StaticResource ModernCardStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 卡片标题 -->
<Border Grid.Row="0"
Background="{StaticResource LightBlueBrush}"
CornerRadius="8,8,0,0"
Padding="16,12">
<TextBlock Text="{DynamicResource InterfaceSettings}"
FontSize="15"
FontWeight="SemiBold"
Foreground="{StaticResource PrimaryBlueBrush}"/>
</Border>
<!-- 设置内容 -->
<StackPanel Grid.Row="1" Margin="0,8">
<!-- 语言设置 -->
<Grid Style="{StaticResource ModernSettingItemStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="{DynamicResource InterfaceLanguage}"
Style="{StaticResource ModernLabelStyle}"/>
<!-- 现代化下拉框 -->
<ComboBox Grid.Column="1"
Style="{StaticResource ModernComboBoxStyle}"
ItemContainerStyle="{StaticResource ModernComboBoxItemStyle}"
ItemsSource="{Binding SupLanguageItems}"
SelectedItem="{Binding SelectedLanguage, Mode=TwoWay}"
SelectedIndex="0"
Width="200"
HorizontalAlignment="Left"
Margin="0,0,16,0">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0" VerticalAlignment="Center">
<TextBlock Text="{Binding FlagEmoji}"
FontSize="16"
Margin="0,0,12,0"
VerticalAlignment="Center"/>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="{Binding NativeName}"
FontWeight="SemiBold"
FontSize="14"/>
<TextBlock Text="{Binding Name}"
Foreground="{StaticResource TextGrayBrush}"
FontSize="11"
Margin="0,2,0,0"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</StackPanel>
</Grid>
</Border>
<!-- 缓存设置卡片 -->
<Border Style="{StaticResource ModernCardStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 卡片标题 -->
<Border Grid.Row="0"
Background="{StaticResource LightBlueBrush}"
CornerRadius="8,8,0,0"
Padding="16,12">
<TextBlock Text="{DynamicResource CacheSettings}"
FontSize="15"
FontWeight="SemiBold"
Foreground="{StaticResource PrimaryBlueBrush}"/>
</Border>
<!-- 设置内容 -->
<StackPanel Grid.Row="1" Margin="0,8">
<!-- 缓存设置 -->
<Button Content="{DynamicResource ClearCache}" Command="{Binding ClearAllCacheCommand}" Style="{StaticResource PrimaryButtonStyle}" Margin="20,0,0,0" HorizontalAlignment="Left"/>
</StackPanel>
</Grid>
</Border>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>