跳到主要内容

github/tai

公开

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

提交记录
修改UI/App.xaml.cs+3 −0看文件
@@ -13,6 +13,7 @@ using System.Windows.Controls;
1313using System.Windows.Resources;
1414using UI.Controls.Window;
1515using UI.ViewModels;
16新增:using UI.Views;
1617
1718namespace UI
1819{
@@ -105,6 +106,8 @@ namespace UI
105106
106107 services.AddSingleton<MainViewModel>();
107108 services.AddTransient<MainWindow>();
109新增:
110新增: services.AddTransient<IndexPage>();
108111 }
109112
110113 private void OnStartup(object sender, StartupEventArgs e)
修改UI/Controls/PageContainer.cs+7 −4看文件
@@ -102,7 +102,7 @@ namespace UI.Controls
102102 public PageContainer()
103103 {
104104 DefaultStyleKey = typeof(PageContainer);
105删除: ProjectName = App.Current.GetType().Assembly.GetName().Name;
105新增: ProjectName = "UI";
106106 Historys = new List<string>();
107107 BackCommand = new Command(new Action<object>(OnBackCommand));
108108 NavigationCommands.BrowseBack.InputGestures.Clear();
@@ -132,10 +132,13 @@ namespace UI.Controls
132132 var page = ServiceProvider.GetService(pageType) as Page;
133133 if (page != null)
134134 {
135删除: var pageVM = ServiceProvider.GetService(pageVMType);
136删除: if (pageVM != null)
135新增: if (pageVMType != null)
137136 {
138删除: page.DataContext = pageVM;
137新增: var pageVM = ServiceProvider.GetService(pageVMType);
138新增: if (pageVM != null)
139新增: {
140新增: page.DataContext = pageVM;
141新增: }
139142 }
140143 Content = page;
141144 //处理历史记录
修改UI/Themes/Generic.xaml+1 −0看文件
@@ -6,6 +6,7 @@
66 <ResourceDictionary Source="/Tai;component/Themes/Navigation/NavigationItem.xaml"/>
77 <ResourceDictionary Source="/Tai;component/Themes/Navigation/Navigation.xaml"/>
88 <ResourceDictionary Source="/Tai;component/Themes/Base/Icon.xaml"/>
9新增: <ResourceDictionary Source="/Tai;component/Themes/PageContainer.xaml"/>
910
1011 </ResourceDictionary.MergedDictionaries>
1112</ResourceDictionary>
文件末尾没有换行
新增UI/Themes/PageContainer.xaml+34 −0看文件
@@ -0,0 +1,34 @@
1新增:<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2新增: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3新增: xmlns:local="clr-namespace:UI.Controls"
4新增: xmlns:base="clr-namespace:UI.Controls.Base">
5新增: <Style TargetType="{x:Type local:PageContainer}">
6新增: <Setter Property="SnapsToDevicePixels" Value="True"/>
7新增: <Setter Property="Template">
8新增: <Setter.Value>
9新增: <ControlTemplate TargetType="{x:Type local:PageContainer}">
10新增: <Border Background="{TemplateBinding Background}"
11新增: BorderBrush="{TemplateBinding BorderBrush}"
12新增: BorderThickness="{TemplateBinding BorderThickness}">
13新增: <Grid>
14新增: <!--<StackPanel Height="44" Orientation="Horizontal" Panel.ZIndex="1" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,32,0,0" Visibility="{TemplateBinding TitleBarVisibility}">
15新增: <Button Style="{DynamicResource Icon}"
16新增: Width="35"
17新增: Height="35"
18新增: Command="{TemplateBinding BackCommand}"
19新增: VerticalAlignment="Center"
20新增: >
21新增: <base:Icon IconType="Back"
22新增: VerticalAlignment="Center"
23新增: FontSize="15" />
24新增: </Button>
25新增: <TextBlock Text="{TemplateBinding Title}" VerticalAlignment="Center" FontSize="16" Margin="10,0,0,0"/>
26新增: </StackPanel>-->
27新增: <Frame Grid.Row="1" Content="{TemplateBinding Content}" NavigationUIVisibility="Hidden"/>
28新增: </Grid>
29新增: </Border>
30新增: </ControlTemplate>
31新增: </Setter.Value>
32新增: </Setter>
33新增: </Style>
34新增:</ResourceDictionary>
文件末尾没有换行
修改UI/UI.csproj+11 −0看文件
@@ -89,6 +89,9 @@
8989 <Compile Include="Models\MainWindowModel.cs" />
9090 <Compile Include="Models\UINotifyPropertyChanged.cs" />
9191 <Compile Include="ViewModels\MainViewModel.cs" />
92新增: <Compile Include="Views\IndexPage.xaml.cs">
93新增: <DependentUpon>IndexPage.xaml</DependentUpon>
94新增: </Compile>
9295 <Page Include="MainWindow.xaml">
9396 <Generator>MSBuild:Compile</Generator>
9497 <SubType>Designer</SubType>
@@ -122,6 +125,10 @@
122125 <Generator>MSBuild:Compile</Generator>
123126 <SubType>Designer</SubType>
124127 </Page>
128新增: <Page Include="Themes\PageContainer.xaml">
129新增: <Generator>MSBuild:Compile</Generator>
130新增: <SubType>Designer</SubType>
131新增: </Page>
125132 <Page Include="Themes\Window\DefaultWindow.xaml">
126133 <SubType>Designer</SubType>
127134 <Generator>MSBuild:Compile</Generator>
@@ -130,6 +137,10 @@
130137 <SubType>Designer</SubType>
131138 <Generator>MSBuild:Compile</Generator>
132139 </Page>
140新增: <Page Include="Views\IndexPage.xaml">
141新增: <SubType>Designer</SubType>
142新增: <Generator>MSBuild:Compile</Generator>
143新增: </Page>
133144 </ItemGroup>
134145 <ItemGroup>
135146 <Compile Include="Properties\AssemblyInfo.cs">
修改UI/ViewModels/MainViewModel.cs+7 −6看文件
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
66using UI.Controls;
77using UI.Controls.Navigation.Models;
88using UI.Models;
9新增:using UI.Views;
910
1011namespace UI.ViewModels
1112{
@@ -23,8 +24,7 @@ namespace UI.ViewModels
2324 this.serviceProvider = serviceProvider;
2425
2526 ServiceProvider = serviceProvider;
26删除: Uri = "IndexPage";
27删除: Title = "Project Event";
27新增: Uri = nameof(IndexPage);
2828 OnSelectedCommand = new Command(new Action<object>(OnSelectedCommandHandle));
2929 GotoPageCommand = new Command(new Action<object>(OnGotoPageCommand));
3030
@@ -40,10 +40,10 @@ namespace UI.ViewModels
4040 {
4141 if (e.PropertyName == nameof(Uri))
4242 {
43删除: //if (Uri == nameof(IndexPage))
44删除: //{
45删除: // Data = null;
46删除: //}
43新增: if (Uri == nameof(IndexPage))
44新增: {
45新增: Data = null;
46新增: }
4747 }
4848 }
4949
@@ -72,6 +72,7 @@ namespace UI.ViewModels
7272 {
7373 Icon = Controls.Base.IconTypes.AppIconDefaultList,
7474 Title = "概览",
75新增: Uri = nameof(IndexPage),
7576 ID = -1
7677
7778 });
新增UI/Views/IndexPage.xaml+14 −0看文件
@@ -0,0 +1,14 @@
1新增:<Page x:Class="UI.Views.IndexPage"
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"
7新增: mc:Ignorable="d"
8新增: d:DesignHeight="450" d:DesignWidth="800"
9新增: Title="IndexPage">
10新增:
11新增: <Grid>
12新增:
13新增: </Grid>
14新增:</Page>
新增UI/Views/IndexPage.xaml.cs+28 −0看文件
@@ -0,0 +1,28 @@
1新增:using System;
2新增:using System.Collections.Generic;
3新增:using System.Linq;
4新增:using System.Text;
5新增:using System.Threading.Tasks;
6新增:using System.Windows;
7新增:using System.Windows.Controls;
8新增:using System.Windows.Data;
9新增:using System.Windows.Documents;
10新增:using System.Windows.Input;
11新增:using System.Windows.Media;
12新增:using System.Windows.Media.Imaging;
13新增:using System.Windows.Navigation;
14新增:using System.Windows.Shapes;
15新增:
16新增:namespace UI.Views
17新增:{
18新增: /// <summary>
19新增: /// IndexPage.xaml 的交互逻辑
20新增: /// </summary>
21新增: public partial class IndexPage : Page
22新增: {
23新增: public IndexPage()
24新增: {
25新增: InitializeComponent();
26新增: }
27新增: }
28新增:}