跳到主要内容

github/tai

公开

Tai · Windows 软件与网站使用时长统计。上游 Planshit/Tai 的源码镜像,非灵栈原创;MIT 许可。来源:https://github.com/Planshit/Tai 。本次为手动同步,暂不提供安装包。

提交记录
修改Core/Models/Config/GeneralModel.cs+5 −1看文件
@@ -22,7 +22,11 @@ namespace Core.Models.Config
2222 /// </summary>
2323 [Config(Options = "浅色|深色", Name = "主题模式", Description = "设置以浅色或深色模式显示", Group = "外观")]
2424 public int Theme { get; set; } = 0;
25删除:
25新增: /// <summary>
26新增: /// 主题颜色
27新增: /// </summary>
28新增: [Config(Name = "主题颜色", Description = "", Group = "外观")]
29新增: public string ThemeColor { get; set; }
2630 /// <summary>
2731 /// 是否保留界面大小
2832 /// </summary>
修改UI/Controls/Base/ColorSelect.cs+2 −0看文件
@@ -41,6 +41,7 @@ namespace UI.Controls.Base
4141 {
4242 control.Color = control.Colors[0];
4343 }
44新增: control.OnSelected?.Invoke(control, EventArgs.Empty);
4445 }
4546
4647 public bool IsOpen
@@ -119,6 +120,7 @@ namespace UI.Controls.Base
119120
120121 public Command ShowSelectCommand { get; set; }
121122 public Command ColorSelectCommand { get; set; }
123新增: public event EventHandler OnSelected;
122124
123125 public ColorSelect()
124126 {
修改UI/Controls/SettingPanel/SettingPanel.cs+39 −0看文件
@@ -330,9 +330,48 @@ namespace UI.Controls.SettingPanel
330330 {
331331 uIElement = RenderOptionsConfigControl(attribute, pi);
332332 }
333新增: else if (pi.PropertyType == typeof(string))
334新增: {
335新增: if (pi.Name.LastIndexOf("Color") != -1)
336新增: {
337新增: uIElement = RenderColorConfigControl(attribute, pi);
338新增: }
339新增: }
333340 return uIElement;
334341 }
335342
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>
336375 private UIElement RenderOptionsConfigControl(ConfigAttribute configAttribute, PropertyInfo pi)
337376 {
338377 var control = new Select.Select();
修改UI/Resources/Themes/Dark/Base/ColorSelect.xaml+1 −1看文件
@@ -20,7 +20,7 @@
2020 <Popup
2121 x:Name="Popup"
2222 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"
2424 >
2525 <Border
2626 x:Name="SelectContainer"
修改UI/Resources/Themes/Dark/Charts/Charts.xaml+2 −2看文件
@@ -209,7 +209,7 @@
209209 <Grid>
210210 <Grid.ColumnDefinitions>
211211 <ColumnDefinition Width="20"/>
212删除: <ColumnDefinition Width="30"/>
212新增: <ColumnDefinition Width="20"/>
213213 <ColumnDefinition Width="auto"/>
214214 <ColumnDefinition Width="auto"/>
215215
@@ -219,7 +219,7 @@
219219 </Border>
220220 <Border Grid.Column="1">
221221 <!--图标-->
222删除: <base:Img Width="20" Height="20" URL="{Binding Icon}"/>
222新增: <base:Img Width="16" Height="16" URL="{Binding Icon}"/>
223223 </Border>
224224 <Border Grid.Column="2" Margin="5,0,0,0">
225225 <!--名称-->
修改UI/Resources/Themes/Dark/Select/DateSelect.xaml+2 −2看文件
@@ -36,7 +36,7 @@
3636 x:Name="Popup"
3737 Placement="Bottom"
3838 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">
4040 <Border
4141 x:Name="SelectContainer"
4242 CornerRadius="10"
@@ -159,7 +159,7 @@
159159 </Border>
160160
161161 </WrapPanel>
162删除:
162新增:
163163 </DataTemplate>
164164 </ListView.ItemTemplate>
165165 </ListView>
修改UI/Resources/Themes/Dark/Select/Select.xaml+26 −1看文件
@@ -27,6 +27,11 @@
2727 <!--<TextBlock x:Name="PlaceholderText" Text="请选择" Visibility="Collapsed"/>-->
2828 <base:Img x:Name="Img" URL="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Img}" Width="20" Height="20" VerticalAlignment="Center"/>
2929 <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>
3035 </StackPanel>
3136 </Border>
3237
@@ -34,7 +39,7 @@
3439 <Popup
3540 Placement="Bottom"
3641 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">
3843 <Border
3944 CornerRadius="10"
4045 BorderBrush="{DynamicResource WindowContentBorder}"
@@ -52,6 +57,26 @@
5257 </Border>
5358 </Popup>
5459 </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>
5580 </Border>
5681 <ControlTemplate.Triggers>
5782 <Trigger Property="IsMouseOver" Value="True">
修改UI/Resources/Themes/Dark/SettingPanel/SettingPanelItem.xaml+3 −1看文件
@@ -22,7 +22,9 @@
2222 <Grid>
2323 <StackPanel VerticalAlignment="Center" HorizontalAlignment="Left">
2424 <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>
2628 </StackPanel>
2729 </Grid>
2830 <Grid Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right">
修改UI/Resources/Themes/Dark/SettingPanel/SettingPanelMultiItem.xaml+2 −2看文件
@@ -24,8 +24,8 @@
2424 <TextBlock Text="{TemplateBinding Title}" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="16" FontWeight="Bold"/>
2525
2626 <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>
2929 </StackPanel>
3030
3131 </Grid>
修改UI/Resources/Themes/Light/Base/ColorSelect.xaml+1 −1看文件
@@ -20,7 +20,7 @@
2020 <Popup
2121 x:Name="Popup"
2222 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"
2424 >
2525 <Border
2626 x:Name="SelectContainer"
修改UI/Resources/Themes/Light/Charts/Charts.xaml+2 −2看文件
@@ -209,7 +209,7 @@
209209 <Grid>
210210 <Grid.ColumnDefinitions>
211211 <ColumnDefinition Width="20"/>
212删除: <ColumnDefinition Width="30"/>
212新增: <ColumnDefinition Width="20"/>
213213 <ColumnDefinition Width="auto"/>
214214 <ColumnDefinition Width="auto"/>
215215
@@ -219,7 +219,7 @@
219219 </Border>
220220 <Border Grid.Column="1">
221221 <!--图标-->
222删除: <base:Img Width="20" Height="20" URL="{Binding Icon}"/>
222新增: <base:Img Width="16" Height="16" URL="{Binding Icon}"/>
223223 </Border>
224224 <Border Grid.Column="2" Margin="5,0,0,0">
225225 <!--名称-->
修改UI/Resources/Themes/Light/Select/DateSelect.xaml+1 −1看文件
@@ -36,7 +36,7 @@
3636 x:Name="Popup"
3737 Placement="Bottom"
3838 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">
4040 <Border
4141 x:Name="SelectContainer"
4242 CornerRadius="10"
修改UI/Resources/Themes/Light/Select/Select.xaml+27 −1看文件
@@ -27,6 +27,12 @@
2727 <!--<TextBlock x:Name="PlaceholderText" Text="请选择" Visibility="Collapsed"/>-->
2828 <base:Img x:Name="Img" URL="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Img}" Width="20" Height="20" VerticalAlignment="Center"/>
2929 <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新增:
3036 </StackPanel>
3137 </Border>
3238
@@ -34,7 +40,7 @@
3440 <Popup
3541 Placement="Bottom"
3642 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">
3844 <Border
3945 CornerRadius="10"
4046 BorderBrush="{DynamicResource WindowContentBorder}"
@@ -52,6 +58,26 @@
5258 </Border>
5359 </Popup>
5460 </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>
5581 </Border>
5682 <ControlTemplate.Triggers>
5783 <Trigger Property="IsMouseOver" Value="True">
修改UI/Resources/Themes/Light/SettingPanel/SettingPanelItem.xaml+4 −2看文件
@@ -21,8 +21,10 @@
2121
2222 <Grid>
2323 <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>
2628 </StackPanel>
2729 </Grid>
2830 <Grid Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right">
修改UI/Resources/Themes/Light/SettingPanel/SettingPanelMultiItem.xaml+2 −2看文件
@@ -24,8 +24,8 @@
2424 <TextBlock Text="{TemplateBinding Title}" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="16" FontWeight="Bold"/>
2525
2626 <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>
2929 </StackPanel>
3030
3131 </Grid>
修改UI/Resources/Themes/Light/Toggle/Toggle.xaml+1 −1看文件
@@ -74,7 +74,7 @@
7474 </Border>
7575 <ControlTemplate.Triggers>
7676 <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}"/>
7878 <Setter TargetName="Mark" Property="Background" Value="White"/>
7979 <DataTrigger.EnterActions>
8080 <BeginStoryboard>
修改UI/Servicers/IThemeServicer.cs+1 −1看文件
@@ -9,7 +9,7 @@ namespace UI.Servicers
99 public interface IThemeServicer
1010 {
1111 void Init();
12删除: void LoadTheme(string themeName);
12新增: void LoadTheme(string themeName, bool isRefresh = false);
1313 void SetMainWindow(MainWindow mainWindow);
1414
1515 void UpdateWindowStyle();
修改UI/Servicers/ThemeServicer.cs+20 −4看文件
@@ -4,10 +4,12 @@ using System;
44using System.Collections.Generic;
55using System.Collections.ObjectModel;
66using System.Diagnostics;
7新增:using System.Drawing;
78using System.Linq;
89using System.Text;
910using System.Threading.Tasks;
1011using System.Windows;
12新增:using System.Windows.Media;
1113using UI.ViewModels;
1214
1315namespace UI.Servicers
@@ -37,12 +39,17 @@ namespace UI.Servicers
3739 {
3840 LoadTheme(themeOptions[newConfig.General.Theme]);
3941 }
42新增:
43新增: if (oldConfig.General.ThemeColor != newConfig.General.ThemeColor)
44新增: {
45新增: LoadTheme(themeOptions[newConfig.General.Theme], true);
46新增: }
4047 }
4148 public void Init()
4249 {
4350 LoadTheme(themeOptions[appConfig.GetConfig().General.Theme]);
4451 }
45删除: public void LoadTheme(string themeName)
52新增: public void LoadTheme(string themeName, bool isRefresh = false)
4653 {
4754 if (string.IsNullOrEmpty(themeName))
4855 {
@@ -50,7 +57,7 @@ namespace UI.Servicers
5057 themeName = themeOptions[0];
5158 }
5259
53删除: if (themeName == this.themeName)
60新增: if (themeName == this.themeName && !isRefresh)
5461 {
5562 return;
5663 }
@@ -76,15 +83,24 @@ namespace UI.Servicers
7683 {
7784 MergedDictionaries.Add(controlDict);
7885 }
86新增: this.themeName = themeName;
7987
8088 UpdateWindowStyle();
81删除:
82删除: this.themeName = themeName;
89新增: UpdateThemeColor();
8390
8491 Debug.WriteLine("已加载主题:" + themeName);
8592 }
8693
94新增: /// <summary>
95新增: /// 刷新主题颜色
96新增: /// </summary>
97新增: private void UpdateThemeColor()
98新增: {
99新增: var config = appConfig.GetConfig();
87100
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新增: }
88104
89105 public void SetMainWindow(MainWindow mainWindow)
90106 {