提交记录修改Core/Models/Config/GeneralModel.cs+5 −1看文件
修改UI/Controls/Base/ColorSelect.cs+2 −0看文件
修改UI/Controls/SettingPanel/SettingPanel.cs+39 −0看文件
修改UI/Resources/Themes/Dark/Base/ColorSelect.xaml+1 −1看文件
修改UI/Resources/Themes/Dark/Charts/Charts.xaml+2 −2看文件
修改UI/Resources/Themes/Dark/Select/DateSelect.xaml+2 −2看文件
修改UI/Resources/Themes/Dark/Select/Select.xaml+26 −1看文件
修改UI/Resources/Themes/Dark/SettingPanel/SettingPanelItem.xaml+3 −1看文件
修改UI/Resources/Themes/Dark/SettingPanel/SettingPanelMultiItem.xaml+2 −2看文件
修改UI/Resources/Themes/Light/Base/ColorSelect.xaml+1 −1看文件
修改UI/Resources/Themes/Light/Charts/Charts.xaml+2 −2看文件
修改UI/Resources/Themes/Light/Select/DateSelect.xaml+1 −1看文件
修改UI/Resources/Themes/Light/Select/Select.xaml+27 −1看文件
修改UI/Resources/Themes/Light/SettingPanel/SettingPanelItem.xaml+4 −2看文件
修改UI/Resources/Themes/Light/SettingPanel/SettingPanelMultiItem.xaml+2 −2看文件
修改UI/Resources/Themes/Light/Toggle/Toggle.xaml+1 −1看文件
修改UI/Servicers/IThemeServicer.cs+1 −1看文件
修改UI/Servicers/ThemeServicer.cs+20 −4看文件
| @@ -22,7 +22,11 @@ namespace Core.Models.Config | ||
| 22 | 22 | /// </summary> |
| 23 | 23 | [Config(Options = "浅色|深色", Name = "主题模式", Description = "设置以浅色或深色模式显示", Group = "外观")] |
| 24 | 24 | public int Theme { get; set; } = 0; |
| 25 | 删除: | |
| 25 | 新增: /// <summary> | |
| 26 | 新增: /// 主题颜色 | |
| 27 | 新增: /// </summary> | |
| 28 | 新增: [Config(Name = "主题颜色", Description = "", Group = "外观")] | |
| 29 | 新增: public string ThemeColor { get; set; } | |
| 26 | 30 | /// <summary> |
| 27 | 31 | /// 是否保留界面大小 |
| 28 | 32 | /// </summary> |
| @@ -41,6 +41,7 @@ namespace UI.Controls.Base | ||
| 41 | 41 | { |
| 42 | 42 | control.Color = control.Colors[0]; |
| 43 | 43 | } |
| 44 | 新增: control.OnSelected?.Invoke(control, EventArgs.Empty); | |
| 44 | 45 | } |
| 45 | 46 | |
| 46 | 47 | public bool IsOpen |
| @@ -119,6 +120,7 @@ namespace UI.Controls.Base | ||
| 119 | 120 | |
| 120 | 121 | public Command ShowSelectCommand { get; set; } |
| 121 | 122 | public Command ColorSelectCommand { get; set; } |
| 123 | 新增: public event EventHandler OnSelected; | |
| 122 | 124 | |
| 123 | 125 | public ColorSelect() |
| 124 | 126 | { |
| @@ -330,9 +330,48 @@ namespace UI.Controls.SettingPanel | ||
| 330 | 330 | { |
| 331 | 331 | uIElement = RenderOptionsConfigControl(attribute, pi); |
| 332 | 332 | } |
| 333 | 新增: else if (pi.PropertyType == typeof(string)) | |
| 334 | 新增: { | |
| 335 | 新增: if (pi.Name.LastIndexOf("Color") != -1) | |
| 336 | 新增: { | |
| 337 | 新增: uIElement = RenderColorConfigControl(attribute, pi); | |
| 338 | 新增: } | |
| 339 | 新增: } | |
| 333 | 340 | return uIElement; |
| 334 | 341 | } |
| 335 | 342 | |
| 343 | 新增: /// <summary> | |
| 344 | 新增: /// 渲染颜色选择配置项 | |
| 345 | 新增: /// </summary> | |
| 346 | 新增: /// <param name="configAttribute"></param> | |
| 347 | 新增: /// <param name="pi"></param> | |
| 348 | 新增: /// <returns></returns> | |
| 349 | 新增: private UIElement RenderColorConfigControl(ConfigAttribute configAttribute, PropertyInfo pi) | |
| 350 | 新增: { | |
| 351 | 新增: var control = new Base.ColorSelect(); | |
| 352 | 新增: control.Color = (string)pi.GetValue(Data); | |
| 353 | 新增: control.OnSelected += (e, c) => | |
| 354 | 新增: { | |
| 355 | 新增: pi.SetValue(configData, control.Color); | |
| 356 | 新增: isCanRender = false; | |
| 357 | 新增: Data = configData; | |
| 358 | 新增: }; | |
| 359 | 新增: | |
| 360 | 新增: var item = new SettingPanelItem(); | |
| 361 | 新增: item.Name = configAttribute.Name; | |
| 362 | 新增: item.Description = configAttribute.Description; | |
| 363 | 新增: item.Content = control; | |
| 364 | 新增: | |
| 365 | 新增: pi.SetValue(configData, pi.GetValue(Data)); | |
| 366 | 新增: return item; | |
| 367 | 新增: } | |
| 368 | 新增: | |
| 369 | 新增: /// <summary> | |
| 370 | 新增: /// 渲染下拉选择配置项 | |
| 371 | 新增: /// </summary> | |
| 372 | 新增: /// <param name="configAttribute"></param> | |
| 373 | 新增: /// <param name="pi"></param> | |
| 374 | 新增: /// <returns></returns> | |
| 336 | 375 | private UIElement RenderOptionsConfigControl(ConfigAttribute configAttribute, PropertyInfo pi) |
| 337 | 376 | { |
| 338 | 377 | var control = new Select.Select(); |
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | <Popup |
| 21 | 21 | x:Name="Popup" |
| 22 | 22 | Placement="Bottom" |
| 23 | 删除: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ColorSelect}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" | |
| 23 | 新增: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ColorSelect}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" PopupAnimation="Slide" | |
| 24 | 24 | > |
| 25 | 25 | <Border |
| 26 | 26 | x:Name="SelectContainer" |
| @@ -209,7 +209,7 @@ | ||
| 209 | 209 | <Grid> |
| 210 | 210 | <Grid.ColumnDefinitions> |
| 211 | 211 | <ColumnDefinition Width="20"/> |
| 212 | 删除: <ColumnDefinition Width="30"/> | |
| 212 | 新增: <ColumnDefinition Width="20"/> | |
| 213 | 213 | <ColumnDefinition Width="auto"/> |
| 214 | 214 | <ColumnDefinition Width="auto"/> |
| 215 | 215 | |
| @@ -219,7 +219,7 @@ | ||
| 219 | 219 | </Border> |
| 220 | 220 | <Border Grid.Column="1"> |
| 221 | 221 | <!--图标--> |
| 222 | 删除: <base:Img Width="20" Height="20" URL="{Binding Icon}"/> | |
| 222 | 新增: <base:Img Width="16" Height="16" URL="{Binding Icon}"/> | |
| 223 | 223 | </Border> |
| 224 | 224 | <Border Grid.Column="2" Margin="5,0,0,0"> |
| 225 | 225 | <!--名称--> |
| @@ -36,7 +36,7 @@ | ||
| 36 | 36 | x:Name="Popup" |
| 37 | 37 | Placement="Bottom" |
| 38 | 38 | PlacementTarget="{Binding ElementName=Main}" |
| 39 | 删除: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" > | |
| 39 | 新增: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" PopupAnimation="Slide"> | |
| 40 | 40 | <Border |
| 41 | 41 | x:Name="SelectContainer" |
| 42 | 42 | CornerRadius="10" |
| @@ -159,7 +159,7 @@ | ||
| 159 | 159 | </Border> |
| 160 | 160 | |
| 161 | 161 | </WrapPanel> |
| 162 | 删除: | |
| 162 | 新增: | |
| 163 | 163 | </DataTemplate> |
| 164 | 164 | </ListView.ItemTemplate> |
| 165 | 165 | </ListView> |
| @@ -27,6 +27,11 @@ | ||
| 27 | 27 | <!--<TextBlock x:Name="PlaceholderText" Text="请选择" Visibility="Collapsed"/>--> |
| 28 | 28 | <base:Img x:Name="Img" URL="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Img}" Width="20" Height="20" VerticalAlignment="Center"/> |
| 29 | 29 | <TextBlock TextOptions.TextFormattingMode="Display" Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Name}" VerticalAlignment="Center" Margin="5,0,0,0"/> |
| 30 | 新增: <base:Icon x:Name="PopupIcon" Width="15" Height="15" Margin="5,0,0,0" FontSize="10" IconType="ChevronDown" VerticalAlignment="Center" RenderTransformOrigin=".5,.5"> | |
| 31 | 新增: <base:Icon.RenderTransform> | |
| 32 | 新增: <RotateTransform Angle="0" /> | |
| 33 | 新增: </base:Icon.RenderTransform> | |
| 34 | 新增: </base:Icon> | |
| 30 | 35 | </StackPanel> |
| 31 | 36 | </Border> |
| 32 | 37 | |
| @@ -34,7 +39,7 @@ | ||
| 34 | 39 | <Popup |
| 35 | 40 | Placement="Bottom" |
| 36 | 41 | PlacementTarget="{Binding ElementName=Main}" |
| 37 | 删除: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" StaysOpen="False"> | |
| 42 | 新增: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" StaysOpen="False" PopupAnimation="Slide"> | |
| 38 | 43 | <Border |
| 39 | 44 | CornerRadius="10" |
| 40 | 45 | BorderBrush="{DynamicResource WindowContentBorder}" |
| @@ -52,6 +57,26 @@ | ||
| 52 | 57 | </Border> |
| 53 | 58 | </Popup> |
| 54 | 59 | </Grid> |
| 60 | 新增: <VisualStateManager.VisualStateGroups> | |
| 61 | 新增: <VisualStateGroup x:Name="CommonStates"> | |
| 62 | 新增: <VisualStateGroup.Transitions> | |
| 63 | 新增: <VisualTransition GeneratedDuration="0:0:0.18" /> | |
| 64 | 新增: <VisualTransition GeneratedDuration="0" | |
| 65 | 新增: To="Pressed" /> | |
| 66 | 新增: </VisualStateGroup.Transitions> | |
| 67 | 新增: <VisualState x:Name="Normal" /> | |
| 68 | 新增: <VisualState x:Name="ShowPopup"> | |
| 69 | 新增: <Storyboard> | |
| 70 | 新增: <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(base:Icon.RenderTransform).(RotateTransform.Angle)" | |
| 71 | 新增: Storyboard.TargetName="PopupIcon"> | |
| 72 | 新增: <EasingDoubleKeyFrame KeyTime="0:0:0.18" | |
| 73 | 新增: Value="-180" /> | |
| 74 | 新增: | |
| 75 | 新增: </DoubleAnimationUsingKeyFrames> | |
| 76 | 新增: </Storyboard> | |
| 77 | 新增: </VisualState> | |
| 78 | 新增: </VisualStateGroup> | |
| 79 | 新增: </VisualStateManager.VisualStateGroups> | |
| 55 | 80 | </Border> |
| 56 | 81 | <ControlTemplate.Triggers> |
| 57 | 82 | <Trigger Property="IsMouseOver" Value="True"> |
| @@ -22,7 +22,9 @@ | ||
| 22 | 22 | <Grid> |
| 23 | 23 | <StackPanel VerticalAlignment="Center" HorizontalAlignment="Left"> |
| 24 | 24 | <TextBlock Text="{TemplateBinding Name}" FontSize="14" Foreground="{DynamicResource StandardTextBrush}"/> |
| 25 | 删除: <TextBlock Text="{TemplateBinding Description}" FontSize="12" Margin="0,4,0,0" Foreground="{DynamicResource SubTextBrush}"/> | |
| 25 | 新增: <base:View Value="{TemplateBinding Description}" Condition="not empty"> | |
| 26 | 新增: <TextBlock Text="{TemplateBinding Description}" FontSize="12" Margin="0,4,0,0" Foreground="{DynamicResource SubTextBrush}" VerticalAlignment="Center"/> | |
| 27 | 新增: </base:View> | |
| 26 | 28 | </StackPanel> |
| 27 | 29 | </Grid> |
| 28 | 30 | <Grid Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right"> |
| @@ -24,8 +24,8 @@ | ||
| 24 | 24 | <TextBlock Text="{TemplateBinding Title}" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="16" FontWeight="Bold"/> |
| 25 | 25 | |
| 26 | 26 | <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center"> |
| 27 | 删除: <btn:IconButton ToolTip="收起" x:Name="FoldBtn" Command="{TemplateBinding OnFoldAction}" Icon="ChevronUp" Margin="0"></btn:IconButton> | |
| 28 | 删除: <btn:IconButton Icon="Delete" Command="{TemplateBinding OnRemoveAction}" ToolTip="移除此项"></btn:IconButton> | |
| 27 | 新增: <btn:IconButton ToolTip="收起" x:Name="FoldBtn" FontSize="14" Command="{TemplateBinding OnFoldAction}" Icon="ChevronUp" Margin="0"></btn:IconButton> | |
| 28 | 新增: <btn:IconButton Icon="Delete" FontSize="14" Command="{TemplateBinding OnRemoveAction}" ToolTip="移除此项"></btn:IconButton> | |
| 29 | 29 | </StackPanel> |
| 30 | 30 | |
| 31 | 31 | </Grid> |
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | <Popup |
| 21 | 21 | x:Name="Popup" |
| 22 | 22 | Placement="Bottom" |
| 23 | 删除: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ColorSelect}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" | |
| 23 | 新增: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ColorSelect}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" PopupAnimation="Slide" | |
| 24 | 24 | > |
| 25 | 25 | <Border |
| 26 | 26 | x:Name="SelectContainer" |
| @@ -209,7 +209,7 @@ | ||
| 209 | 209 | <Grid> |
| 210 | 210 | <Grid.ColumnDefinitions> |
| 211 | 211 | <ColumnDefinition Width="20"/> |
| 212 | 删除: <ColumnDefinition Width="30"/> | |
| 212 | 新增: <ColumnDefinition Width="20"/> | |
| 213 | 213 | <ColumnDefinition Width="auto"/> |
| 214 | 214 | <ColumnDefinition Width="auto"/> |
| 215 | 215 | |
| @@ -219,7 +219,7 @@ | ||
| 219 | 219 | </Border> |
| 220 | 220 | <Border Grid.Column="1"> |
| 221 | 221 | <!--图标--> |
| 222 | 删除: <base:Img Width="20" Height="20" URL="{Binding Icon}"/> | |
| 222 | 新增: <base:Img Width="16" Height="16" URL="{Binding Icon}"/> | |
| 223 | 223 | </Border> |
| 224 | 224 | <Border Grid.Column="2" Margin="5,0,0,0"> |
| 225 | 225 | <!--名称--> |
| @@ -36,7 +36,7 @@ | ||
| 36 | 36 | x:Name="Popup" |
| 37 | 37 | Placement="Bottom" |
| 38 | 38 | PlacementTarget="{Binding ElementName=Main}" |
| 39 | 删除: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" > | |
| 39 | 新增: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" PopupAnimation="Slide"> | |
| 40 | 40 | <Border |
| 41 | 41 | x:Name="SelectContainer" |
| 42 | 42 | CornerRadius="10" |
| @@ -27,6 +27,12 @@ | ||
| 27 | 27 | <!--<TextBlock x:Name="PlaceholderText" Text="请选择" Visibility="Collapsed"/>--> |
| 28 | 28 | <base:Img x:Name="Img" URL="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Img}" Width="20" Height="20" VerticalAlignment="Center"/> |
| 29 | 29 | <TextBlock TextOptions.TextFormattingMode="Display" Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Name}" VerticalAlignment="Center" Margin="5,0,0,0"/> |
| 30 | 新增: <base:Icon x:Name="PopupIcon" Width="15" Height="15" Margin="5,0,0,0" FontSize="10" IconType="ChevronDown" VerticalAlignment="Center" RenderTransformOrigin=".5,.5"> | |
| 31 | 新增: <base:Icon.RenderTransform> | |
| 32 | 新增: <RotateTransform Angle="0" /> | |
| 33 | 新增: </base:Icon.RenderTransform> | |
| 34 | 新增: </base:Icon> | |
| 35 | 新增: | |
| 30 | 36 | </StackPanel> |
| 31 | 37 | </Border> |
| 32 | 38 | |
| @@ -34,7 +40,7 @@ | ||
| 34 | 40 | <Popup |
| 35 | 41 | Placement="Bottom" |
| 36 | 42 | PlacementTarget="{Binding ElementName=Main}" |
| 37 | 删除: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" StaysOpen="False"> | |
| 43 | 新增: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" StaysOpen="False" PopupAnimation="Slide"> | |
| 38 | 44 | <Border |
| 39 | 45 | CornerRadius="10" |
| 40 | 46 | BorderBrush="{DynamicResource WindowContentBorder}" |
| @@ -52,6 +58,26 @@ | ||
| 52 | 58 | </Border> |
| 53 | 59 | </Popup> |
| 54 | 60 | </Grid> |
| 61 | 新增: <VisualStateManager.VisualStateGroups> | |
| 62 | 新增: <VisualStateGroup x:Name="CommonStates"> | |
| 63 | 新增: <VisualStateGroup.Transitions> | |
| 64 | 新增: <VisualTransition GeneratedDuration="0:0:0.18" /> | |
| 65 | 新增: <VisualTransition GeneratedDuration="0" | |
| 66 | 新增: To="Pressed" /> | |
| 67 | 新增: </VisualStateGroup.Transitions> | |
| 68 | 新增: <VisualState x:Name="Normal" /> | |
| 69 | 新增: <VisualState x:Name="ShowPopup"> | |
| 70 | 新增: <Storyboard> | |
| 71 | 新增: <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(base:Icon.RenderTransform).(RotateTransform.Angle)" | |
| 72 | 新增: Storyboard.TargetName="PopupIcon"> | |
| 73 | 新增: <EasingDoubleKeyFrame KeyTime="0:0:0.18" | |
| 74 | 新增: Value="-180" /> | |
| 75 | 新增: | |
| 76 | 新增: </DoubleAnimationUsingKeyFrames> | |
| 77 | 新增: </Storyboard> | |
| 78 | 新增: </VisualState> | |
| 79 | 新增: </VisualStateGroup> | |
| 80 | 新增: </VisualStateManager.VisualStateGroups> | |
| 55 | 81 | </Border> |
| 56 | 82 | <ControlTemplate.Triggers> |
| 57 | 83 | <Trigger Property="IsMouseOver" Value="True"> |
| @@ -21,8 +21,10 @@ | ||
| 21 | 21 | |
| 22 | 22 | <Grid> |
| 23 | 23 | <StackPanel VerticalAlignment="Center" HorizontalAlignment="Left"> |
| 24 | 删除: <TextBlock Text="{TemplateBinding Name}" FontSize="14" Foreground="{DynamicResource StandardTextBrush}"/> | |
| 25 | 删除: <TextBlock Text="{TemplateBinding Description}" FontSize="12" Margin="0,4,0,0" Foreground="{DynamicResource SubTextBrush}"/> | |
| 24 | 新增: <TextBlock Text="{TemplateBinding Name}" FontSize="14" Foreground="{DynamicResource StandardTextBrush}" VerticalAlignment="Center"/> | |
| 25 | 新增: <base:View Value="{TemplateBinding Description}" Condition="not empty"> | |
| 26 | 新增: <TextBlock Text="{TemplateBinding Description}" FontSize="12" Margin="0,4,0,0" Foreground="{DynamicResource SubTextBrush}" VerticalAlignment="Center"/> | |
| 27 | 新增: </base:View> | |
| 26 | 28 | </StackPanel> |
| 27 | 29 | </Grid> |
| 28 | 30 | <Grid Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right"> |
| @@ -24,8 +24,8 @@ | ||
| 24 | 24 | <TextBlock Text="{TemplateBinding Title}" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="16" FontWeight="Bold"/> |
| 25 | 25 | |
| 26 | 26 | <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center"> |
| 27 | 删除: <btn:IconButton ToolTip="收起" x:Name="FoldBtn" Command="{TemplateBinding OnFoldAction}" Icon="ChevronUp" Margin="0"></btn:IconButton> | |
| 28 | 删除: <btn:IconButton Icon="Delete" Command="{TemplateBinding OnRemoveAction}" ToolTip="移除此项"></btn:IconButton> | |
| 27 | 新增: <btn:IconButton ToolTip="收起" x:Name="FoldBtn" FontSize="14" Command="{TemplateBinding OnFoldAction}" Icon="ChevronUp" Margin="0"></btn:IconButton> | |
| 28 | 新增: <btn:IconButton Icon="Delete" FontSize="14" Command="{TemplateBinding OnRemoveAction}" ToolTip="移除此项"></btn:IconButton> | |
| 29 | 29 | </StackPanel> |
| 30 | 30 | |
| 31 | 31 | </Grid> |
| @@ -74,7 +74,7 @@ | ||
| 74 | 74 | </Border> |
| 75 | 75 | <ControlTemplate.Triggers> |
| 76 | 76 | <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}" Value="True"> |
| 77 | 删除: <Setter TargetName="Button" Property="Background" Value="#2b20d9"/> | |
| 77 | 新增: <Setter TargetName="Button" Property="Background" Value="{DynamicResource ThemeBrush}"/> | |
| 78 | 78 | <Setter TargetName="Mark" Property="Background" Value="White"/> |
| 79 | 79 | <DataTrigger.EnterActions> |
| 80 | 80 | <BeginStoryboard> |
| @@ -9,7 +9,7 @@ namespace UI.Servicers | ||
| 9 | 9 | public interface IThemeServicer |
| 10 | 10 | { |
| 11 | 11 | void Init(); |
| 12 | 删除: void LoadTheme(string themeName); | |
| 12 | 新增: void LoadTheme(string themeName, bool isRefresh = false); | |
| 13 | 13 | void SetMainWindow(MainWindow mainWindow); |
| 14 | 14 | |
| 15 | 15 | void UpdateWindowStyle(); |
| @@ -4,10 +4,12 @@ using System; | ||
| 4 | 4 | using System.Collections.Generic; |
| 5 | 5 | using System.Collections.ObjectModel; |
| 6 | 6 | using System.Diagnostics; |
| 7 | 新增:using System.Drawing; | |
| 7 | 8 | using System.Linq; |
| 8 | 9 | using System.Text; |
| 9 | 10 | using System.Threading.Tasks; |
| 10 | 11 | using System.Windows; |
| 12 | 新增:using System.Windows.Media; | |
| 11 | 13 | using UI.ViewModels; |
| 12 | 14 | |
| 13 | 15 | namespace UI.Servicers |
| @@ -37,12 +39,17 @@ namespace UI.Servicers | ||
| 37 | 39 | { |
| 38 | 40 | LoadTheme(themeOptions[newConfig.General.Theme]); |
| 39 | 41 | } |
| 42 | 新增: | |
| 43 | 新增: if (oldConfig.General.ThemeColor != newConfig.General.ThemeColor) | |
| 44 | 新增: { | |
| 45 | 新增: LoadTheme(themeOptions[newConfig.General.Theme], true); | |
| 46 | 新增: } | |
| 40 | 47 | } |
| 41 | 48 | public void Init() |
| 42 | 49 | { |
| 43 | 50 | LoadTheme(themeOptions[appConfig.GetConfig().General.Theme]); |
| 44 | 51 | } |
| 45 | 删除: public void LoadTheme(string themeName) | |
| 52 | 新增: public void LoadTheme(string themeName, bool isRefresh = false) | |
| 46 | 53 | { |
| 47 | 54 | if (string.IsNullOrEmpty(themeName)) |
| 48 | 55 | { |
| @@ -50,7 +57,7 @@ namespace UI.Servicers | ||
| 50 | 57 | themeName = themeOptions[0]; |
| 51 | 58 | } |
| 52 | 59 | |
| 53 | 删除: if (themeName == this.themeName) | |
| 60 | 新增: if (themeName == this.themeName && !isRefresh) | |
| 54 | 61 | { |
| 55 | 62 | return; |
| 56 | 63 | } |
| @@ -76,15 +83,24 @@ namespace UI.Servicers | ||
| 76 | 83 | { |
| 77 | 84 | MergedDictionaries.Add(controlDict); |
| 78 | 85 | } |
| 86 | 新增: this.themeName = themeName; | |
| 79 | 87 | |
| 80 | 88 | UpdateWindowStyle(); |
| 81 | 删除: | |
| 82 | 删除: this.themeName = themeName; | |
| 89 | 新增: UpdateThemeColor(); | |
| 83 | 90 | |
| 84 | 91 | Debug.WriteLine("已加载主题:" + themeName); |
| 85 | 92 | } |
| 86 | 93 | |
| 94 | 新增: /// <summary> | |
| 95 | 新增: /// 刷新主题颜色 | |
| 96 | 新增: /// </summary> | |
| 97 | 新增: private void UpdateThemeColor() | |
| 98 | 新增: { | |
| 99 | 新增: var config = appConfig.GetConfig(); | |
| 87 | 100 | |
| 101 | 新增: Application.Current.Resources["ThemeColor"] = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(config.General.ThemeColor); | |
| 102 | 新增: Application.Current.Resources["ThemeBrush"] = UI.Base.Color.Colors.GetFromString(config.General.ThemeColor); | |
| 103 | 新增: } | |
| 88 | 104 | |
| 89 | 105 | public void SetMainWindow(MainWindow mainWindow) |
| 90 | 106 | { |

