跳到主要内容

github/tai

公开

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

提交记录
修改Core/AppState.cs+5 −0看文件
@@ -15,6 +15,11 @@ namespace Core
1515 /// 是否正在加载中
1616 /// </summary>
1717 public static bool IsLoading { get; set; } = true;
18新增: /// <summary>
19新增: /// 进度值
20新增: /// </summary>
21新增: public static int ProcessValue { get; set; } = 0;
1822
23新增: public static string ActionText { get; set; } = "加载中,请稍后...";
1924 }
2025}
修改Core/Librarys/SQLite/SQLiteBuilder.cs+24 −3看文件
@@ -255,6 +255,7 @@ namespace Core.Librarys.SQLite
255255 /// </summary>
256256 private void HandleVersion1002Migrate()
257257 {
258新增: AppState.ActionText = "导入数据中,请勿退出...";
258259 //if (ExecuteNonQuery("select count(*) from sqlite_master where type='table' and name='AppModels'") != 0)
259260 //{
260261 // return;
@@ -282,14 +283,34 @@ namespace Core.Librarys.SQLite
282283
283284 sqlList.Add($"update DailyLogModels set AppModelID={ID} where ProcessName='{Name}'");
284285 sqlList.Add($"update HoursLogModels set AppModelID={ID} where ProcessName='{Name}'");
286新增: sqlList.Add($"update AppModels set IconFile='{icon}' where ID={ID}");
287新增: }
288新增: }
289新增:
290新增: int take = 50;
291新增: bool isRuning = true;
292新增: int index = 0;
293新增: double count = sqlList.Count;
294新增: while (isRuning)
295新增: {
296新增: var sqlArr = sqlList.Skip(index).Take(take).ToArray();
297新增: cmd.CommandText = string.Join("; ", sqlArr);
298新增: cmd.ExecuteNonQuery();
285299
300新增: index += take;
286301
287删除: sqlList.Add($"update AppModels set IconFile='{icon}' where ID={ID}");
302新增: if (sqlArr.Length == 0)
303新增: {
304新增: isRuning = false;
288305 }
306新增: double num = sqlList.Skip(index).Count();
307新增:
308新增: // 更新进度
309新增: AppState.ProcessValue = (int)((count - num) / count * 100);
310新增: Debug.WriteLine("加载:" + AppState.ProcessValue);
289311 }
312新增: Debug.WriteLine("结束!");
290313
291删除: cmd.CommandText = string.Join("; ", sqlList.ToArray());
292删除: cmd.ExecuteNonQuery();
293314 }
294315 }
295316
修改UI/App.xaml.cs+2 −1看文件
@@ -119,7 +119,7 @@ namespace UI
119119 CreateStatusBarIconMenu();
120120
121121 statusBarIcon = new System.Windows.Forms.NotifyIcon();
122删除: statusBarIcon.Text = "Tai! [加载中,请稍后...]";
122新增: //statusBarIcon.Text = "Tai!";
123123 Stream iconStream = GetResourceStream(new Uri("pack://application:,,,/Tai;component/Resources/Icons/taibusy.ico")).Stream;
124124 statusBarIcon.Icon = new Icon(iconStream);
125125 //statusBarIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetEntryAssembly().ManifestModule.Name);
@@ -273,6 +273,7 @@ namespace UI
273273 {
274274 while (AppState.IsLoading)
275275 {
276新增: statusBarIcon.Text = $"[{AppState.ProcessValue}%] Tai [{AppState.ActionText}]";
276277 }
277278 statusBarIcon.Text = "Tai!";
278279 Stream iconStream = GetResourceStream(new Uri("pack://application:,,,/Tai;component/Resources/Icons/tai32.ico")).Stream;