跳到主要内容

github/tai

公开

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

提交记录
修改UI/Controls/Select/DateSelect.cs+26 −1看文件
@@ -39,6 +39,7 @@ namespace UI.Controls.Select
3939 return Day.Date > DateTime.Now.Date;
4040 }
4141 }
42新增: public bool IsDisabled { get; set; }
4243 }
4344 public class DateSelect : Control
4445 {
@@ -311,13 +312,37 @@ namespace UI.Controls.Select
311312 private void UpdateDays()
312313 {
313314 var list = new List<DayModel>();
315新增:
316新增: var startDay = new DateTime(Year, Month, 1);
317新增: var startWeekNum = (int)startDay.DayOfWeek;
318新增: startWeekNum = startWeekNum == 0 ? 7 : startWeekNum;
319新增: startWeekNum -= 1;
320新增:
321新增: // 该月天数
314322 int days = DateTime.DaysInMonth(Year, Month);
323新增: // 该月最后一天的日期
324新增: var lastDay = new DateTime(Year, Month, days);
325新增:
326新增: var preAppendDays = new List<DayModel>();
327新增: // 需要向前补日期
328新增: for (int i = startWeekNum; i > 0; i--)
329新增: {
330新增: var date = startDay.AddDays(-i);
331新增: preAppendDays.Add(new DayModel()
332新增: {
333新增: Day = date.Date,
334新增: IsDisabled = true,
335新增: });
336新增: }
337新增: list.AddRange(preAppendDays);
338新增:
339新增: // 当月日期
315340 for (int i = 1; i < days + 1; i++)
316341 {
317342 list.Add(new DayModel() { Day = new DateTime(Year, Month, i).Date });
318343 }
319删除: Days = list;
320344
345新增: Days = list;
321346 Day = list.Where(m => m.Day == SelectedDay).FirstOrDefault();
322347 }
323348
修改UI/Resources/Themes/Dark.xaml+3 −0看文件
@@ -118,4 +118,7 @@
118118 <Color x:Key="PlaceholderRectBgFlashColor">#4d4d4d</Color>
119119 <SolidColorBrush x:Key="PlaceholderRectBgFlashBrush" Color="{StaticResource PlaceholderRectBgFlashColor}" />
120120
121新增: <Color x:Key="DisabledTextColor">#504f4f</Color>
122新增: <SolidColorBrush x:Key="DisabledTextBrush" Color="{StaticResource DisabledTextColor}" />
123新增:
121124</ResourceDictionary>
文件末尾没有换行
修改UI/Resources/Themes/Light.xaml+6 −0看文件
@@ -116,4 +116,10 @@
116116 <SolidColorBrush x:Key="PlaceholderRectBgBrush" Color="{StaticResource PlaceholderRectBgColor}" />
117117 <Color x:Key="PlaceholderRectBgFlashColor">#ffffff</Color>
118118 <SolidColorBrush x:Key="PlaceholderRectBgFlashBrush" Color="{StaticResource PlaceholderRectBgFlashColor}" />
119新增:
120新增:
121新增: <!--禁用颜色-->
122新增: <Color x:Key="DisabledTextColor">#ccc</Color>
123新增: <SolidColorBrush x:Key="DisabledTextBrush" Color="{StaticResource DisabledTextColor}" />
124新增:
119125</ResourceDictionary>
文件末尾没有换行
修改UI/Themes/Select/DateSelect.xaml+121 −86看文件
@@ -3,6 +3,8 @@
33 xmlns:local="clr-namespace:UI.Controls.Select" xmlns:base="clr-namespace:UI.Controls.Base" xmlns:button="clr-namespace:UI.Controls.Button" xmlns:converter="clr-namespace:UI.Controls.Converters">
44 <converter:ToStringConverter x:Key="ToStringConverter"/>
55
6新增: <SolidColorBrush x:Key="ThemeLightBrush" Color="{DynamicResource ThemeColor}" Opacity=".1"/>
7新增:
68 <Style TargetType="{x:Type local:DateSelect}">
79 <Setter Property="SnapsToDevicePixels"
810 Value="true" />
@@ -42,7 +44,7 @@
4244 CornerRadius="10"
4345 BorderBrush="{DynamicResource PopupBorderBrush}"
4446 BorderThickness="1"
45删除: Background="{DynamicResource StandardBackgroundBrush2}" Padding="10" MaxHeight="300" Margin="10">
47新增: Background="{DynamicResource PopupBackgroundBrush}" Padding="10" Margin="10">
4648 <Border.Effect>
4749 <DropShadowEffect BlurRadius="10" ShadowDepth="2" Direction="315" Color="Gray" Opacity=".1"/>
4850 </Border.Effect>
@@ -63,15 +65,22 @@
6365 </Grid.ColumnDefinitions>
6466 <!--年份选择-->
6567 <StackPanel Orientation="Horizontal">
66删除: <button:IconButton Icon="Back" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetYearCommand}" CommandParameter="-1"/>
67删除: <TextBlock Width="50" Foreground="{DynamicResource StandardTextBrush}" TextAlignment="Center" Margin="5,0" VerticalAlignment="Center" Text="{TemplateBinding Year ,Converter= {StaticResource ToStringConverter}}"/>
68删除: <button:IconButton Icon="Forward" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetYearCommand}" CommandParameter="1"/>
68新增: <button:IconButton Icon="ChevronLeft" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetYearCommand}" CommandParameter="-1"/>
69新增: <TextBlock Width="50" Foreground="{DynamicResource StandardTextBrush}" TextAlignment="Center" Margin="5,0" VerticalAlignment="Center" >
70新增: <Run Text="{TemplateBinding Year ,Converter= {StaticResource ToStringConverter}}"/>
71新增: <Run Text="年"/>
72新增: </TextBlock>
73新增: <button:IconButton Icon="ChevronRight" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetYearCommand}" CommandParameter="1"/>
6974
7075 </StackPanel>
7176 <StackPanel Grid.Column="1" Orientation="Horizontal" x:Name="MonthSelect" Visibility="Collapsed">
72删除: <button:IconButton Icon="Back" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetMonthCommand}" CommandParameter="-1"/>
73删除: <TextBlock Width="30" Foreground="{DynamicResource StandardTextBrush}" TextAlignment="Center" Margin="5,0" VerticalAlignment="Center" Text="{TemplateBinding Month ,Converter= {StaticResource ToStringConverter}}"/>
74删除: <button:IconButton Icon="Forward" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetMonthCommand}" CommandParameter="1"/>
77新增: <button:IconButton Icon="ChevronLeft" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetMonthCommand}" CommandParameter="-1"/>
78新增: <TextBlock Width="30" Foreground="{DynamicResource StandardTextBrush}" TextAlignment="Center" Margin="5,0" VerticalAlignment="Center">
79新增: <Run Text="{TemplateBinding Month ,Converter= {StaticResource ToStringConverter}}"/>
80新增: <Run Text="月"/>
81新增: </TextBlock>
82新增:
83新增: <button:IconButton Icon="ChevronRight" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetMonthCommand}" CommandParameter="1"/>
7584
7685 </StackPanel>
7786 </Grid>
@@ -79,92 +88,118 @@
7988 </Border>
8089 <!--日选择-->
8190 <Border Grid.Row="1" Width="250" x:Name="DaySelect" Visibility="Collapsed">
82删除: <ListView ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=Days}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=Day,Mode=TwoWay}" Margin="0,10,0,0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
83删除: <!--<i:Interaction.Triggers>
84删除: <i:EventTrigger EventName="MouseLeftButtonUp">
85删除: <i:InvokeCommandAction Command="{Binding GotoDetailCommand}"
86删除: CommandParameter="{Binding SelectedItem}" />
87删除: </i:EventTrigger>
88删除: </i:Interaction.Triggers>-->
89删除: <ListBox.Resources>
90删除: <Style TargetType="{x:Type ListView}">
91删除: <Setter Property="OverridesDefaultStyle" Value="True"/>
92删除:
93删除: <Setter Property="Template">
94删除: <Setter.Value>
95删除: <ControlTemplate TargetType="{x:Type ListView}">
96删除: <Border>
97删除: <ItemsPresenter />
98删除: </Border>
99删除: </ControlTemplate>
100删除: </Setter.Value>
101删除: </Setter>
102删除: </Style>
103删除: <Style TargetType="{x:Type ListViewItem}">
104删除: <Setter Property="OverridesDefaultStyle" Value="True"/>
105删除: <Setter Property="Foreground" Value="{DynamicResource StandardTextBrush}"/>
106删除:
107删除: <Setter Property="Template">
108删除: <Setter.Value>
109删除: <ControlTemplate TargetType="{x:Type ListViewItem}">
110删除: <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="{DynamicResource StandardBackgroundBrush}" Margin="0,0,0,0" Padding="0" Width="35" Height="35" CornerRadius="5">
111删除: <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
112删除: </Border>
113删除: <ControlTemplate.Triggers>
114删除: <DataTrigger Binding="{Binding IsOut}" Value="True">
115删除: <Setter Property="Foreground" Value="#ccc"/>
116删除: <Setter Property="IsEnabled" Value="False"/>
117删除: </DataTrigger>
118删除: <DataTrigger Binding="{Binding IsToday}" Value="True">
119删除: <Setter TargetName="Border" Property="Background" Value="#FFF2F1FF"/>
120删除: <Setter Property="Foreground" Value="{DynamicResource ThemeBrush}"/>
121删除:
122删除: </DataTrigger>
123删除: <Trigger Property="IsMouseOver" Value="True">
124删除: <Setter TargetName="Border" Property="Background" Value="{DynamicResource HoverBackgroundBrush}"/>
125删除: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>-->
126删除:
127删除: </Trigger>
128删除: <Trigger Property="IsSelected" Value="True">
129删除: <Setter TargetName="Border" Property="Background" Value="{DynamicResource ThemeBrush}"/>
130删除: <Setter Property="Foreground" Value="White"/>
131删除:
132删除: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>-->
133删除:
134删除: </Trigger>
135删除: </ControlTemplate.Triggers>
136删除: </ControlTemplate>
137删除: </Setter.Value>
138删除: </Setter>
139删除:
140删除: </Style>
141删除: </ListBox.Resources>
142删除: <ListBox.ItemsPanel>
143删除: <ItemsPanelTemplate>
144删除: <WrapPanel/>
145删除: </ItemsPanelTemplate>
146删除: </ListBox.ItemsPanel>
147删除: <ListView.ItemTemplate>
148删除: <DataTemplate>
149删除:
150删除: <WrapPanel Orientation="Horizontal">
151删除: <Border >
152删除: <!--<Grid>
91新增: <Grid>
92新增: <Grid.RowDefinitions>
93新增: <RowDefinition Height="auto"/>
94新增: <RowDefinition Height="auto"/>
95新增: </Grid.RowDefinitions>
96新增: <Border Grid.Row="0" Margin="0,15,0,0" BorderBrush="{DynamicResource SettingPanelSpliteLineBrush}" BorderThickness="0,0,0,.5" Padding="0,0,0,10">
97新增: <Grid >
98新增: <Grid.ColumnDefinitions>
99新增: <ColumnDefinition Width="35"/>
100新增: <ColumnDefinition Width="35"/>
101新增: <ColumnDefinition Width="35"/>
102新增: <ColumnDefinition Width="35"/>
103新增: <ColumnDefinition Width="35"/>
104新增: <ColumnDefinition Width="35"/>
105新增: <ColumnDefinition Width="35"/>
106新增: </Grid.ColumnDefinitions>
107新增: <TextBlock Grid.Column="0" Text="一" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/>
108新增: <TextBlock Grid.Column="1" Text="二" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/>
109新增: <TextBlock Grid.Column="2" Text="三" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/>
110新增: <TextBlock Grid.Column="3" Text="四" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/>
111新增: <TextBlock Grid.Column="4" Text="五" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/>
112新增: <TextBlock Grid.Column="5" Text="六" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/>
113新增: <TextBlock Grid.Column="6" Text="日" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/>
114新增:
115新增: </Grid>
116新增: </Border>
117新增: <ListView Grid.Row="1" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=Days}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=Day,Mode=TwoWay}" Margin="0,10,0,0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
118新增: <ListBox.Resources>
119新增: <Style TargetType="{x:Type ListView}">
120新增: <Setter Property="OverridesDefaultStyle" Value="True"/>
121新增:
122新增: <Setter Property="Template">
123新增: <Setter.Value>
124新增: <ControlTemplate TargetType="{x:Type ListView}">
125新增: <Border>
126新增: <ItemsPresenter />
127新增: </Border>
128新增: </ControlTemplate>
129新增: </Setter.Value>
130新增: </Setter>
131新增: </Style>
132新增: <Style TargetType="{x:Type ListViewItem}">
133新增: <Setter Property="OverridesDefaultStyle" Value="True"/>
134新增: <Setter Property="Foreground" Value="{DynamicResource StandardTextBrush}"/>
135新增:
136新增: <Setter Property="Template">
137新增: <Setter.Value>
138新增: <ControlTemplate TargetType="{x:Type ListViewItem}">
139新增: <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="Transparent" Margin="0,0,0,0" Padding="0" Width="35" Height="35" CornerRadius="5">
140新增: <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
141新增: </Border>
142新增: <ControlTemplate.Triggers>
143新增: <DataTrigger Binding="{Binding IsOut}" Value="True">
144新增: <Setter Property="Foreground" Value="{DynamicResource DisabledTextBrush}"/>
145新增: <Setter Property="IsEnabled" Value="False"/>
146新增: </DataTrigger>
147新增: <DataTrigger Binding="{Binding IsDisabled}" Value="True">
148新增: <Setter Property="Foreground" Value="{DynamicResource DisabledTextBrush}"/>
149新增: <Setter Property="IsEnabled" Value="False"/>
150新增: </DataTrigger>
151新增: <DataTrigger Binding="{Binding IsToday}" Value="True">
152新增: <Setter TargetName="Border" Property="Background" Value="{StaticResource ThemeLightBrush}"/>
153新增: <Setter Property="Foreground" Value="{DynamicResource ThemeBrush}"/>
154新增:
155新增: </DataTrigger>
156新增: <Trigger Property="IsMouseOver" Value="True">
157新增: <Setter TargetName="Border" Property="Background" Value="{DynamicResource HoverBackgroundBrush}"/>
158新增: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>-->
159新增:
160新增: </Trigger>
161新增: <Trigger Property="IsSelected" Value="True">
162新增: <Setter TargetName="Border" Property="Background" Value="{DynamicResource ThemeBrush}"/>
163新增: <Setter Property="Foreground" Value="White"/>
164新增:
165新增: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>-->
166新增:
167新增: </Trigger>
168新增: </ControlTemplate.Triggers>
169新增: </ControlTemplate>
170新增: </Setter.Value>
171新增: </Setter>
172新增:
173新增: </Style>
174新增: </ListBox.Resources>
175新增: <ListBox.ItemsPanel>
176新增: <ItemsPanelTemplate>
177新增: <WrapPanel/>
178新增: </ItemsPanelTemplate>
179新增: </ListBox.ItemsPanel>
180新增: <ListView.ItemTemplate>
181新增: <DataTemplate>
182新增:
183新增: <WrapPanel Orientation="Horizontal">
184新增: <Border >
185新增: <!--<Grid>
153186 <base:View Value="{Binding IsToday}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-5,-5,0">
154187 <Rectangle RadiusX="10" RadiusY="10" Width="5" Height="5" Fill="Red"></Rectangle>
155188 </base:View>
156189 </Grid>-->
157删除: <TextBlock Text="{Binding DayText}" />
190新增: <TextBlock Text="{Binding DayText}" />
158191
159删除: </Border>
192新增: </Border>
193新增:
194新增: </WrapPanel>
195新增:
196新增: </DataTemplate>
197新增: </ListView.ItemTemplate>
198新增: </ListView>
199新增: </Grid>
160200
161删除: </WrapPanel>
162删除:
163删除: </DataTemplate>
164删除: </ListView.ItemTemplate>
165删除: </ListView>
166201 </Border>
167删除: <Border Grid.Row="2" HorizontalAlignment="Right">
202新增: <Border Grid.Row="2" HorizontalAlignment="Right" Margin="0,10,0,0">
168203 <StackPanel Orientation="Horizontal">
169204 <button:Button Content="确认" Width="100" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=DoneCommand}"/>
170205 </StackPanel>