提交记录修改Core/Core.csproj+4 −0看文件
修改Core/Models/Data/HoursDataModel.cs+2 −1看文件
修改Core/Properties/AssemblyInfo.cs+1 −1看文件
修改Core/Servicers/Instances/AppData.cs+23 −16看文件
修改Core/Servicers/Instances/Categorys.cs+4 −0看文件
修改Core/Servicers/Instances/Data.cs+17 −8看文件
修改Core/Servicers/Instances/Main.cs+2 −2看文件
修改Core/Servicers/Interfaces/IAppData.cs+1 −1看文件
修改UI/Controls/Base/Img.cs+1 −1看文件
修改UI/Controls/Base/View.cs+1 −1看文件
修改UI/Controls/Charts/Charts.cs+2 −0看文件
修改UI/ViewModels/ChartPageVM.cs+75 −11看文件
修改UI/Views/ChartPage.xaml+5 −3看文件
| @@ -115,6 +115,7 @@ | ||
| 115 | 115 | <Compile Include="Librarys\SQLite\SQLiteBuilder.cs" /> |
| 116 | 116 | <Compile Include="Librarys\SQLite\SQLiteConfiguration.cs" /> |
| 117 | 117 | <Compile Include="Librarys\SQLite\TaiDbContext.cs" /> |
| 118 | 新增: <Compile Include="Librarys\Time.cs" /> | |
| 118 | 119 | <Compile Include="Librarys\Win32API.cs" /> |
| 119 | 120 | <Compile Include="Models\AppModel.cs" /> |
| 120 | 121 | <Compile Include="Models\CategoryModel.cs" /> |
| @@ -123,11 +124,13 @@ | ||
| 123 | 124 | <Compile Include="Models\Config\BehaviorModel.cs" /> |
| 124 | 125 | <Compile Include="Models\Config\GeneralModel.cs" /> |
| 125 | 126 | <Compile Include="Models\Config\Link\LinkModel.cs" /> |
| 127 | 新增: <Compile Include="Models\Data\HoursDataModel.cs" /> | |
| 126 | 128 | <Compile Include="Models\HoursLogModel.cs" /> |
| 127 | 129 | <Compile Include="Models\DailyLogModel.cs" /> |
| 128 | 130 | <Compile Include="Properties\AssemblyInfo.cs" /> |
| 129 | 131 | <Compile Include="Servicers\Instances\AppConfig.cs" /> |
| 130 | 132 | <Compile Include="Servicers\Instances\AppData.cs" /> |
| 133 | 新增: <Compile Include="Servicers\Instances\Categorys.cs" /> | |
| 131 | 134 | <Compile Include="Servicers\Instances\Data.cs" /> |
| 132 | 135 | <Compile Include="Librarys\Logger.cs" /> |
| 133 | 136 | <Compile Include="Servicers\Instances\DateObserver.cs" /> |
| @@ -135,6 +138,7 @@ | ||
| 135 | 138 | <Compile Include="Servicers\Instances\Observer.cs" /> |
| 136 | 139 | <Compile Include="Servicers\Instances\Sleepdiscover.cs" /> |
| 137 | 140 | <Compile Include="Servicers\Interfaces\IAppConfig.cs" /> |
| 141 | 新增: <Compile Include="Servicers\Interfaces\ICategorys.cs" /> | |
| 138 | 142 | <Compile Include="Servicers\Interfaces\IAppData.cs" /> |
| 139 | 143 | <Compile Include="Servicers\Interfaces\IData.cs" /> |
| 140 | 144 | <Compile Include="Servicers\Interfaces\IDateObserver.cs" /> |
| @@ -6,8 +6,9 @@ using System.Threading.Tasks; | ||
| 6 | 6 | |
| 7 | 7 | namespace Core.Models.Data |
| 8 | 8 | { |
| 9 | 删除: public class CategoryChartDataModel | |
| 9 | 新增: public class ColumnDataModel | |
| 10 | 10 | { |
| 11 | 新增: public int AppId { get; set; } | |
| 11 | 12 | public int CategoryID { get; set; } |
| 12 | 13 | public double[] Values { get; set; } |
| 13 | 14 | } |
| @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; | ||
| 32 | 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 |
| 33 | 33 | //通过使用 "*",如下所示: |
| 34 | 34 | // [assembly: AssemblyVersion("1.0.*")] |
| 35 | 删除:[assembly: AssemblyVersion("1.0.0.1")] | |
| 35 | 新增:[assembly: AssemblyVersion("1.0.0.2")] | |
| 36 | 36 | [assembly: AssemblyFileVersion("1.0.0.1")] |
| @@ -78,6 +78,12 @@ namespace Core.Servicers.Instances | ||
| 78 | 78 | if (!_updateTempApps.Where(m => m.ID == app.ID).Any()) |
| 79 | 79 | { |
| 80 | 80 | _updateTempApps.Add(app); |
| 81 | 新增: | |
| 82 | 新增: Task.Run(() => | |
| 83 | 新增: { | |
| 84 | 新增: SaveAppChanges(); | |
| 85 | 新增: }); | |
| 86 | 新增: | |
| 81 | 87 | } |
| 82 | 88 | } |
| 83 | 89 | public AppModel GetApp(string name) |
| @@ -106,29 +112,30 @@ namespace Core.Servicers.Instances | ||
| 106 | 112 | } |
| 107 | 113 | } |
| 108 | 114 | |
| 109 | 删除: public void SaveAppChanges() | |
| 115 | 新增: private void SaveAppChanges() | |
| 110 | 116 | { |
| 111 | 删除: | |
| 112 | 删除: using (var db = new TaiDbContext()) | |
| 117 | 新增: if (_updateTempApps.Count > 0) | |
| 113 | 118 | { |
| 114 | 删除: foreach (var item in _updateTempApps) | |
| 119 | 新增: using (var db = new TaiDbContext()) | |
| 115 | 120 | { |
| 116 | 删除: var app = db.App.Find(item.ID); | |
| 117 | 删除: if (app != null) | |
| 121 | 新增: foreach (var item in _updateTempApps) | |
| 118 | 122 | { |
| 119 | 删除: app.TotalTime = item.TotalTime; | |
| 120 | 删除: app.File = item.File; | |
| 121 | 删除: app.IconFile = item.IconFile; | |
| 122 | 删除: app.Name = item.Name; | |
| 123 | 删除: app.CategoryID = item.CategoryID; | |
| 124 | 删除: app.Description = item.Description; | |
| 125 | 删除: //app.Category = item.Category; | |
| 123 | 新增: var app = db.App.Find(item.ID); | |
| 124 | 新增: if (app != null) | |
| 125 | 新增: { | |
| 126 | 新增: app.TotalTime = item.TotalTime; | |
| 127 | 新增: app.File = item.File; | |
| 128 | 新增: app.IconFile = item.IconFile; | |
| 129 | 新增: app.Name = item.Name; | |
| 130 | 新增: app.CategoryID = item.CategoryID; | |
| 131 | 新增: app.Description = item.Description; | |
| 132 | 新增: //app.Category = item.Category; | |
| 133 | 新增: } | |
| 126 | 134 | } |
| 135 | 新增: db.SaveChanges(); | |
| 136 | 新增: _updateTempApps.Clear(); | |
| 127 | 137 | } |
| 128 | 删除: db.SaveChanges(); | |
| 129 | 删除: _updateTempApps.Clear(); | |
| 130 | 138 | } |
| 131 | 删除: | |
| 132 | 139 | } |
| 133 | 140 | |
| 134 | 141 | public List<AppModel> GetAppsByCategoryID(int categoryID) |
| @@ -104,6 +104,10 @@ namespace Core.Servicers.Instances | ||
| 104 | 104 | if (!_updateTempList.Where(m => m.ID == category.ID).Any()) |
| 105 | 105 | { |
| 106 | 106 | _updateTempList.Add(category); |
| 107 | 新增: Task.Run(() => | |
| 108 | 新增: { | |
| 109 | 新增: SaveChanged(); | |
| 110 | 新增: }); | |
| 107 | 111 | } |
| 108 | 112 | } |
| 109 | 113 | } |
| @@ -124,6 +124,7 @@ namespace Core.Servicers.Instances | ||
| 124 | 124 | Date = m.FirstOrDefault().Date, |
| 125 | 125 | AppID = m.FirstOrDefault().AppModelID |
| 126 | 126 | }) |
| 127 | 新增: .OrderByDescending(m => m.Time) | |
| 127 | 128 | .Take(take); |
| 128 | 129 | |
| 129 | 130 | var res = data |
| @@ -306,15 +307,17 @@ namespace Core.Servicers.Instances | ||
| 306 | 307 | using (var db = new TaiDbContext()) |
| 307 | 308 | { |
| 308 | 309 | // 查出有数据的分类 |
| 309 | 删除: //var res = db.Database.SqlQuery<CategoryHoursDataModel>("select AppModels.CategoryID,HoursLogModels.DataTime as Time from HoursLogModels join AppModels on AppModels.ID=HoursLogModels.AppModelID where HoursLogModels.AppModelID<>0 and AppModels.CategoryID<>0 and HoursLogModels.DataTime>='" + start.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and HoursLogModels.DataTime<= '"+ end.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID").ToArray(); | |
| 310 | 删除: var categorys = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,HoursLogModels.DataTime as Time from HoursLogModels join AppModels on AppModels.ID=HoursLogModels.AppModelID where AppModels.CategoryID<>0 and HoursLogModels.DataTime>='" + date.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and HoursLogModels.DataTime<= '" + date.Date.ToString("yyyy-MM-dd 23:59:59") + "' GROUP BY AppModels.CategoryID ").ToArray(); | |
| 311 | 310 | |
| 311 | 新增: //var categorys = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,HoursLogModels.DataTime as Time from HoursLogModels join AppModels on AppModels.ID=HoursLogModels.AppModelID where AppModels.CategoryID<>0 and HoursLogModels.DataTime>='" + date.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and HoursLogModels.DataTime<= '" + date.Date.ToString("yyyy-MM-dd 23:59:59") + "' GROUP BY AppModels.CategoryID ").ToArray(); | |
| 312 | 312 | |
| 313 | 删除: var data = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,HoursLogModels.DataTime as Time from HoursLogModels join AppModels on AppModels.ID=HoursLogModels.AppModelID where AppModels.CategoryID<>0 and HoursLogModels.DataTime>='" + date.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and HoursLogModels.DataTime<= '" + date.Date.ToString("yyyy-MM-dd 23:59:59") + "' GROUP BY AppModels.CategoryID,HoursLogModels.DataTime ").ToArray(); | |
| 314 | 313 | |
| 314 | 新增: //var data = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,HoursLogModels.DataTime as Time from HoursLogModels join AppModels on AppModels.ID=HoursLogModels.AppModelID where AppModels.CategoryID<>0 and HoursLogModels.DataTime>='" + date.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and HoursLogModels.DataTime<= '" + date.Date.ToString("yyyy-MM-dd 23:59:59") + "' GROUP BY AppModels.CategoryID,HoursLogModels.DataTime ").ToArray(); | |
| 315 | 新增: var categorys = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,HoursLogModels.DataTime as Time from HoursLogModels join AppModels on AppModels.ID=HoursLogModels.AppModelID where HoursLogModels.DataTime>='" + date.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and HoursLogModels.DataTime<= '" + date.Date.ToString("yyyy-MM-dd 23:59:59") + "' GROUP BY AppModels.CategoryID ").OrderByDescending(m => m.CategoryID).ToArray(); | |
| 315 | 316 | |
| 316 | 删除: List<ColumnDataModel> list = new List<ColumnDataModel>(); | |
| 317 | 317 | |
| 318 | 新增: var data = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,HoursLogModels.DataTime as Time from HoursLogModels join AppModels on AppModels.ID=HoursLogModels.AppModelID where HoursLogModels.DataTime>='" + date.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and HoursLogModels.DataTime<= '" + date.Date.ToString("yyyy-MM-dd 23:59:59") + "' GROUP BY AppModels.CategoryID,HoursLogModels.DataTime ").ToArray(); | |
| 319 | 新增: | |
| 320 | 新增: List<ColumnDataModel> list = new List<ColumnDataModel>(); | |
| 318 | 321 | foreach (var category in categorys) |
| 319 | 322 | { |
| 320 | 323 | list.Add(new ColumnDataModel() |
| @@ -347,12 +350,15 @@ namespace Core.Servicers.Instances | ||
| 347 | 350 | { |
| 348 | 351 | // 查出有数据的分类 |
| 349 | 352 | |
| 350 | 删除: var categorys = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where AppModels.CategoryID<>0 and DailyLogModels.Date>='" + start.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + end.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID").ToArray(); | |
| 353 | 新增: //var categorys = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where AppModels.CategoryID<>0 and DailyLogModels.Date>='" + start.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + end.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID").ToArray(); | |
| 351 | 354 | |
| 352 | 355 | |
| 353 | 删除: var data = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where AppModels.CategoryID<>0 and DailyLogModels.Date>='" + start.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + end.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID,DailyLogModels.Date ").ToArray(); | |
| 356 | 新增: //var data = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where AppModels.CategoryID<>0 and DailyLogModels.Date>='" + start.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + end.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID,DailyLogModels.Date ").ToArray(); | |
| 357 | 新增: var categorys = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where DailyLogModels.Date>='" + start.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + end.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID").OrderByDescending(m => m.CategoryID).ToArray(); | |
| 354 | 358 | |
| 355 | 359 | |
| 360 | 新增: var data = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where DailyLogModels.Date>='" + start.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + end.Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID,DailyLogModels.Date ").ToArray(); | |
| 361 | 新增: | |
| 356 | 362 | var ts = end - start; |
| 357 | 363 | var days = ts.TotalDays + 1; |
| 358 | 364 | |
| @@ -397,12 +403,15 @@ namespace Core.Servicers.Instances | ||
| 397 | 403 | |
| 398 | 404 | var dateArr = Time.GetYearDate(date); |
| 399 | 405 | |
| 400 | 删除: var categorys = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where AppModels.CategoryID<>0 and DailyLogModels.Date>='" + dateArr[0].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + dateArr[1].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID").ToArray(); | |
| 406 | 新增: //var categorys = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where AppModels.CategoryID<>0 and DailyLogModels.Date>='" + dateArr[0].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + dateArr[1].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID").ToArray(); | |
| 407 | 新增: | |
| 401 | 408 | |
| 409 | 新增: //var data = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where AppModels.CategoryID<>0 and DailyLogModels.Date>='" + dateArr[0].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + dateArr[1].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID,DailyLogModels.Date ").ToArray(); | |
| 402 | 410 | |
| 403 | 删除: var data = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where AppModels.CategoryID<>0 and DailyLogModels.Date>='" + dateArr[0].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + dateArr[1].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID,DailyLogModels.Date ").ToArray(); | |
| 411 | 新增: var categorys = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where DailyLogModels.Date>='" + dateArr[0].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + dateArr[1].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID").OrderByDescending(m => m.CategoryID).ToArray(); | |
| 404 | 412 | |
| 405 | 413 | |
| 414 | 新增: var data = db.Database.SqlQuery<CategoryHoursDataModel>("select sum(Time) as Total,AppModels.CategoryID,DailyLogModels.Date as Time from DailyLogModels join AppModels on AppModels.ID=DailyLogModels.AppModelID where DailyLogModels.Date>='" + dateArr[0].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' and DailyLogModels.Date<= '" + dateArr[1].Date.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModels.CategoryID,DailyLogModels.Date ").ToArray(); | |
| 406 | 415 | //var ts = end - start; |
| 407 | 416 | //var days = ts.TotalDays + 1; |
| 408 | 417 | |
| @@ -163,7 +163,7 @@ namespace Core.Servicers.Instances | ||
| 163 | 163 | { |
| 164 | 164 | observer?.Stop(); |
| 165 | 165 | |
| 166 | 删除: appData.SaveAppChanges(); | |
| 166 | 新增: //appData.SaveAppChanges(); | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | |
| @@ -183,7 +183,7 @@ namespace Core.Servicers.Instances | ||
| 183 | 183 | //activeTimer.Stop(); |
| 184 | 184 | |
| 185 | 185 | // 更新app数据 |
| 186 | 删除: appData.SaveAppChanges(); | |
| 186 | 新增: //appData.SaveAppChanges(); | |
| 187 | 187 | } |
| 188 | 188 | else if (sleepStatus == SleepStatus.Wake) |
| 189 | 189 | { |
| @@ -16,7 +16,7 @@ namespace Core.Servicers.Interfaces | ||
| 16 | 16 | /// <summary> |
| 17 | 17 | /// 保存app数据更改 |
| 18 | 18 | /// </summary> |
| 19 | 删除: void SaveAppChanges(); | |
| 19 | 新增: //void SaveAppChanges(); | |
| 20 | 20 | /// <summary> |
| 21 | 21 | /// 通过进程名称获取app |
| 22 | 22 | /// </summary> |
| @@ -74,7 +74,7 @@ namespace UI.Controls.Base | ||
| 74 | 74 | |
| 75 | 75 | private void Handle() |
| 76 | 76 | { |
| 77 | 删除: if (!File.Exists(URL)) | |
| 77 | 新增: if (URL == null || (URL.IndexOf("pack://") == -1 && !File.Exists(URL))) | |
| 78 | 78 | { |
| 79 | 79 | URL = "pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png"; |
| 80 | 80 | } |
| @@ -95,7 +95,7 @@ namespace UI.Controls.Base | ||
| 95 | 95 | } |
| 96 | 96 | else |
| 97 | 97 | { |
| 98 | 删除: isShow = Condition == Value.ToString(); | |
| 98 | 新增: isShow = Condition == (Value != null ? Value.ToString() : ""); | |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| @@ -859,6 +859,8 @@ namespace UI.Controls.Charts | ||
| 859 | 859 | |
| 860 | 860 | var infoList = new List<ChartColumnInfoModel>(); |
| 861 | 861 | |
| 862 | 新增: list = list.OrderByDescending(m => m.Values.Sum()).ToList(); | |
| 863 | 新增: | |
| 862 | 864 | foreach (var item in list) |
| 863 | 865 | { |
| 864 | 866 | infoList.Add(new ChartColumnInfoModel() |
| @@ -134,18 +134,33 @@ namespace UI.ViewModels | ||
| 134 | 134 | |
| 135 | 135 | var chartData = new List<ChartsDataModel>(); |
| 136 | 136 | |
| 137 | 新增: var nullCategory = new CategoryModel() | |
| 138 | 新增: { | |
| 139 | 新增: ID = 0, | |
| 140 | 新增: Name = "未分类", | |
| 141 | 新增: IconFile = "pack://application:,,,/Tai;component/Resources/Icons/tai32.ico" | |
| 142 | 新增: }; | |
| 137 | 143 | foreach (var item in list) |
| 138 | 144 | { |
| 139 | 145 | var category = categorys.GetCategory(item.CategoryID); |
| 146 | 新增: if (item.CategoryID == 0) | |
| 147 | 新增: { | |
| 148 | 新增: category = nullCategory; | |
| 149 | 新增: } | |
| 140 | 150 | if (category != null) |
| 141 | 151 | { |
| 142 | 删除: chartData.Add(new ChartsDataModel() | |
| 152 | 新增: var dataItem = new ChartsDataModel() | |
| 143 | 153 | { |
| 144 | 154 | |
| 145 | 155 | Name = category.Name, |
| 146 | 156 | Icon = category.IconFile, |
| 147 | 157 | Values = item.Values, |
| 148 | 删除: }); | |
| 158 | 新增: }; | |
| 159 | 新增: if (category.ID == 0) | |
| 160 | 新增: { | |
| 161 | 新增: dataItem.Color = "#f7f6f2"; | |
| 162 | 新增: } | |
| 163 | 新增: chartData.Add(dataItem); | |
| 149 | 164 | } |
| 150 | 165 | } |
| 151 | 166 | |
| @@ -170,20 +185,37 @@ namespace UI.ViewModels | ||
| 170 | 185 | |
| 171 | 186 | var chartData = new List<ChartsDataModel>(); |
| 172 | 187 | |
| 188 | 新增: var nullCategory = new CategoryModel() | |
| 189 | 新增: { | |
| 190 | 新增: ID = 0, | |
| 191 | 新增: Name = "未分类", | |
| 192 | 新增: IconFile = "pack://application:,,,/Tai;component/Resources/Icons/tai32.ico" | |
| 193 | 新增: | |
| 194 | 新增: }; | |
| 195 | 新增: | |
| 173 | 196 | string[] weekNames = { "周一", "周二", "周三", "周四", "周五", "周六", "周日", }; |
| 174 | 197 | foreach (var item in list) |
| 175 | 198 | { |
| 176 | 199 | var category = categorys.GetCategory(item.CategoryID); |
| 200 | 新增: if (item.CategoryID == 0) | |
| 201 | 新增: { | |
| 202 | 新增: category = nullCategory; | |
| 203 | 新增: } | |
| 177 | 204 | if (category != null) |
| 178 | 205 | { |
| 179 | 删除: chartData.Add(new ChartsDataModel() | |
| 206 | 新增: var dataItem = new ChartsDataModel() | |
| 180 | 207 | { |
| 181 | 208 | |
| 182 | 209 | Name = category.Name, |
| 183 | 210 | Icon = category.IconFile, |
| 184 | 211 | Values = item.Values, |
| 185 | 删除: ColumnNames = weekNames | |
| 186 | 删除: }); | |
| 212 | 新增: ColumnNames = weekNames, | |
| 213 | 新增: }; | |
| 214 | 新增: if (category.ID == 0) | |
| 215 | 新增: { | |
| 216 | 新增: dataItem.Color = "#f7f6f2"; | |
| 217 | 新增: } | |
| 218 | 新增: chartData.Add(dataItem); | |
| 187 | 219 | } |
| 188 | 220 | } |
| 189 | 221 | |
| @@ -208,18 +240,34 @@ namespace UI.ViewModels | ||
| 208 | 240 | |
| 209 | 241 | var chartData = new List<ChartsDataModel>(); |
| 210 | 242 | |
| 243 | 新增: var nullCategory = new CategoryModel() | |
| 244 | 新增: { | |
| 245 | 新增: ID = 0, | |
| 246 | 新增: Name = "未分类", | |
| 247 | 新增: IconFile = "pack://application:,,,/Tai;component/Resources/Icons/tai32.ico" | |
| 248 | 新增: }; | |
| 249 | 新增: | |
| 211 | 250 | foreach (var item in list) |
| 212 | 251 | { |
| 213 | 252 | var category = categorys.GetCategory(item.CategoryID); |
| 253 | 新增: if (item.CategoryID == 0) | |
| 254 | 新增: { | |
| 255 | 新增: category = nullCategory; | |
| 256 | 新增: } | |
| 214 | 257 | if (category != null) |
| 215 | 258 | { |
| 216 | 删除: chartData.Add(new ChartsDataModel() | |
| 259 | 新增: var dataItem = new ChartsDataModel() | |
| 217 | 260 | { |
| 218 | 261 | |
| 219 | 262 | Name = category.Name, |
| 220 | 263 | Icon = category.IconFile, |
| 221 | 264 | Values = item.Values, |
| 222 | 删除: }); | |
| 265 | 新增: }; | |
| 266 | 新增: if (category.ID == 0) | |
| 267 | 新增: { | |
| 268 | 新增: dataItem.Color = "#f7f6f2"; | |
| 269 | 新增: } | |
| 270 | 新增: chartData.Add(dataItem); | |
| 223 | 271 | } |
| 224 | 272 | } |
| 225 | 273 | |
| @@ -247,19 +295,35 @@ namespace UI.ViewModels | ||
| 247 | 295 | names[i] = (i + 1) + "月"; |
| 248 | 296 | } |
| 249 | 297 | |
| 298 | 新增: var nullCategory = new CategoryModel() | |
| 299 | 新增: { | |
| 300 | 新增: ID = 0, | |
| 301 | 新增: Name = "未分类", | |
| 302 | 新增: IconFile = "pack://application:,,,/Tai;component/Resources/Icons/tai32.ico" | |
| 303 | 新增: }; | |
| 304 | 新增: | |
| 250 | 305 | foreach (var item in list) |
| 251 | 306 | { |
| 252 | 307 | var category = categorys.GetCategory(item.CategoryID); |
| 308 | 新增: if (item.CategoryID == 0) | |
| 309 | 新增: { | |
| 310 | 新增: category = nullCategory; | |
| 311 | 新增: } | |
| 253 | 312 | if (category != null) |
| 254 | 313 | { |
| 255 | 删除: chartData.Add(new ChartsDataModel() | |
| 314 | 新增: var dataItem = new ChartsDataModel() | |
| 256 | 315 | { |
| 257 | 316 | |
| 258 | 317 | Name = category.Name, |
| 259 | 318 | Icon = category.IconFile, |
| 260 | 319 | Values = item.Values, |
| 261 | 删除: ColumnNames = names | |
| 262 | 删除: }); | |
| 320 | 新增: ColumnNames = names, | |
| 321 | 新增: }; | |
| 322 | 新增: if (category.ID == 0) | |
| 323 | 新增: { | |
| 324 | 新增: dataItem.Color = "#f7f6f2"; | |
| 325 | 新增: } | |
| 326 | 新增: chartData.Add(dataItem); | |
| 263 | 327 | } |
| 264 | 328 | } |
| 265 | 329 | |
| @@ -298,7 +362,7 @@ namespace UI.ViewModels | ||
| 298 | 362 | dateStart = dateArr[0]; |
| 299 | 363 | dateEnd = dateArr[1]; |
| 300 | 364 | } |
| 301 | 删除: var list = data.GetDateRangelogList(dateStart, dateEnd, 3); | |
| 365 | 新增: var list = data.GetDateRangelogList(dateStart, dateEnd, 10); | |
| 302 | 366 | |
| 303 | 367 | TopData = MapToChartsData(list); |
| 304 | 368 | }); |
| @@ -38,13 +38,15 @@ | ||
| 38 | 38 | </base:View> |
| 39 | 39 | </Grid> |
| 40 | 40 | </Border> |
| 41 | 删除: <Border Margin="0,20,0,0" Height="330" Width="680" HorizontalAlignment="Left" Background="White" Padding="20" CornerRadius="10"> | |
| 41 | 新增: <TextBlock Text="分类" Foreground="#5c5c5c" FontSize="15" Margin="0,20,0,5"/> | |
| 42 | 新增: | |
| 43 | 新增: <Border Margin="0,15,0,0" Height="360" Width="680" HorizontalAlignment="Left" Background="White" Padding="20" CornerRadius="10"> | |
| 42 | 44 | <charts:Charts NameIndexStart="{Binding NameIndexStart}" ChartsType="Column" Data="{Binding Data}"/> |
| 43 | 45 | |
| 44 | 46 | </Border> |
| 45 | 删除: <TextBlock Text="最为频繁" FontSize="15" Margin="0,20,0,5"/> | |
| 47 | 新增: <TextBlock Text="最为频繁的应用" Foreground="#5c5c5c" FontSize="15" Margin="0,20,0,5"/> | |
| 46 | 48 | <Border Margin="0,10,0,0" Width="680" HorizontalAlignment="Left" Background="White" Padding="20" CornerRadius="10"> |
| 47 | 删除: <charts:Charts IsCanScroll="False" Height="180" Data="{Binding TopData}" ChartsType="HorizontalA" ShowLimit="3" ClickCommand="{Binding ToDetailCommand}"/> | |
| 49 | 新增: <charts:Charts Height="300" Data="{Binding TopData}" ChartsType="HorizontalA" ClickCommand="{Binding ToDetailCommand}"/> | |
| 48 | 50 | </Border> |
| 49 | 51 | </StackPanel> |
| 50 | 52 | </Grid> |

