跳到主要内容

github/tai

公开

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

浏览文件

CategoryPage.xaml

384 行 · 24.5 KB历史下载
1<c:TPage x:Class="UI.Views.CategoryPage"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6 xmlns:local="clr-namespace:UI.Views" xmlns:base="clr-namespace:UI.Controls.Base" xmlns:Button="clr-namespace:UI.Controls.Button" xmlns:input="clr-namespace:UI.Controls.Input" xmlns:select="clr-namespace:UI.Controls.Select"
7 mc:Ignorable="d"
8 xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:converter="clr-namespace:UI.Controls.Converters"
9 xmlns:c="clr-namespace:UI.Controls"
10 d:DesignHeight="450" d:DesignWidth="800"
11 Title="CategoryPage" Foreground="{DynamicResource StandardTextBrush}" IsFillPage="True"
12 xmlns:toggle="clr-namespace:UI.Controls.Toggle" xmlns:list="clr-namespace:UI.Controls.List">
13
14
15 <Grid>
16
17 <!--编辑-->
18 <Grid Visibility="{Binding EditVisibility}" Panel.ZIndex="2" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
19 <Border Background="Black" Opacity=".7" CornerRadius="2"/>
20 <Border Width="{Binding ElementName=EditBorder,Path=ActualWidth}" Height="{Binding ElementName=EditBorder,Path=ActualHeight}" Background="{Binding ElementName=EditBorder,Path=Background}" CornerRadius="{Binding ElementName=EditBorder,Path=CornerRadius}">
21 <Border.Effect>
22 <DropShadowEffect BlurRadius="30" Direction="0" ShadowDepth="0" Opacity=".2" Color="{DynamicResource ThemeColor}"/>
23 </Border.Effect>
24 </Border>
25 <Border x:Name="EditBorder" MaxWidth="400" MaxHeight="350" Background="{DynamicResource StandardBackgroundBrush2}" CornerRadius="10" BorderBrush="{DynamicResource WindowContentBorder}" BorderThickness="1" >
26
27 <Grid>
28 <Grid.RowDefinitions>
29 <RowDefinition Height="40"/>
30 <RowDefinition Height="*"/>
31 <RowDefinition Height="80"/>
32
33 </Grid.RowDefinitions>
34 <Grid>
35 <StackPanel Orientation="Horizontal" Margin="10,0,0,0">
36 <base:Text Content="?创建:编辑" Value="{Binding IsCreate}" VerticalAlignment="Center" />
37 <TextBlock VerticalAlignment="Center" >
38 <Run Text="{Binding ShowType.Name}"/><Run Text="分类"/>
39 </TextBlock>
40 </StackPanel>
41 <Button:IconButton Foreground="#ccc" Icon="ChromeClose" HorizontalAlignment="Right" FontSize="12" Margin="0,0,10,0" Command="{Binding EditCloseCommand}"/>
42 </Grid>
43 <!--<TextBlock Text="编辑" VerticalAlignment="Center" Margin="10,0,0,0"/>-->
44 <ScrollViewer Grid.Row="1">
45 <StackPanel Grid.Row="1" Margin="10">
46 <TextBlock Text="分类名称"/>
47
48 <Grid>
49 <Grid.ColumnDefinitions>
50 <ColumnDefinition Width="auto"/>
51 <ColumnDefinition Width="*"/>
52 </Grid.ColumnDefinitions>
53 <base:ColorSelect Color="{Binding EditColor,Mode=TwoWay}" ToolTip="选择分类颜色" HorizontalAlignment="Left" Margin="0,10,0,0" />
54
55 <input:InputBox Grid.Column="1" Error="{Binding EditErrorText}" IsShowError="{Binding IsEditError,Mode=TwoWay}" Text="{Binding EditName,Mode=TwoWay}" MaxLength="10" Margin="5,10,0,0" Placeholder="请输入分类名称"/>
56 </Grid>
57 <TextBlock Text="图标" Margin="0,10,0,0"/>
58 <base:IconSelect URL="{Binding EditIconFile,Mode=TwoWay}" HorizontalAlignment="Left" Margin="0,10,0,0" />
59 <base:View Condition="=0" Value="{Binding ShowType.Id}">
60 <StackPanel>
61 <Border Margin="0,10,0,0">
62 <toggle:Toggle IsChecked="{Binding EditIsDirectoryMath,Mode=TwoWay}" TextPosition="Left" OnText="目录匹配" OffText="目录匹配"></toggle:Toggle>
63 </Border>
64 <base:View Condition="True" Value="{Binding EditIsDirectoryMath}">
65 <StackPanel Margin="0,10,0,0">
66 <Button:Button HorizontalAlignment="Right" Width="100" Command="{Binding AddDirectoryCommand}">添加目录</Button:Button>
67 <list:BaseList Items="{Binding EditDirectories}" SelectedItem="{Binding EditSelectedDirectory,Mode=TwoWay}">
68 <list:BaseList.ContextMenu>
69 <ContextMenu>
70 <MenuItem Header="移除" Command="{Binding DirectoriesCommand}" CommandParameter="remove"/>
71 </ContextMenu>
72 </list:BaseList.ContextMenu>
73 </list:BaseList>
74 </StackPanel>
75 </base:View>
76 </StackPanel>
77 </base:View>
78
79
80 </StackPanel>
81 </ScrollViewer>
82 <Button:Button Grid.Row="2" HorizontalAlignment="Right" Text="?创建:更新" Value="{Binding IsCreate}" Width="120" Margin="0,0,10,0" VerticalAlignment="Center" Command="{Binding EditDoneCommand}">
83
84 </Button:Button>
85
86
87 </Grid>
88
89 </Border>
90 </Grid>
91
92
93 <!--主内容-->
94 <Grid Margin="20" Background="Transparent">
95 <Grid.RowDefinitions>
96 <RowDefinition Height="auto"/>
97 <RowDefinition Height="*"/>
98 </Grid.RowDefinitions>
99 <Grid.ContextMenu>
100 <ContextMenu>
101 <MenuItem Header="刷新" Command="{Binding RefreshCommand}" />
102 <Separator/>
103 <MenuItem Header="新建分类" Command="{Binding EditCommand}" />
104 </ContextMenu>
105 </Grid.ContextMenu>
106 <StackPanel>
107 <StackPanel Orientation="Horizontal" Margin="0,5,0,20" >
108 <TextBlock Text="分类" FontSize="18" VerticalAlignment="Center"/>
109 <select:Select Margin="10,0,0,0" VerticalAlignment="Top" Padding="10,5" IsShowIcon="False" SelectedItem="{Binding ShowType,Mode=TwoWay}" Options="{Binding ShowTypeOptions}"/>
110 </StackPanel>
111 <!--<TextBlock Text="管理所有应用分类"/>-->
112 <Button:Button Icon="CalculatorAddition" Content="新建分类" HorizontalAlignment="Right" Margin="0,0,20,0" Width="150" Command="{Binding EditCommand}"/>
113 </StackPanel>
114
115 <TabControl
116 SelectedIndex="{Binding ShowType.Id}"
117 BorderThickness="0"
118 Margin="0,10,0,0"
119 Padding="0"
120 Background="Transparent"
121 Grid.Row="1"
122 >
123 <TabControl.Resources>
124 <Style TargetType="TabItem">
125 <Setter Property="Template">
126 <Setter.Value>
127 <ControlTemplate TargetType="TabItem">
128 </ControlTemplate>
129 </Setter.Value>
130 </Setter>
131 </Style>
132
133 </TabControl.Resources>
134 <TabItem>
135 <!--应用分类-->
136 <!--<ScrollViewer>-->
137 <!--<StackPanel>-->
138 <Grid>
139 <base:View Condition="empty" Value="{Binding Data}">
140 <base:EmptyData/>
141 </base:View>
142
143 <ListView Margin="10,20,10,0" ItemsSource="{Binding Data}" SelectedItem="{Binding SelectedAppCategoryItem,Mode=TwoWay}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
144 <i:Interaction.Triggers>
145 <i:EventTrigger EventName="MouseLeftButtonUp">
146 <i:InvokeCommandAction Command="{Binding GotoListCommand}"
147 CommandParameter="{Binding SelectedAppCategoryItem}" />
148 </i:EventTrigger>
149 </i:Interaction.Triggers>
150
151 <ListView.ContextMenu>
152 <ContextMenu>
153 <MenuItem Header="查看分类应用列表" Command="{Binding GotoListCommand}" CommandParameter="{Binding SelectedAppCategoryItem}"/>
154
155 <MenuItem Header="编辑" Command="{Binding EditCommand}" CommandParameter="{Binding SelectedAppCategoryItem}"/>
156 <MenuItem Header="删除分类" Command="{Binding DelCommand}" CommandParameter="{Binding SelectedAppCategoryItem}"/>
157 </ContextMenu>
158 </ListView.ContextMenu>
159 <ListBox.Resources>
160 <converter:HextoColorConverter x:Key="HextoColorConverter"/>
161
162 <Style TargetType="{x:Type ListView}">
163 <Setter Property="OverridesDefaultStyle" Value="True"/>
164
165 <Setter Property="Template">
166 <Setter.Value>
167 <ControlTemplate TargetType="{x:Type ListView}">
168 <ScrollViewer>
169 <Border>
170 <ItemsPresenter />
171 </Border>
172 </ScrollViewer>
173 </ControlTemplate>
174 </Setter.Value>
175 </Setter>
176 </Style>
177 <Style TargetType="{x:Type ListViewItem}">
178 <Setter Property="OverridesDefaultStyle" Value="True"/>
179 <Setter Property="Template">
180 <Setter.Value>
181 <ControlTemplate TargetType="{x:Type ListViewItem}">
182 <Grid>
183 <Border BorderBrush="{Binding ElementName=Border,Path=BorderBrush}" BorderThickness="{Binding ElementName=Border,Path=BorderThickness}" Margin="{Binding ElementName=Border,Path=Margin}" CornerRadius="{Binding ElementName=Border,Path=CornerRadius}">
184 <Border.Effect>
185 <DropShadowEffect Color="#d8d2d2" BlurRadius="10" Direction="300" ShadowDepth="4" Opacity="0.1" RenderingBias="Performance" ></DropShadowEffect>
186 </Border.Effect>
187 </Border>
188 <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="{DynamicResource StandardBackgroundBrush}" Margin="5" CornerRadius="20">
189 <ContentPresenter/>
190 </Border>
191 </Grid>
192
193 <ControlTemplate.Triggers>
194 <Trigger Property="IsMouseOver" Value="True">
195 <!--<Setter TargetName="Border" Property="Background" Value="#FFE8E6FF"/>-->
196 <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ThemeBrush}"/>
197
198 </Trigger>
199 </ControlTemplate.Triggers>
200 </ControlTemplate>
201 </Setter.Value>
202 </Setter>
203
204 </Style>
205 </ListBox.Resources>
206 <ListBox.ItemsPanel>
207 <ItemsPanelTemplate>
208 <WrapPanel/>
209 </ItemsPanelTemplate>
210 </ListBox.ItemsPanel>
211 <ListView.ItemTemplate>
212 <DataTemplate>
213
214
215 <WrapPanel Orientation="Vertical">
216 <Border Width="160" Height="160">
217
218 <Grid>
219 <Grid.RowDefinitions>
220 <RowDefinition Height="50"/>
221
222 <RowDefinition Height="40"/>
223 <RowDefinition Height="30"/>
224 <RowDefinition Height="*"/>
225
226 </Grid.RowDefinitions>
227 <Rectangle HorizontalAlignment="Left" Margin="10" VerticalAlignment="Top" RadiusX="20" RadiusY="20" Width="15" Height="15" Fill="{Binding Data.Color,Converter={StaticResource HextoColorConverter}}"/>
228 <base:View Value="{Binding Data.IsDirectoryMath}">
229 <Border Background="{DynamicResource ThemeBrush}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="10" Padding="8,0" CornerRadius="10" Height="20">
230 <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="10" Foreground="White" Text="目录匹配"></TextBlock>
231 </Border>
232 </base:View>
233 <Grid Grid.Row="1">
234
235 <base:Img Radius="8" Width="40" Height="40" URL="{Binding Data.IconFile}"/>
236 </Grid>
237 <TextBlock Foreground="{DynamicResource StandardTextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Text="{Binding Data.Name}" FontSize="14" FontWeight="Bold"/>
238
239 <Border Grid.Row="3" >
240 <Border Margin="10,0,10,0" CornerRadius="10" Background="{DynamicResource CategoryAppNumBgBrush}" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="10,5" ToolTip="分类应用数量">
241 <TextBlock Foreground="{DynamicResource DefaultTextBrush}">
242 <Run Text="×"/>
243
244 <Run Text="{Binding Count}"/>
245 </TextBlock>
246
247 </Border>
248
249 </Border>
250 </Grid>
251 </Border>
252
253 </WrapPanel>
254 </DataTemplate>
255 </ListView.ItemTemplate>
256 </ListView>
257 </Grid>
258 <!--</StackPanel>-->
259 <!--</ScrollViewer>-->
260 </TabItem>
261 <TabItem>
262 <!--网页分类-->
263 <ScrollViewer>
264 <StackPanel>
265 <base:View Condition="empty" Value="{Binding WebCategoryData}">
266 <base:EmptyData/>
267 </base:View>
268
269 <ListView Margin="10,20,10,0" ItemsSource="{Binding WebCategoryData}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectedItem="{Binding SelectedWebCategoryItem,Mode=TwoWay}">
270 <i:Interaction.Triggers>
271 <i:EventTrigger EventName="MouseLeftButtonUp">
272 <i:InvokeCommandAction Command="{Binding GotoListCommand}"
273 CommandParameter="{Binding SelectedWebCategoryItem}" />
274 </i:EventTrigger>
275 </i:Interaction.Triggers>
276
277 <ListView.ContextMenu>
278 <ContextMenu>
279 <MenuItem Header="查看网站列表" Command="{Binding GotoListCommand}" CommandParameter="{Binding SelectedWebCategoryItem}"/>
280
281 <MenuItem Header="编辑" Command="{Binding EditCommand}" CommandParameter="{Binding SelectedWebCategoryItem}"/>
282 <MenuItem Header="删除分类" Command="{Binding DelCommand}" CommandParameter="{Binding SelectedWebCategoryItem}"/>
283 </ContextMenu>
284 </ListView.ContextMenu>
285 <ListBox.Resources>
286 <converter:HextoColorConverter x:Key="HextoColorConverter"/>
287
288 <Style TargetType="{x:Type ListView}">
289 <Setter Property="OverridesDefaultStyle" Value="True"/>
290
291 <Setter Property="Template">
292 <Setter.Value>
293 <ControlTemplate TargetType="{x:Type ListView}">
294 <Border>
295 <ItemsPresenter />
296 </Border>
297 </ControlTemplate>
298 </Setter.Value>
299 </Setter>
300 </Style>
301 <Style TargetType="{x:Type ListViewItem}">
302 <Setter Property="OverridesDefaultStyle" Value="True"/>
303 <Setter Property="Template">
304 <Setter.Value>
305 <ControlTemplate TargetType="{x:Type ListViewItem}">
306 <Grid>
307 <Border BorderBrush="{Binding ElementName=Border,Path=BorderBrush}" BorderThickness="{Binding ElementName=Border,Path=BorderThickness}" Margin="{Binding ElementName=Border,Path=Margin}" CornerRadius="{Binding ElementName=Border,Path=CornerRadius}">
308 <Border.Effect>
309 <DropShadowEffect Color="#d8d2d2" BlurRadius="10" Direction="300" ShadowDepth="4" Opacity="0.1" RenderingBias="Performance" ></DropShadowEffect>
310 </Border.Effect>
311 </Border>
312 <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="{DynamicResource StandardBackgroundBrush}" Margin="5" CornerRadius="20">
313 <ContentPresenter/>
314 </Border>
315 </Grid>
316
317 <ControlTemplate.Triggers>
318 <Trigger Property="IsMouseOver" Value="True">
319 <!--<Setter TargetName="Border" Property="Background" Value="#FFE8E6FF"/>-->
320 <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ThemeBrush}"/>
321
322 </Trigger>
323 </ControlTemplate.Triggers>
324 </ControlTemplate>
325 </Setter.Value>
326 </Setter>
327
328 </Style>
329 </ListBox.Resources>
330 <ListBox.ItemsPanel>
331 <ItemsPanelTemplate>
332 <WrapPanel/>
333 </ItemsPanelTemplate>
334 </ListBox.ItemsPanel>
335 <ListView.ItemTemplate>
336 <DataTemplate>
337
338
339 <WrapPanel Orientation="Vertical">
340 <Border Width="150" Height="150">
341
342 <Grid>
343 <Grid.RowDefinitions>
344 <RowDefinition Height="40"/>
345
346 <RowDefinition Height="40"/>
347 <RowDefinition Height="30"/>
348 <RowDefinition Height="*"/>
349
350 </Grid.RowDefinitions>
351 <Rectangle HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" RadiusX="20" RadiusY="20" Width="15" Height="15" Fill="{Binding Data.Color,Converter={StaticResource HextoColorConverter}}"/>
352 <Grid Grid.Row="1">
353
354 <base:Img Radius="8" Width="40" Height="40" URL="{Binding Data.IconFile}"/>
355 </Grid>
356 <TextBlock Foreground="{DynamicResource StandardTextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Text="{Binding Data.Name}" FontSize="14"/>
357
358 <Border Grid.Row="3" >
359 <Border Margin="10,0,10,0" CornerRadius="10" Background="{DynamicResource CategoryAppNumBgBrush}" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="10,5">
360 <TextBlock Foreground="{DynamicResource DefaultTextBrush}">
361 <Run Text="×"/>
362
363 <Run Text="{Binding Count}"/>
364 </TextBlock>
365
366 </Border>
367
368 </Border>
369 </Grid>
370 </Border>
371
372 </WrapPanel>
373 </DataTemplate>
374 </ListView.ItemTemplate>
375 </ListView>
376 </StackPanel>
377 </ScrollViewer>
378 </TabItem>
379 </TabControl>
380
381 </Grid>
382
383 </Grid>
384</c:TPage>