提交记录新增Core/Librarys/Time.cs+92 −0看文件
新增Core/Models/Data/HoursDataModel.cs+14 −0看文件
修改Core/Servicers/Instances/Data.cs+160 −26看文件
修改Core/Servicers/Interfaces/IData.cs+22 −1看文件
修改UI/App.xaml.cs+18 −0看文件
修改UI/Base/Color/Colors.cs+2 −0看文件
新增UI/Controls/Base/View.cs+86 −0看文件
修改UI/Controls/Button/IconButton.cs+11 −1看文件
新增UI/Controls/Charts/ChartDataValueType.cs+14 −0看文件
新增UI/Controls/Charts/ChartItemTypeColumn.cs+148 −0看文件
修改UI/Controls/Charts/Charts.cs+275 −3看文件
修改UI/Controls/Charts/ChartsType.cs+5 −1看文件
新增UI/Controls/Charts/Model/ChartColumnInfoModel.cs+17 −0看文件
修改UI/Controls/Charts/Model/ChartsDataModel.cs+13 −0看文件
新增UI/Controls/Converters/HextoColorConverter.cs+25 −0看文件
新增UI/Controls/Converters/ToStringConverter.cs+25 −0看文件
新增UI/Controls/Select/DateSelect.cs+302 −0看文件
新增UI/Controls/Select/DateSelectType.cs+15 −0看文件
修改UI/Controls/Select/Option.cs+9 −0看文件
修改UI/Controls/Select/Select.cs+14 −0看文件
修改UI/Librays/Image/Imager.cs+4 −4看文件
新增UI/Models/ChartPageModel.cs+81 −0看文件
修改UI/Themes/Base/EmptyData.xaml+36 −8看文件
新增UI/Themes/Base/View.xaml+20 −0看文件
修改UI/Themes/Charts/Charts.xaml+134 −1看文件
新增UI/Themes/Charts/ChartsItemTypeColumn.xaml+94 −0看文件
修改UI/Themes/Generic.xaml+3 −0看文件
新增UI/Themes/Select/DateSelect.xaml+184 −0看文件
修改UI/Themes/Select/Option.xaml+5 −2看文件
修改UI/Themes/Select/Select.xaml+17 −4看文件
新增UI/ViewModels/ChartPageVM.cs+319 −0看文件
修改UI/ViewModels/MainViewModel.cs+2 −1看文件
新增UI/Views/ChartPage.xaml+51 −0看文件
新增UI/Views/ChartPage.xaml.cs+49 −0看文件
修改UI/Views/DetailPage.xaml+1 −1看文件
| @@ -0,0 +1,92 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Linq; | |
| 4 | 新增:using System.Text; | |
| 5 | 新增:using System.Threading.Tasks; | |
| 6 | 新增: | |
| 7 | 新增:namespace Core.Librarys | |
| 8 | 新增:{ | |
| 9 | 新增: public class Time | |
| 10 | 新增: { | |
| 11 | 新增: public static string ToString(int seconds) | |
| 12 | 新增: { | |
| 13 | 新增: if (seconds < 60) | |
| 14 | 新增: { | |
| 15 | 新增: return seconds + "秒"; | |
| 16 | 新增: } | |
| 17 | 新增: else | |
| 18 | 新增: { | |
| 19 | 新增: double minutes = seconds / 60; | |
| 20 | 新增: if (minutes < 60) | |
| 21 | 新增: { | |
| 22 | 新增: return minutes + "分钟"; | |
| 23 | 新增: } | |
| 24 | 新增: else | |
| 25 | 新增: { | |
| 26 | 新增: double hours = (double)minutes / 60; | |
| 27 | 新增: if (hours != (int)hours) | |
| 28 | 新增: { | |
| 29 | 新增: double pointNumber = hours - (int)hours; | |
| 30 | 新增: return (int)hours + "小时" + (int)(pointNumber * 60) + "分"; | |
| 31 | 新增: } | |
| 32 | 新增: return hours + "小时"; | |
| 33 | 新增: } | |
| 34 | 新增: } | |
| 35 | 新增: } | |
| 36 | 新增: | |
| 37 | 新增: public static DateTime[] GetThisWeekDate() | |
| 38 | 新增: { | |
| 39 | 新增: DateTime weekStartDate = DateTime.Now, weekEndDate = DateTime.Now; | |
| 40 | 新增: if (DateTime.Now.DayOfWeek == DayOfWeek.Monday) | |
| 41 | 新增: { | |
| 42 | 新增: weekStartDate = DateTime.Now.Date; | |
| 43 | 新增: weekEndDate = DateTime.Now.Date.AddDays(6); | |
| 44 | 新增: } | |
| 45 | 新增: else | |
| 46 | 新增: { | |
| 47 | 新增: int weekNum = (int)DateTime.Now.DayOfWeek; | |
| 48 | 新增: if (weekNum == 0) | |
| 49 | 新增: { | |
| 50 | 新增: weekNum = 7; | |
| 51 | 新增: } | |
| 52 | 新增: weekNum -= 1; | |
| 53 | 新增: weekStartDate = DateTime.Now.Date.AddDays(-weekNum); | |
| 54 | 新增: weekEndDate = weekStartDate.Date.AddDays(6); | |
| 55 | 新增: } | |
| 56 | 新增: return new[] { weekStartDate, weekEndDate }; | |
| 57 | 新增: } | |
| 58 | 新增: | |
| 59 | 新增: public static DateTime[] GetLastWeekDate() | |
| 60 | 新增: { | |
| 61 | 新增: DateTime weekStartDate = DateTime.Now, weekEndDate = DateTime.Now; | |
| 62 | 新增: | |
| 63 | 新增: int weekNum = (int)DateTime.Now.DayOfWeek; | |
| 64 | 新增: if (weekNum == 0) | |
| 65 | 新增: { | |
| 66 | 新增: weekNum = 7; | |
| 67 | 新增: } | |
| 68 | 新增: | |
| 69 | 新增: | |
| 70 | 新增: weekStartDate = DateTime.Now.Date.AddDays(-6 - weekNum); | |
| 71 | 新增: weekEndDate = weekStartDate.AddDays(6); | |
| 72 | 新增: | |
| 73 | 新增: return new[] { weekStartDate, weekEndDate }; | |
| 74 | 新增: } | |
| 75 | 新增: | |
| 76 | 新增: public static DateTime[] GetMonthDate(DateTime date) | |
| 77 | 新增: { | |
| 78 | 新增: var dateStart = new DateTime(date.Year, date.Month, 1); | |
| 79 | 新增: var dateEnd = new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month)); | |
| 80 | 新增: | |
| 81 | 新增: return new[] { dateStart, dateEnd }; | |
| 82 | 新增: } | |
| 83 | 新增: | |
| 84 | 新增: public static DateTime[] GetYearDate(DateTime date) | |
| 85 | 新增: { | |
| 86 | 新增: var dateStart = new DateTime(date.Year, 1, 1, 0, 0, 0); | |
| 87 | 新增: var dateEnd = new DateTime(date.Year, 12, DateTime.DaysInMonth(date.Year, 12), 23, 59, 59); | |
| 88 | 新增: return new[] { dateStart, dateEnd }; | |
| 89 | 新增: | |
| 90 | 新增: } | |
| 91 | 新增: } | |
| 92 | 新增:} | |
| @@ -0,0 +1,14 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Linq; | |
| 4 | 新增:using System.Text; | |
| 5 | 新增:using System.Threading.Tasks; | |
| 6 | 新增: | |
| 7 | 新增:namespace Core.Models.Data | |
| 8 | 新增:{ | |
| 9 | 新增: public class CategoryChartDataModel | |
| 10 | 新增: { | |
| 11 | 新增: public int CategoryID { get; set; } | |
| 12 | 新增: public double[] Values { get; set; } | |
| 13 | 新增: } | |
| 14 | 新增:} | |
| @@ -7,6 +7,8 @@ using System.Diagnostics; | ||
| 7 | 7 | using System.Linq; |
| 8 | 8 | using System.Data.Entity; |
| 9 | 9 | using System.Windows.Threading; |
| 10 | 新增:using Core.Models.Data; | |
| 11 | 新增:using Core.Librarys; | |
| 10 | 12 | |
| 11 | 13 | namespace Core.Servicers.Instances |
| 12 | 14 | { |
| @@ -98,38 +100,22 @@ namespace Core.Servicers.Instances | ||
| 98 | 100 | } |
| 99 | 101 | } |
| 100 | 102 | |
| 101 | 删除: public IEnumerable<DailyLogModel> GetDateRangelogList(DateTime start, DateTime end) | |
| 103 | 新增: public IEnumerable<DailyLogModel> GetDateRangelogList(DateTime start, DateTime end, int take = -1) | |
| 102 | 104 | { |
| 103 | 105 | |
| 104 | 106 | IEnumerable<AppModel> apps = appData.GetAllApps(); |
| 105 | 107 | |
| 106 | 删除: //using (var db = new StatisticContext()) | |
| 107 | 删除: //{ | |
| 108 | 删除: | |
| 109 | 删除: | |
| 110 | 删除: // //var test = db.DailyLog.Include(m=>m.AppModel).Where(m => m.AppModelID != 0).Take(4).ToList(); | |
| 111 | 删除: // //var res = db.DailyLog.Include(m => m.AppModel).SqlQuery("Select *,Sum(Time) as Time,DailyLogModels.ID,AppModelID,Date,AppModels.ID,AppModels.Name,AppModels.Description,AppModels.File,AppModels.CategoryID,AppModels.IconFile,AppModels.TotalTime from DailyLogModels LEFT OUTER JOIN AppModels ON AppModels.ID=DailyLogModels.ID WHERE AppModelID<>0 AND Date between '" + start.ToString("yyyy-MM-dd HH:mm:ss") + "' AND '" + end.ToString("yyyy-MM-dd HH:mm:ss") + "' GROUP BY AppModelID ").ToList(); | |
| 112 | 108 | using (var db = new TaiDbContext()) |
| 113 | 109 | { |
| 114 | 删除: //var res = db.DailyLog | |
| 115 | 删除: //.Include(m => m.AppModel) | |
| 116 | 删除: //.Where(m => m.Date >= start && m.Date <= end && m.AppModelID != 0) | |
| 117 | 删除: //.GroupBy(m => m.AppModelID) | |
| 118 | 删除: //.Select(m => new | |
| 119 | 删除: //{ | |
| 120 | 删除: // Time = m.Sum(a => a.Time), | |
| 121 | 删除: // App = m.FirstOrDefault().AppModel, | |
| 122 | 删除: // Date = m.FirstOrDefault().Date, | |
| 123 | 删除: //}) | |
| 124 | 删除: //.ToList() | |
| 125 | 删除: //.Select(m => new DailyLogModel | |
| 126 | 删除: //{ | |
| 127 | 删除: // Time = m.Time, | |
| 128 | 删除: // AppModel = m.App, | |
| 129 | 删除: // Date = m.Date | |
| 130 | 删除: //}); | |
| 131 | 删除: | |
| 132 | 删除: var res = db.DailyLog | |
| 110 | 新增: var data = take == -1 ? db.DailyLog | |
| 111 | 新增: .Where(m => m.Date >= start && m.Date <= end && m.AppModelID != 0) | |
| 112 | 新增: .GroupBy(m => m.AppModelID) | |
| 113 | 新增: .Select(m => new | |
| 114 | 新增: { | |
| 115 | 新增: Time = m.Sum(a => a.Time), | |
| 116 | 新增: Date = m.FirstOrDefault().Date, | |
| 117 | 新增: AppID = m.FirstOrDefault().AppModelID | |
| 118 | 新增: }) : db.DailyLog | |
| 133 | 119 | .Where(m => m.Date >= start && m.Date <= end && m.AppModelID != 0) |
| 134 | 120 | .GroupBy(m => m.AppModelID) |
| 135 | 121 | .Select(m => new |
| @@ -138,6 +124,9 @@ namespace Core.Servicers.Instances | ||
| 138 | 124 | Date = m.FirstOrDefault().Date, |
| 139 | 125 | AppID = m.FirstOrDefault().AppModelID |
| 140 | 126 | }) |
| 127 | 新增: .Take(take); | |
| 128 | 新增: | |
| 129 | 新增: var res = data | |
| 141 | 130 | .ToList() |
| 142 | 131 | .Select(m => new DailyLogModel |
| 143 | 132 | { |
| @@ -304,6 +293,151 @@ namespace Core.Servicers.Instances | ||
| 304 | 293 | } |
| 305 | 294 | } |
| 306 | 295 | |
| 296 | 新增: public struct CategoryHoursDataModel | |
| 297 | 新增: { | |
| 298 | 新增: public int Total { get; set; } | |
| 299 | 新增: public int CategoryID { get; set; } | |
| 300 | 新增: public DateTime Time { get; set; } | |
| 301 | 新增: | |
| 302 | 新增: } | |
| 303 | 新增: | |
| 304 | 新增: public List<CategoryChartDataModel> GetCategoryHoursData(DateTime date) | |
| 305 | 新增: { | |
| 306 | 新增: using (var db = new TaiDbContext()) | |
| 307 | 新增: { | |
| 308 | 新增: // 查出有数据的分类 | |
| 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 | 新增: | |
| 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 | 新增: | |
| 315 | 新增: | |
| 316 | 新增: List<CategoryChartDataModel> list = new List<CategoryChartDataModel>(); | |
| 317 | 新增: | |
| 318 | 新增: foreach (var category in categorys) | |
| 319 | 新增: { | |
| 320 | 新增: list.Add(new CategoryChartDataModel() | |
| 321 | 新增: { | |
| 322 | 新增: CategoryID = category.CategoryID, | |
| 323 | 新增: Values = new double[24] | |
| 324 | 新增: }); | |
| 325 | 新增: } | |
| 326 | 新增: | |
| 327 | 新增: for (int i = 0; i < 24; i++) | |
| 328 | 新增: { | |
| 329 | 新增: string hours = i < 10 ? "0" + i : i.ToString(); | |
| 330 | 新增: var time = date.ToString($"yyyy-MM-dd {hours}:00:00"); | |
| 331 | 新增: foreach (var category in categorys) | |
| 332 | 新增: { | |
| 333 | 新增: var log = data.Where(m => m.CategoryID == category.CategoryID && m.Time.ToString("yyyy-MM-dd HH:00:00") == time).FirstOrDefault(); | |
| 334 | 新增: | |
| 335 | 新增: var item = list.Where(m => m.CategoryID == category.CategoryID).FirstOrDefault(); | |
| 336 | 新增: | |
| 337 | 新增: item.Values[i] = log.Total; | |
| 338 | 新增: } | |
| 339 | 新增: } | |
| 340 | 新增: return list; | |
| 341 | 新增: } | |
| 342 | 新增: } | |
| 343 | 新增: | |
| 344 | 新增: public List<CategoryChartDataModel> GetCategoryRangeData(DateTime start, DateTime end) | |
| 345 | 新增: { | |
| 346 | 新增: using (var db = new TaiDbContext()) | |
| 347 | 新增: { | |
| 348 | 新增: // 查出有数据的分类 | |
| 349 | 新增: | |
| 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(); | |
| 351 | 新增: | |
| 352 | 新增: | |
| 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(); | |
| 354 | 新增: | |
| 355 | 新增: | |
| 356 | 新增: var ts = end - start; | |
| 357 | 新增: var days = ts.TotalDays + 1; | |
| 358 | 新增: | |
| 359 | 新增: | |
| 360 | 新增: List<CategoryChartDataModel> list = new List<CategoryChartDataModel>(); | |
| 361 | 新增: | |
| 362 | 新增: | |
| 363 | 新增: foreach (var category in categorys) | |
| 364 | 新增: { | |
| 365 | 新增: list.Add(new CategoryChartDataModel() | |
| 366 | 新增: { | |
| 367 | 新增: CategoryID = category.CategoryID, | |
| 368 | 新增: Values = new double[(int)days] | |
| 369 | 新增: }); | |
| 370 | 新增: } | |
| 371 | 新增: | |
| 372 | 新增: | |
| 373 | 新增: | |
| 374 | 新增: for (int i = 0; i < days; i++) | |
| 375 | 新增: { | |
| 376 | 新增: string day = i < 10 ? "0" + i : i.ToString(); | |
| 377 | 新增: var time = start.AddDays(i).ToString($"yyyy-MM-dd 00:00:00"); | |
| 378 | 新增: Debug.WriteLine(time); | |
| 379 | 新增: foreach (var category in categorys) | |
| 380 | 新增: { | |
| 381 | 新增: var log = data.Where(m => m.CategoryID == category.CategoryID && m.Time.ToString("yyyy-MM-dd 00:00:00") == time).FirstOrDefault(); | |
| 382 | 新增: | |
| 383 | 新增: var item = list.Where(m => m.CategoryID == category.CategoryID).FirstOrDefault(); | |
| 384 | 新增: | |
| 385 | 新增: item.Values[i] = log.Total; | |
| 386 | 新增: } | |
| 387 | 新增: } | |
| 388 | 新增: return list; | |
| 389 | 新增: } | |
| 390 | 新增: } | |
| 391 | 新增: | |
| 392 | 新增: public List<CategoryChartDataModel> GetCategoryYearData(DateTime date) | |
| 393 | 新增: { | |
| 394 | 新增: using (var db = new TaiDbContext()) | |
| 395 | 新增: { | |
| 396 | 新增: // 查出有数据的分类 | |
| 397 | 新增: | |
| 398 | 新增: var dateArr = Time.GetYearDate(date); | |
| 399 | 新增: | |
| 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(); | |
| 307 | 401 | |
| 402 | 新增: | |
| 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(); | |
| 404 | 新增: | |
| 405 | 新增: | |
| 406 | 新增: //var ts = end - start; | |
| 407 | 新增: //var days = ts.TotalDays + 1; | |
| 408 | 新增: | |
| 409 | 新增: | |
| 410 | 新增: List<CategoryChartDataModel> list = new List<CategoryChartDataModel>(); | |
| 411 | 新增: | |
| 412 | 新增: | |
| 413 | 新增: foreach (var category in categorys) | |
| 414 | 新增: { | |
| 415 | 新增: list.Add(new CategoryChartDataModel() | |
| 416 | 新增: { | |
| 417 | 新增: CategoryID = category.CategoryID, | |
| 418 | 新增: Values = new double[12] | |
| 419 | 新增: }); | |
| 420 | 新增: } | |
| 421 | 新增: | |
| 422 | 新增: | |
| 423 | 新增: | |
| 424 | 新增: for (int i = 1; i < 13; i++) | |
| 425 | 新增: { | |
| 426 | 新增: string month = i < 10 ? "0" + i : i.ToString(); | |
| 427 | 新增: var dayArr = Time.GetMonthDate(new DateTime(date.Year, i, 1)); | |
| 428 | 新增: | |
| 429 | 新增: Debug.WriteLine(dayArr); | |
| 430 | 新增: foreach (var category in categorys) | |
| 431 | 新增: { | |
| 432 | 新增: var total = data.Where(m => m.CategoryID == category.CategoryID && m.Time >= dayArr[0] && m.Time <= dayArr[1]).Sum(m => m.Total); | |
| 433 | 新增: | |
| 434 | 新增: var item = list.Where(m => m.CategoryID == category.CategoryID).FirstOrDefault(); | |
| 435 | 新增: | |
| 436 | 新增: item.Values[i - 1] = total; | |
| 437 | 新增: } | |
| 438 | 新增: } | |
| 439 | 新增: return list; | |
| 440 | 新增: } | |
| 441 | 新增: } | |
| 308 | 442 | } |
| 309 | 443 | } |
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | using Core.Models; |
| 2 | 新增:using Core.Models.Data; | |
| 2 | 3 | using System; |
| 3 | 4 | using System.Collections.Generic; |
| 4 | 5 | using System.Linq; |
| @@ -30,7 +31,7 @@ namespace Core.Servicers.Interfaces | ||
| 30 | 31 | /// <param name="start"></param> |
| 31 | 32 | /// <param name="end"></param> |
| 32 | 33 | /// <returns></returns> |
| 33 | 删除: IEnumerable<DailyLogModel> GetDateRangelogList(DateTime start, DateTime end); | |
| 34 | 新增: IEnumerable<DailyLogModel> GetDateRangelogList(DateTime start, DateTime end, int take = -1); | |
| 34 | 35 | |
| 35 | 36 | /// <summary> |
| 36 | 37 | /// 获取本周的数据 |
| @@ -71,5 +72,25 @@ namespace Core.Servicers.Interfaces | ||
| 71 | 72 | /// <param name="day"></param> |
| 72 | 73 | /// <returns></returns> |
| 73 | 74 | DailyLogModel GetProcess(int appID, DateTime day); |
| 75 | 新增: | |
| 76 | 新增: /// <summary> | |
| 77 | 新增: /// 获取指定日期所有分类时段统计数据 | |
| 78 | 新增: /// </summary> | |
| 79 | 新增: /// <returns></returns> | |
| 80 | 新增: List<CategoryChartDataModel> GetCategoryHoursData(DateTime date); | |
| 81 | 新增: /// <summary> | |
| 82 | 新增: /// 获取指定日期范围所有分类按天统计数据 | |
| 83 | 新增: /// </summary> | |
| 84 | 新增: /// <param name="start"></param> | |
| 85 | 新增: /// <param name="end"></param> | |
| 86 | 新增: /// <returns></returns> | |
| 87 | 新增: List<CategoryChartDataModel> GetCategoryRangeData(DateTime start, DateTime end); | |
| 88 | 新增: /// <summary> | |
| 89 | 新增: /// 获取指定年份所有分类按月份统计数据 | |
| 90 | 新增: /// </summary> | |
| 91 | 新增: /// <param name="date"></param> | |
| 92 | 新增: /// <returns></returns> | |
| 93 | 新增: List<CategoryChartDataModel> GetCategoryYearData(DateTime date); | |
| 94 | 新增: | |
| 74 | 95 | } |
| 75 | 96 | } |
| @@ -51,6 +51,11 @@ namespace UI | ||
| 51 | 51 | |
| 52 | 52 | DispatcherUnhandledException += App_DispatcherUnhandledException; |
| 53 | 53 | |
| 54 | 新增:#if DEBUG | |
| 55 | 新增: DispatcherUnhandledException -= App_DispatcherUnhandledException; | |
| 56 | 新增: | |
| 57 | 新增:#endif | |
| 58 | 新增: | |
| 54 | 59 | var serviceCollection = new ServiceCollection(); |
| 55 | 60 | ConfigureServices(serviceCollection); |
| 56 | 61 | serviceProvider = serviceCollection.BuildServiceProvider(); |
| @@ -183,6 +188,7 @@ namespace UI | ||
| 183 | 188 | services.AddSingleton<IAppConfig, AppConfig>(); |
| 184 | 189 | services.AddSingleton<IDateObserver, DateObserver>(); |
| 185 | 190 | services.AddSingleton<IAppData, AppData>(); |
| 191 | 新增: services.AddSingleton<ICategorys, Categorys>(); | |
| 186 | 192 | |
| 187 | 193 | // 主窗口 |
| 188 | 194 | services.AddSingleton<MainViewModel>(); |
| @@ -203,6 +209,18 @@ namespace UI | ||
| 203 | 209 | // 详情页 |
| 204 | 210 | services.AddTransient<DetailPage>(); |
| 205 | 211 | services.AddTransient<DetailPageVM>(); |
| 212 | 新增: | |
| 213 | 新增: // 分类 | |
| 214 | 新增: services.AddTransient<CategoryPage>(); | |
| 215 | 新增: services.AddTransient<CategoryPageVM>(); | |
| 216 | 新增: | |
| 217 | 新增: // 分类app | |
| 218 | 新增: services.AddTransient<CategoryAppListPage>(); | |
| 219 | 新增: services.AddTransient<CategoryAppListPageVM>(); | |
| 220 | 新增: | |
| 221 | 新增: // 图表 | |
| 222 | 新增: services.AddTransient<ChartPage>(); | |
| 223 | 新增: services.AddTransient<ChartPageVM>(); | |
| 206 | 224 | } |
| 207 | 225 | |
| 208 | 226 | private void OnStartup(object sender, StartupEventArgs e) |
| @@ -35,6 +35,8 @@ namespace UI.Base.Color | ||
| 35 | 35 | |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 新增: public static string[] MainColors = { "#15C38E", "#A761FF", "#C70B80", "#FFE6E6", "#00FFAB", "#B8F1B0", "#DAEAF1", "#1464DF", "#FF5C01", "#9EB23C", "#FF9999", "#998CEB", "#77E4D4", "#FD5E5E", "#B4FF9F", "#07FF01", "#FFE162", "#590696", "#97DBAE" }; | |
| 39 | 新增: | |
| 38 | 40 | public static IColor Get(ColorTypes color) |
| 39 | 41 | { |
| 40 | 42 | return ColorList[color]; |
| @@ -0,0 +1,86 @@ | ||
| 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 | 新增: | |
| 9 | 新增:namespace UI.Controls.Base | |
| 10 | 新增:{ | |
| 11 | 新增: public class View : ContentControl | |
| 12 | 新增: { | |
| 13 | 新增: public string Condition | |
| 14 | 新增: { | |
| 15 | 新增: get { return (string)GetValue(ConditionProperty); } | |
| 16 | 新增: set { SetValue(ConditionProperty, value); } | |
| 17 | 新增: } | |
| 18 | 新增: public static readonly DependencyProperty ConditionProperty = | |
| 19 | 新增: DependencyProperty.Register("Condition", | |
| 20 | 新增: typeof(string), | |
| 21 | 新增: typeof(View)); | |
| 22 | 新增: public object Value | |
| 23 | 新增: { | |
| 24 | 新增: get { return (object)GetValue(ValueProperty); } | |
| 25 | 新增: set { SetValue(ValueProperty, value); } | |
| 26 | 新增: } | |
| 27 | 新增: public static readonly DependencyProperty ValueProperty = | |
| 28 | 新增: DependencyProperty.Register("Value", | |
| 29 | 新增: typeof(object), | |
| 30 | 新增: typeof(View), new PropertyMetadata(new PropertyChangedCallback(OnPropertyChanged))); | |
| 31 | 新增: | |
| 32 | 新增: private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |
| 33 | 新增: { | |
| 34 | 新增: var control = d as View; | |
| 35 | 新增: control.Handle(); | |
| 36 | 新增: } | |
| 37 | 新增: | |
| 38 | 新增: public View() | |
| 39 | 新增: { | |
| 40 | 新增: DefaultStyleKey = typeof(View); | |
| 41 | 新增: } | |
| 42 | 新增: | |
| 43 | 新增: | |
| 44 | 新增: private void Handle() | |
| 45 | 新增: { | |
| 46 | 新增: if (string.IsNullOrEmpty(Condition) && Value == null) | |
| 47 | 新增: { | |
| 48 | 新增: return; | |
| 49 | 新增: } | |
| 50 | 新增: | |
| 51 | 新增: bool isShow = false; | |
| 52 | 新增: if (string.IsNullOrEmpty(Condition)) | |
| 53 | 新增: { | |
| 54 | 新增: if ((bool)Value) | |
| 55 | 新增: { | |
| 56 | 新增: isShow = true; | |
| 57 | 新增: } | |
| 58 | 新增: } | |
| 59 | 新增: else | |
| 60 | 新增: { | |
| 61 | 新增: | |
| 62 | 新增: | |
| 63 | 新增: if (Condition.IndexOf("=") != -1) | |
| 64 | 新增: { | |
| 65 | 新增: string val = Condition.Substring(Condition.IndexOf("=") + 1); | |
| 66 | 新增: isShow = val == Value.ToString(); | |
| 67 | 新增: } | |
| 68 | 新增: else | |
| 69 | 新增: { | |
| 70 | 新增: isShow = Condition == Value.ToString(); | |
| 71 | 新增: } | |
| 72 | 新增: } | |
| 73 | 新增: | |
| 74 | 新增: | |
| 75 | 新增: if (isShow) | |
| 76 | 新增: { | |
| 77 | 新增: Visibility = Visibility.Visible; | |
| 78 | 新增: } | |
| 79 | 新增: else | |
| 80 | 新增: { | |
| 81 | 新增: Visibility = Visibility.Collapsed; | |
| 82 | 新增: } | |
| 83 | 新增: | |
| 84 | 新增: } | |
| 85 | 新增: } | |
| 86 | 新增:} | |
| @@ -21,6 +21,16 @@ namespace UI.Controls.Button | ||
| 21 | 21 | DependencyProperty.Register("Command", |
| 22 | 22 | typeof(ICommand), |
| 23 | 23 | typeof(IconButton)); |
| 24 | 新增: | |
| 25 | 新增: public object CommandParameter | |
| 26 | 新增: { | |
| 27 | 新增: get { return (object)GetValue(CommandParameterProperty); } | |
| 28 | 新增: set { SetValue(CommandParameterProperty, value); } | |
| 29 | 新增: } | |
| 30 | 新增: public static readonly DependencyProperty CommandParameterProperty = | |
| 31 | 新增: DependencyProperty.Register("CommandParameter", | |
| 32 | 新增: typeof(object), | |
| 33 | 新增: typeof(IconButton)); | |
| 24 | 34 | public IconTypes Icon |
| 25 | 35 | { |
| 26 | 36 | get { return (IconTypes)GetValue(IconProperty); } |
| @@ -39,7 +49,7 @@ namespace UI.Controls.Button | ||
| 39 | 49 | { |
| 40 | 50 | base.OnMouseLeftButtonUp(e); |
| 41 | 51 | |
| 42 | 删除: Command?.Execute(null); | |
| 52 | 新增: Command?.Execute(CommandParameter); | |
| 43 | 53 | } |
| 44 | 54 | protected override void OnMouseEnter(MouseEventArgs e) |
| 45 | 55 | { |
| @@ -0,0 +1,14 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Linq; | |
| 4 | 新增:using System.Text; | |
| 5 | 新增:using System.Threading.Tasks; | |
| 6 | 新增: | |
| 7 | 新增:namespace UI.Controls.Charts | |
| 8 | 新增:{ | |
| 9 | 新增: public enum ChartDataValueType | |
| 10 | 新增: { | |
| 11 | 新增: Seconds, | |
| 12 | 新增: Number | |
| 13 | 新增: } | |
| 14 | 新增:} | |
| @@ -0,0 +1,148 @@ | ||
| 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.Input; | |
| 9 | 新增:using System.Windows.Shapes; | |
| 10 | 新增:using UI.Base.Color; | |
| 11 | 新增: | |
| 12 | 新增:namespace UI.Controls.Charts | |
| 13 | 新增:{ | |
| 14 | 新增: public class ChartItemTypeColumn : Control | |
| 15 | 新增: { | |
| 16 | 新增: #region MaxValue 最大值 | |
| 17 | 新增: /// <summary> | |
| 18 | 新增: /// 样式类型 | |
| 19 | 新增: /// </summary> | |
| 20 | 新增: public double MaxValue | |
| 21 | 新增: { | |
| 22 | 新增: get { return (double)GetValue(MaxValueProperty); } | |
| 23 | 新增: set { SetValue(MaxValueProperty, value); } | |
| 24 | 新增: } | |
| 25 | 新增: public static readonly DependencyProperty MaxValueProperty = | |
| 26 | 新增: DependencyProperty.Register("MaxValue", | |
| 27 | 新增: typeof(double), | |
| 28 | 新增: typeof(ChartItemTypeColumn)); | |
| 29 | 新增: | |
| 30 | 新增: | |
| 31 | 新增: #endregion | |
| 32 | 新增: | |
| 33 | 新增: #region 值 | |
| 34 | 新增: /// <summary> | |
| 35 | 新增: /// 样式类型 | |
| 36 | 新增: /// </summary> | |
| 37 | 新增: public double Value | |
| 38 | 新增: { | |
| 39 | 新增: get { return (double)GetValue(ValueProperty); } | |
| 40 | 新增: set { SetValue(ValueProperty, value); } | |
| 41 | 新增: } | |
| 42 | 新增: public static readonly DependencyProperty ValueProperty = | |
| 43 | 新增: DependencyProperty.Register("Value", | |
| 44 | 新增: typeof(double), | |
| 45 | 新增: typeof(ChartItemTypeColumn)); | |
| 46 | 新增: | |
| 47 | 新增: | |
| 48 | 新增: #endregion | |
| 49 | 新增: #region 颜色 | |
| 50 | 新增: /// <summary> | |
| 51 | 新增: /// 样式类型 | |
| 52 | 新增: /// </summary> | |
| 53 | 新增: public string Color | |
| 54 | 新增: { | |
| 55 | 新增: get { return (string)GetValue(ColorProperty); } | |
| 56 | 新增: set { SetValue(ColorProperty, value); } | |
| 57 | 新增: } | |
| 58 | 新增: public static readonly DependencyProperty ColorProperty = | |
| 59 | 新增: DependencyProperty.Register("Color", | |
| 60 | 新增: typeof(string), | |
| 61 | 新增: typeof(ChartItemTypeColumn)); | |
| 62 | 新增: | |
| 63 | 新增: | |
| 64 | 新增: #endregion | |
| 65 | 新增: #region 列名 | |
| 66 | 新增: /// <summary> | |
| 67 | 新增: /// 样式类型 | |
| 68 | 新增: /// </summary> | |
| 69 | 新增: public string ColumnName | |
| 70 | 新增: { | |
| 71 | 新增: get { return (string)GetValue(ColumnNameProperty); } | |
| 72 | 新增: set { SetValue(ColumnNameProperty, value); } | |
| 73 | 新增: } | |
| 74 | 新增: public static readonly DependencyProperty ColumnNameProperty = | |
| 75 | 新增: DependencyProperty.Register("ColumnName", | |
| 76 | 新增: typeof(string), | |
| 77 | 新增: typeof(ChartItemTypeColumn)); | |
| 78 | 新增: | |
| 79 | 新增: | |
| 80 | 新增: #endregion | |
| 81 | 新增: | |
| 82 | 新增: private bool isRendering = false; | |
| 83 | 新增: private Rectangle ValueBlockObj; | |
| 84 | 新增: private Grid ValueContainer; | |
| 85 | 新增: | |
| 86 | 新增: public ChartItemTypeColumn() | |
| 87 | 新增: { | |
| 88 | 新增: DefaultStyleKey = typeof(ChartItemTypeColumn); | |
| 89 | 新增: } | |
| 90 | 新增: | |
| 91 | 新增: public override void OnApplyTemplate() | |
| 92 | 新增: { | |
| 93 | 新增: base.OnApplyTemplate(); | |
| 94 | 新增: ValueBlockObj = GetTemplateChild("ValueBlockObj") as Rectangle; | |
| 95 | 新增: ValueContainer = GetTemplateChild("ValueContainer") as Grid; | |
| 96 | 新增: | |
| 97 | 新增: Loaded += ChartItemTypeColumn_Loaded; | |
| 98 | 新增: } | |
| 99 | 新增: | |
| 100 | 新增: private void ChartItemTypeColumn_Loaded(object sender, RoutedEventArgs e) | |
| 101 | 新增: { | |
| 102 | 新增: Render(); | |
| 103 | 新增: | |
| 104 | 新增: } | |
| 105 | 新增: | |
| 106 | 新增: | |
| 107 | 新增: private void Render() | |
| 108 | 新增: { | |
| 109 | 新增: if (isRendering) | |
| 110 | 新增: { | |
| 111 | 新增: return; | |
| 112 | 新增: } | |
| 113 | 新增: | |
| 114 | 新增: if (!string.IsNullOrEmpty(Color)) | |
| 115 | 新增: { | |
| 116 | 新增: ValueBlockObj.Fill = Colors.GetFromString(Color); | |
| 117 | 新增: } | |
| 118 | 新增: //isRendering = true; | |
| 119 | 新增: | |
| 120 | 新增: Update(); | |
| 121 | 新增: //this.SizeChanged += (e, c) => | |
| 122 | 新增: //{ | |
| 123 | 新增: // if (MaxValue <= 0) | |
| 124 | 新增: // { | |
| 125 | 新增: // return; | |
| 126 | 新增: // } | |
| 127 | 新增: // Update(); | |
| 128 | 新增: //}; | |
| 129 | 新增: } | |
| 130 | 新增: | |
| 131 | 新增: public void Update() | |
| 132 | 新增: { | |
| 133 | 新增: | |
| 134 | 新增: ValueBlockObj.Height = (Value / MaxValue) * (ValueContainer.ActualHeight); | |
| 135 | 新增: } | |
| 136 | 新增: | |
| 137 | 新增: protected override void OnMouseEnter(MouseEventArgs e) | |
| 138 | 新增: { | |
| 139 | 新增: base.OnMouseEnter(e); | |
| 140 | 新增: VisualStateManager.GoToState(this, "MouseOver", true); | |
| 141 | 新增: } | |
| 142 | 新增: protected override void OnMouseLeave(MouseEventArgs e) | |
| 143 | 新增: { | |
| 144 | 新增: base.OnMouseLeave(e); | |
| 145 | 新增: VisualStateManager.GoToState(this, "NormalState", true); | |
| 146 | 新增: } | |
| 147 | 新增: } | |
| 148 | 新增:} | |
| @@ -1,4 +1,5 @@ | ||
| 1 | 删除:using System; | |
| 1 | 新增:using Core.Librarys; | |
| 2 | 新增:using System; | |
| 2 | 3 | using System.Collections.Generic; |
| 3 | 4 | using System.Diagnostics; |
| 4 | 5 | using System.Linq; |
| @@ -158,6 +159,142 @@ namespace UI.Controls.Charts | ||
| 158 | 159 | |
| 159 | 160 | |
| 160 | 161 | #endregion |
| 162 | 新增: #region 柱状图信息数据 | |
| 163 | 新增: /// <summary> | |
| 164 | 新增: /// 柱状图信息数据 | |
| 165 | 新增: /// </summary> | |
| 166 | 新增: public List<ChartColumnInfoModel> ColumnInfoList | |
| 167 | 新增: { | |
| 168 | 新增: get { return (List<ChartColumnInfoModel>)GetValue(ColumnInfoListProperty); } | |
| 169 | 新增: set { SetValue(ColumnInfoListProperty, value); } | |
| 170 | 新增: } | |
| 171 | 新增: public static readonly DependencyProperty ColumnInfoListProperty = | |
| 172 | 新增: DependencyProperty.Register("ColumnInfoList", | |
| 173 | 新增: typeof(List<ChartColumnInfoModel>), | |
| 174 | 新增: typeof(Charts) | |
| 175 | 新增: ); | |
| 176 | 新增: | |
| 177 | 新增: | |
| 178 | 新增: #endregion | |
| 179 | 新增: #region 中间值 | |
| 180 | 新增: /// <summary> | |
| 181 | 新增: /// 中间值 | |
| 182 | 新增: /// </summary> | |
| 183 | 新增: public string Median | |
| 184 | 新增: { | |
| 185 | 新增: get { return (string)GetValue(MedianProperty); } | |
| 186 | 新增: set { SetValue(MedianProperty, value); } | |
| 187 | 新增: } | |
| 188 | 新增: public static readonly DependencyProperty MedianProperty = | |
| 189 | 新增: DependencyProperty.Register("Median", | |
| 190 | 新增: typeof(string), | |
| 191 | 新增: typeof(Charts) | |
| 192 | 新增: ); | |
| 193 | 新增: | |
| 194 | 新增: | |
| 195 | 新增: #endregion | |
| 196 | 新增: #region 最大值 | |
| 197 | 新增: /// <summary> | |
| 198 | 新增: /// 最大值 | |
| 199 | 新增: /// </summary> | |
| 200 | 新增: public string Maximum | |
| 201 | 新增: { | |
| 202 | 新增: get { return (string)GetValue(MaximumProperty); } | |
| 203 | 新增: set { SetValue(MaximumProperty, value); } | |
| 204 | 新增: } | |
| 205 | 新增: public static readonly DependencyProperty MaximumProperty = | |
| 206 | 新增: DependencyProperty.Register("Maximum", | |
| 207 | 新增: typeof(string), | |
| 208 | 新增: typeof(Charts) | |
| 209 | 新增: ); | |
| 210 | 新增: | |
| 211 | 新增: | |
| 212 | 新增: #endregion | |
| 213 | 新增: #region 单位 | |
| 214 | 新增: /// <summary> | |
| 215 | 新增: /// 单位 | |
| 216 | 新增: /// </summary> | |
| 217 | 新增: public string Unit | |
| 218 | 新增: { | |
| 219 | 新增: get { return (string)GetValue(UnitProperty); } | |
| 220 | 新增: set { SetValue(UnitProperty, value); } | |
| 221 | 新增: } | |
| 222 | 新增: public static readonly DependencyProperty UnitProperty = | |
| 223 | 新增: DependencyProperty.Register("Unit", | |
| 224 | 新增: typeof(string), | |
| 225 | 新增: typeof(Charts) | |
| 226 | 新增: ); | |
| 227 | 新增: | |
| 228 | 新增: | |
| 229 | 新增: #endregion | |
| 230 | 新增: #region 总计 | |
| 231 | 新增: /// <summary> | |
| 232 | 新增: /// 总计 | |
| 233 | 新增: /// </summary> | |
| 234 | 新增: public string Total | |
| 235 | 新增: { | |
| 236 | 新增: get { return (string)GetValue(TotalProperty); } | |
| 237 | 新增: set { SetValue(TotalProperty, value); } | |
| 238 | 新增: } | |
| 239 | 新增: public static readonly DependencyProperty TotalProperty = | |
| 240 | 新增: DependencyProperty.Register("Total", | |
| 241 | 新增: typeof(string), | |
| 242 | 新增: typeof(Charts) | |
| 243 | 新增: ); | |
| 244 | 新增: | |
| 245 | 新增: | |
| 246 | 新增: #endregion | |
| 247 | 新增: | |
| 248 | 新增: #region 数据值类型 | |
| 249 | 新增: /// <summary> | |
| 250 | 新增: /// 数据值类型 | |
| 251 | 新增: /// </summary> | |
| 252 | 新增: public ChartDataValueType DataValueType | |
| 253 | 新增: { | |
| 254 | 新增: get { return (ChartDataValueType)GetValue(DataValueTypeProperty); } | |
| 255 | 新增: set { SetValue(DataValueTypeProperty, value); } | |
| 256 | 新增: } | |
| 257 | 新增: public static readonly DependencyProperty DataValueTypeProperty = | |
| 258 | 新增: DependencyProperty.Register("DataValueType", | |
| 259 | 新增: typeof(ChartDataValueType), | |
| 260 | 新增: typeof(Charts) | |
| 261 | 新增: ); | |
| 262 | 新增: | |
| 263 | 新增: | |
| 264 | 新增: #endregion | |
| 265 | 新增: #region | |
| 266 | 新增: | |
| 267 | 新增: public int NameIndexStart | |
| 268 | 新增: { | |
| 269 | 新增: get { return (int)GetValue(NameIndexStartProperty); } | |
| 270 | 新增: set { SetValue(NameIndexStartProperty, value); } | |
| 271 | 新增: } | |
| 272 | 新增: public static readonly DependencyProperty NameIndexStartProperty = | |
| 273 | 新增: DependencyProperty.Register("NameIndexStart", | |
| 274 | 新增: typeof(int), | |
| 275 | 新增: typeof(Charts), new PropertyMetadata((int)0) | |
| 276 | 新增: ); | |
| 277 | 新增: | |
| 278 | 新增: | |
| 279 | 新增: #endregion | |
| 280 | 新增: #region 是否空数据 | |
| 281 | 新增: /// <summary> | |
| 282 | 新增: /// 是否空数据 | |
| 283 | 新增: /// </summary> | |
| 284 | 新增: public bool IsEmpty | |
| 285 | 新增: { | |
| 286 | 新增: get { return (bool)GetValue(IsEmptyProperty); } | |
| 287 | 新增: set { SetValue(IsEmptyProperty, value); } | |
| 288 | 新增: } | |
| 289 | 新增: public static readonly DependencyProperty IsEmptyProperty = | |
| 290 | 新增: DependencyProperty.Register("IsEmpty", | |
| 291 | 新增: typeof(bool), | |
| 292 | 新增: typeof(Charts), | |
| 293 | 新增: new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |
| 294 | 新增: | |
| 295 | 新增: | |
| 296 | 新增: #endregion | |
| 297 | 新增: | |
| 161 | 298 | private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
| 162 | 299 | { |
| 163 | 300 | var charts = (d as Charts); |
| @@ -191,6 +328,7 @@ namespace UI.Controls.Charts | ||
| 191 | 328 | private WrapPanel CardContainer; |
| 192 | 329 | private Grid MonthContainer; |
| 193 | 330 | private ScrollViewer ScrollViewer; |
| 331 | 新增: private Grid ColumnContainer; | |
| 194 | 332 | /// <summary> |
| 195 | 333 | /// 是否在渲染中 |
| 196 | 334 | /// </summary> |
| @@ -224,6 +362,7 @@ namespace UI.Controls.Charts | ||
| 224 | 362 | MonthContainer = GetTemplateChild("MonthContainer") as Grid; |
| 225 | 363 | ScrollViewer = GetTemplateChild("ScrollViewer") as ScrollViewer; |
| 226 | 364 | NoScrollContainer = GetTemplateChild("NoScrollContainer") as StackPanel; |
| 365 | 新增: ColumnContainer = GetTemplateChild("ColumnContainer") as Grid; | |
| 227 | 366 | |
| 228 | 367 | if (IsLoading) |
| 229 | 368 | { |
| @@ -273,7 +412,7 @@ namespace UI.Controls.Charts | ||
| 273 | 412 | } |
| 274 | 413 | private void Calculate() |
| 275 | 414 | { |
| 276 | 删除: if (Data == null) | |
| 415 | 新增: if (Data == null || ChartsType == ChartsType.Column) | |
| 277 | 416 | { |
| 278 | 417 | return; |
| 279 | 418 | } |
| @@ -295,7 +434,7 @@ namespace UI.Controls.Charts | ||
| 295 | 434 | |
| 296 | 435 | private void Render() |
| 297 | 436 | { |
| 298 | 删除: if (isRendering || Container == null || CardContainer == null) | |
| 437 | 新增: if (isRendering || Container == null || CardContainer == null || ColumnContainer == null) | |
| 299 | 438 | { |
| 300 | 439 | return; |
| 301 | 440 | } |
| @@ -315,14 +454,20 @@ namespace UI.Controls.Charts | ||
| 315 | 454 | CardContainer.Children.Clear(); |
| 316 | 455 | MonthContainer.Children.Clear(); |
| 317 | 456 | NoScrollContainer.Children.Clear(); |
| 457 | 新增: ColumnContainer.Children.Clear(); | |
| 318 | 458 | |
| 319 | 459 | if (Data == null || Data.Count() <= 0) |
| 320 | 460 | { |
| 321 | 461 | Container.Children.Add(new EmptyData()); |
| 322 | 462 | NoScrollContainer.Children.Add(new EmptyData()); |
| 323 | 463 | CardContainer.Children.Add(new EmptyData()); |
| 464 | 新增: IsEmpty = true; | |
| 324 | 465 | return; |
| 325 | 466 | } |
| 467 | 新增: else | |
| 468 | 新增: { | |
| 469 | 新增: IsEmpty = false; | |
| 470 | 新增: } | |
| 326 | 471 | |
| 327 | 472 | isRendering = true; |
| 328 | 473 | switch (ChartsType) |
| @@ -336,6 +481,9 @@ namespace UI.Controls.Charts | ||
| 336 | 481 | case ChartsType.Month: |
| 337 | 482 | RenderMonthStyle(); |
| 338 | 483 | break; |
| 484 | 新增: case ChartsType.Column: | |
| 485 | 新增: RenderColumnStyle(); | |
| 486 | 新增: break; | |
| 339 | 487 | } |
| 340 | 488 | |
| 341 | 489 | } |
| @@ -615,6 +763,130 @@ namespace UI.Controls.Charts | ||
| 615 | 763 | } |
| 616 | 764 | #endregion |
| 617 | 765 | |
| 766 | 新增: #region 渲染柱形图 | |
| 767 | 新增: private void RenderColumnStyle() | |
| 768 | 新增: { | |
| 769 | 新增: ColumnContainer.Children.Clear(); | |
| 770 | 新增: ColumnInfoList = new List<ChartColumnInfoModel>(); | |
| 771 | 新增: ColumnContainer.ColumnDefinitions.Clear(); | |
| 772 | 新增: maxValue = 0; | |
| 773 | 新增: | |
| 774 | 新增: Maximum = string.Empty; | |
| 775 | 新增: Median = string.Empty; | |
| 776 | 新增: Total = string.Empty; | |
| 777 | 新增: | |
| 778 | 新增: if (Data == null || Data.Count() == 0) | |
| 779 | 新增: { | |
| 780 | 新增: return; | |
| 781 | 新增: } | |
| 782 | 新增: | |
| 783 | 新增: | |
| 784 | 新增: | |
| 785 | 新增: | |
| 786 | 新增: double total = 0; | |
| 787 | 新增: // 查找最大值 | |
| 788 | 新增: foreach (var item in Data) | |
| 789 | 新增: { | |
| 790 | 新增: // 查找最大值 | |
| 791 | 新增: double max = item.Values.Max(); | |
| 792 | 新增: if (max > maxValue) | |
| 793 | 新增: { | |
| 794 | 新增: maxValue = max; | |
| 795 | 新增: } | |
| 796 | 新增: | |
| 797 | 新增: total += item.Values.Sum(); | |
| 798 | 新增: | |
| 799 | 新增: } | |
| 800 | 新增: | |
| 801 | 新增: Maximum = Covervalue(maxValue); | |
| 802 | 新增: | |
| 803 | 新增: Median = Covervalue((maxValue / 2)); | |
| 804 | 新增: | |
| 805 | 新增: Total = Covervalue(total); | |
| 806 | 新增: | |
| 807 | 新增: int margin = 5; | |
| 808 | 新增: | |
| 809 | 新增: | |
| 810 | 新增: | |
| 811 | 新增: // 创建列 | |
| 812 | 新增: int columns = Data.FirstOrDefault().Values.Length; | |
| 813 | 新增: | |
| 814 | 新增: | |
| 815 | 新增: // 调整间距 | |
| 816 | 新增: if (columns <= 7) | |
| 817 | 新增: { | |
| 818 | 新增: margin = 25; | |
| 819 | 新增: } | |
| 820 | 新增: else if (columns <= 12) | |
| 821 | 新增: { | |
| 822 | 新增: margin = 15; | |
| 823 | 新增: } | |
| 824 | 新增: else if (columns >= 20) | |
| 825 | 新增: { | |
| 826 | 新增: margin = 2; | |
| 827 | 新增: } | |
| 828 | 新增: | |
| 829 | 新增: int columnCount = Data.Count(); | |
| 830 | 新增: | |
| 831 | 新增: var list = Data.ToList(); | |
| 832 | 新增: | |
| 833 | 新增: for (int i = 0; i < columns; i++) | |
| 834 | 新增: { | |
| 835 | 新增: ColumnContainer.ColumnDefinitions.Add(new ColumnDefinition() | |
| 836 | 新增: { | |
| 837 | 新增: Width = new GridLength(1, GridUnitType.Star) | |
| 838 | 新增: }); | |
| 839 | 新增: | |
| 840 | 新增: | |
| 841 | 新增: for (int di = 0; di < columnCount; di++) | |
| 842 | 新增: { | |
| 843 | 新增: var item = list[di]; | |
| 844 | 新增: item.Color = item.Color == null ? UI.Base.Color.Colors.MainColors[di] : item.Color; | |
| 845 | 新增: var column = new ChartItemTypeColumn(); | |
| 846 | 新增: column.Value = item.Values[i]; | |
| 847 | 新增: column.MaxValue = maxValue; | |
| 848 | 新增: column.Margin = new Thickness(margin, 0, margin, 0); | |
| 849 | 新增: | |
| 850 | 新增: column.Color = item.Color; | |
| 851 | 新增: column.ColumnName = item.ColumnNames != null && item.ColumnNames.Length > 0 ? item.ColumnNames[i] : (i + NameIndexStart).ToString(); | |
| 852 | 新增: Panel.SetZIndex(column, column.Value > 0 ? -(int)column.Value : 0); | |
| 853 | 新增: Grid.SetColumn(column, i); | |
| 854 | 新增: ColumnContainer.Children.Add(column); | |
| 855 | 新增: } | |
| 856 | 新增: | |
| 857 | 新增: | |
| 858 | 新增: } | |
| 859 | 新增: | |
| 860 | 新增: var infoList = new List<ChartColumnInfoModel>(); | |
| 861 | 新增: | |
| 862 | 新增: foreach (var item in list) | |
| 863 | 新增: { | |
| 864 | 新增: infoList.Add(new ChartColumnInfoModel() | |
| 865 | 新增: { | |
| 866 | 新增: Color = item.Color, | |
| 867 | 新增: Name = item.Name, | |
| 868 | 新增: Icon = item.Icon, | |
| 869 | 新增: Text = Covervalue(item.Values.Sum()) + Unit | |
| 870 | 新增: }); | |
| 871 | 新增: } | |
| 872 | 新增: | |
| 873 | 新增: ColumnInfoList = infoList; | |
| 874 | 新增: | |
| 875 | 新增: isRendering = false; | |
| 876 | 新增: } | |
| 877 | 新增: #endregion | |
| 878 | 新增: | |
| 879 | 新增: private string Covervalue(double value) | |
| 880 | 新增: { | |
| 881 | 新增: if (DataValueType == ChartDataValueType.Seconds) | |
| 882 | 新增: { | |
| 883 | 新增: return Time.ToString((int)value); | |
| 884 | 新增: } | |
| 885 | 新增: else | |
| 886 | 新增: { | |
| 887 | 新增: return value.ToString(); | |
| 888 | 新增: } | |
| 889 | 新增: } | |
| 618 | 890 | |
| 619 | 891 | private void HandleItemClick(UIElement el, ChartsDataModel data) |
| 620 | 892 | { |
| @@ -22,6 +22,10 @@ namespace UI.Controls.Charts | ||
| 22 | 22 | /// <summary> |
| 23 | 23 | /// 月份 |
| 24 | 24 | /// </summary> |
| 25 | 删除: Month = 3 | |
| 25 | 新增: Month = 3, | |
| 26 | 新增: /// <summary> | |
| 27 | 新增: /// 柱形图 | |
| 28 | 新增: /// </summary> | |
| 29 | 新增: Column = 4, | |
| 26 | 30 | } |
| 27 | 31 | } |
| @@ -0,0 +1,17 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Linq; | |
| 4 | 新增:using System.Text; | |
| 5 | 新增:using System.Threading.Tasks; | |
| 6 | 新增: | |
| 7 | 新增:namespace UI.Controls.Charts.Model | |
| 8 | 新增:{ | |
| 9 | 新增: public class ChartColumnInfoModel | |
| 10 | 新增: { | |
| 11 | 新增: public string Color { get; set; } | |
| 12 | 新增: public string Name { get; set; } | |
| 13 | 新增: public string Icon { get; set; } | |
| 14 | 新增: public string Text { get; set; } | |
| 15 | 新增: | |
| 16 | 新增: } | |
| 17 | 新增:} | |
| @@ -43,5 +43,18 @@ namespace UI.Controls.Charts.Model | ||
| 43 | 43 | /// 数据模型 |
| 44 | 44 | /// </summary> |
| 45 | 45 | public object Data { get; set; } |
| 46 | 新增: | |
| 47 | 新增: /// <summary> | |
| 48 | 新增: /// 值 | |
| 49 | 新增: /// </summary> | |
| 50 | 新增: public double[] Values { get; set; } | |
| 51 | 新增: /// <summary> | |
| 52 | 新增: /// 列名 | |
| 53 | 新增: /// </summary> | |
| 54 | 新增: public string[] ColumnNames { get; set; } | |
| 55 | 新增: /// <summary> | |
| 56 | 新增: /// 颜色 | |
| 57 | 新增: /// </summary> | |
| 58 | 新增: public string Color { get; set; } | |
| 46 | 59 | } |
| 47 | 60 | } |
| @@ -0,0 +1,25 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Globalization; | |
| 4 | 新增:using System.Linq; | |
| 5 | 新增:using System.Text; | |
| 6 | 新增:using System.Threading.Tasks; | |
| 7 | 新增:using System.Windows.Data; | |
| 8 | 新增:using System.Windows.Media; | |
| 9 | 新增: | |
| 10 | 新增:namespace UI.Controls.Converters | |
| 11 | 新增:{ | |
| 12 | 新增: [ValueConversion(typeof(string), typeof(Brush))] | |
| 13 | 新增: public class HextoColorConverter : IValueConverter | |
| 14 | 新增: { | |
| 15 | 新增: public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
| 16 | 新增: { | |
| 17 | 新增: return UI.Base.Color.Colors.GetFromString(value.ToString()); | |
| 18 | 新增: } | |
| 19 | 新增: | |
| 20 | 新增: public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |
| 21 | 新增: { | |
| 22 | 新增: throw new NotImplementedException(); | |
| 23 | 新增: } | |
| 24 | 新增: } | |
| 25 | 新增:} | |
| @@ -0,0 +1,25 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Globalization; | |
| 4 | 新增:using System.Linq; | |
| 5 | 新增:using System.Text; | |
| 6 | 新增:using System.Threading.Tasks; | |
| 7 | 新增:using System.Windows.Data; | |
| 8 | 新增:using System.Windows.Media; | |
| 9 | 新增: | |
| 10 | 新增:namespace UI.Controls.Converters | |
| 11 | 新增:{ | |
| 12 | 新增: [ValueConversion(typeof(object), typeof(string))] | |
| 13 | 新增: public class ToStringConverter : IValueConverter | |
| 14 | 新增: { | |
| 15 | 新增: public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
| 16 | 新增: { | |
| 17 | 新增: return value.ToString(); | |
| 18 | 新增: } | |
| 19 | 新增: | |
| 20 | 新增: public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |
| 21 | 新增: { | |
| 22 | 新增: throw new NotImplementedException(); | |
| 23 | 新增: } | |
| 24 | 新增: } | |
| 25 | 新增:} | |
| @@ -0,0 +1,302 @@ | ||
| 1 | 新增:using Core.Librarys; | |
| 2 | 新增:using System; | |
| 3 | 新增:using System.Collections.Generic; | |
| 4 | 新增:using System.Diagnostics; | |
| 5 | 新增:using System.Linq; | |
| 6 | 新增:using System.Runtime.InteropServices; | |
| 7 | 新增:using System.Text; | |
| 8 | 新增:using System.Threading.Tasks; | |
| 9 | 新增:using System.Windows; | |
| 10 | 新增:using System.Windows.Controls; | |
| 11 | 新增:using System.Windows.Controls.Primitives; | |
| 12 | 新增:using System.Windows.Input; | |
| 13 | 新增:using System.Windows.Shapes; | |
| 14 | 新增:using UI.Controls.DatePickerBar; | |
| 15 | 新增: | |
| 16 | 新增:namespace UI.Controls.Select | |
| 17 | 新增:{ | |
| 18 | 新增: public class DateSelect : Control | |
| 19 | 新增: { | |
| 20 | 新增: public DateSelectType SelectType | |
| 21 | 新增: { | |
| 22 | 新增: get { return (DateSelectType)GetValue(SelectTypeProperty); } | |
| 23 | 新增: set { SetValue(SelectTypeProperty, value); } | |
| 24 | 新增: } | |
| 25 | 新增: public static readonly DependencyProperty SelectTypeProperty = | |
| 26 | 新增: DependencyProperty.Register("SelectType", | |
| 27 | 新增: typeof(DateSelectType), | |
| 28 | 新增: typeof(DateSelect), | |
| 29 | 新增: new PropertyMetadata(DateSelectType.Day) | |
| 30 | 新增: ); | |
| 31 | 新增: public DateTime Date | |
| 32 | 新增: { | |
| 33 | 新增: get { return (DateTime)GetValue(DateProperty); } | |
| 34 | 新增: set { SetValue(DateProperty, value); } | |
| 35 | 新增: } | |
| 36 | 新增: public static readonly DependencyProperty DateProperty = | |
| 37 | 新增: DependencyProperty.Register("Date", | |
| 38 | 新增: typeof(DateTime), | |
| 39 | 新增: typeof(DateSelect), | |
| 40 | 新增: new PropertyMetadata(DateTime.Now) | |
| 41 | 新增: ); | |
| 42 | 新增: | |
| 43 | 新增: public int Year | |
| 44 | 新增: { | |
| 45 | 新增: get { return (int)GetValue(YearProperty); } | |
| 46 | 新增: set { SetValue(YearProperty, value); } | |
| 47 | 新增: } | |
| 48 | 新增: public static readonly DependencyProperty YearProperty = | |
| 49 | 新增: DependencyProperty.Register("Year", | |
| 50 | 新增: typeof(int), | |
| 51 | 新增: typeof(DateSelect) | |
| 52 | 新增: ); | |
| 53 | 新增: | |
| 54 | 新增: public int Month | |
| 55 | 新增: { | |
| 56 | 新增: get { return (int)GetValue(MonthProperty); } | |
| 57 | 新增: set { SetValue(MonthProperty, value); } | |
| 58 | 新增: } | |
| 59 | 新增: public static readonly DependencyProperty MonthProperty = | |
| 60 | 新增: DependencyProperty.Register("Month", | |
| 61 | 新增: typeof(int), | |
| 62 | 新增: typeof(DateSelect) | |
| 63 | 新增: ); | |
| 64 | 新增: | |
| 65 | 新增: public string Day | |
| 66 | 新增: { | |
| 67 | 新增: get { return (string)GetValue(DayProperty); } | |
| 68 | 新增: set { SetValue(DayProperty, value); } | |
| 69 | 新增: } | |
| 70 | 新增: public static readonly DependencyProperty DayProperty = | |
| 71 | 新增: DependencyProperty.Register("Day", | |
| 72 | 新增: typeof(string), | |
| 73 | 新增: typeof(DateSelect) | |
| 74 | 新增: ); | |
| 75 | 新增: public string DateStr | |
| 76 | 新增: { | |
| 77 | 新增: get { return (string)GetValue(DateStrProperty); } | |
| 78 | 新增: set { SetValue(DateStrProperty, value); } | |
| 79 | 新增: } | |
| 80 | 新增: public static readonly DependencyProperty DateStrProperty = | |
| 81 | 新增: DependencyProperty.Register("DateStr", | |
| 82 | 新增: typeof(string), | |
| 83 | 新增: typeof(DateSelect) | |
| 84 | 新增: ); | |
| 85 | 新增: public List<string> Days | |
| 86 | 新增: { | |
| 87 | 新增: get { return (List<string>)GetValue(DaysProperty); } | |
| 88 | 新增: set { SetValue(DaysProperty, value); } | |
| 89 | 新增: } | |
| 90 | 新增: public static readonly DependencyProperty DaysProperty = | |
| 91 | 新增: DependencyProperty.Register("Days", | |
| 92 | 新增: typeof(List<string>), | |
| 93 | 新增: typeof(DateSelect) | |
| 94 | 新增: ); | |
| 95 | 新增: | |
| 96 | 新增: public bool IsOpen | |
| 97 | 新增: { | |
| 98 | 新增: get { return (bool)GetValue(IsOpenProperty); } | |
| 99 | 新增: set { SetValue(IsOpenProperty, value); } | |
| 100 | 新增: } | |
| 101 | 新增: public static readonly DependencyProperty IsOpenProperty = | |
| 102 | 新增: DependencyProperty.Register("IsOpen", | |
| 103 | 新增: typeof(bool), | |
| 104 | 新增: typeof(DateSelect), new PropertyMetadata(new PropertyChangedCallback(OnPropertyChanged))); | |
| 105 | 新增: | |
| 106 | 新增: private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |
| 107 | 新增: { | |
| 108 | 新增: var control = d as DateSelect; | |
| 109 | 新增: if (e.Property == IsOpenProperty) | |
| 110 | 新增: { | |
| 111 | 新增: control.HandleHook(); | |
| 112 | 新增: } | |
| 113 | 新增: } | |
| 114 | 新增: | |
| 115 | 新增: private Win32API.LowLevelKeyboardProc mouseProc; | |
| 116 | 新增: private static IntPtr hookMouseID = IntPtr.Zero; | |
| 117 | 新增: private IntPtr hook; | |
| 118 | 新增: public Command ShowSelectCommand { get; set; } | |
| 119 | 新增: public Command SetYearCommand { get; set; } | |
| 120 | 新增: public Command SetMonthCommand { get; set; } | |
| 121 | 新增: public Command DoneCommand { get; set; } | |
| 122 | 新增: | |
| 123 | 新增: private bool IsFirstClick = false; | |
| 124 | 新增: private Border SelectContainer; | |
| 125 | 新增: public DateSelect() | |
| 126 | 新增: { | |
| 127 | 新增: DefaultStyleKey = typeof(DateSelect); | |
| 128 | 新增: | |
| 129 | 新增: ShowSelectCommand = new Command(new Action<object>(OnShowSelect)); | |
| 130 | 新增: SetYearCommand = new Command(new Action<object>(OnSetYear)); | |
| 131 | 新增: SetMonthCommand = new Command(new Action<object>(OnSetMonth)); | |
| 132 | 新增: DoneCommand = new Command(new Action<object>(OnDone)); | |
| 133 | 新增: | |
| 134 | 新增: MouseLeftButtonUp += Select_MouseLeftButtonUp; | |
| 135 | 新增: | |
| 136 | 新增: Year = Date.Year; | |
| 137 | 新增: | |
| 138 | 新增: Month = Date.Month; | |
| 139 | 新增: | |
| 140 | 新增: Day = Date.Day.ToString(); | |
| 141 | 新增: | |
| 142 | 新增: mouseProc = HookCallback; | |
| 143 | 新增: | |
| 144 | 新增: Unloaded += DateSelect_Unloaded; | |
| 145 | 新增: | |
| 146 | 新增: } | |
| 147 | 新增: | |
| 148 | 新增: | |
| 149 | 新增: | |
| 150 | 新增: private void DateSelect_Unloaded(object sender, RoutedEventArgs e) | |
| 151 | 新增: { | |
| 152 | 新增: Win32API.UnhookWindowsHookEx(hook); | |
| 153 | 新增: } | |
| 154 | 新增: | |
| 155 | 新增: private void HandleHook() | |
| 156 | 新增: { | |
| 157 | 新增: if (IsOpen) | |
| 158 | 新增: { | |
| 159 | 新增: // 设置键盘钩子 | |
| 160 | 新增: hook = Win32API.SetMouseHook(mouseProc); | |
| 161 | 新增: } | |
| 162 | 新增: else | |
| 163 | 新增: { | |
| 164 | 新增: Win32API.UnhookWindowsHookEx(hook); | |
| 165 | 新增: } | |
| 166 | 新增: } | |
| 167 | 新增: private IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) | |
| 168 | 新增: { | |
| 169 | 新增: | |
| 170 | 新增: if (nCode >= 0) | |
| 171 | 新增: { | |
| 172 | 新增: if (wParam == (IntPtr)Win32API.WM_LBUTTONDBLCLK || wParam == (IntPtr)Win32API.WM_WHEEL) | |
| 173 | 新增: { | |
| 174 | 新增: if (!IsFirstClick) | |
| 175 | 新增: { | |
| 176 | 新增: bool isInControl = IsInControl(); | |
| 177 | 新增: | |
| 178 | 新增: if (!isInControl) | |
| 179 | 新增: { | |
| 180 | 新增: IsOpen = false; | |
| 181 | 新增: } | |
| 182 | 新增: } | |
| 183 | 新增: IsFirstClick = false; | |
| 184 | 新增: } | |
| 185 | 新增: | |
| 186 | 新增: } | |
| 187 | 新增: | |
| 188 | 新增: return Win32API.CallNextHookEx(hookMouseID, nCode, wParam, lParam); | |
| 189 | 新增: } | |
| 190 | 新增: private bool IsInControl() | |
| 191 | 新增: { | |
| 192 | 新增: var p = Mouse.GetPosition(SelectContainer); | |
| 193 | 新增: if (p.X < 0 || p.Y < 0 || p.X > SelectContainer.ActualWidth || p.Y > SelectContainer.ActualHeight) | |
| 194 | 新增: { | |
| 195 | 新增: return false; | |
| 196 | 新增: } | |
| 197 | 新增: | |
| 198 | 新增: | |
| 199 | 新增: return true; | |
| 200 | 新增: } | |
| 201 | 新增: private void OnDone(object obj) | |
| 202 | 新增: { | |
| 203 | 新增: Date = new DateTime(Year, Month, int.Parse(Day)); | |
| 204 | 新增: | |
| 205 | 新增: UpdateDateStr(); | |
| 206 | 新增: | |
| 207 | 新增: IsOpen = false; | |
| 208 | 新增: } | |
| 209 | 新增: | |
| 210 | 新增: private void OnSetMonth(object obj) | |
| 211 | 新增: { | |
| 212 | 新增: int newMonth = Month + int.Parse(obj.ToString()); | |
| 213 | 新增: if (newMonth < 1 || newMonth > 12) | |
| 214 | 新增: { | |
| 215 | 新增: return; | |
| 216 | 新增: } | |
| 217 | 新增: Month = newMonth; | |
| 218 | 新增: | |
| 219 | 新增: Day = "1"; | |
| 220 | 新增: | |
| 221 | 新增: UpdateDays(); | |
| 222 | 新增: | |
| 223 | 新增: | |
| 224 | 新增: } | |
| 225 | 新增: | |
| 226 | 新增: private void OnSetYear(object obj) | |
| 227 | 新增: { | |
| 228 | 新增: int newYear = Year + int.Parse(obj.ToString()); | |
| 229 | 新增: if (newYear < 2020 || newYear > DateTime.Now.Year) | |
| 230 | 新增: { | |
| 231 | 新增: return; | |
| 232 | 新增: } | |
| 233 | 新增: Year = newYear; | |
| 234 | 新增: | |
| 235 | 新增: Day = "1"; | |
| 236 | 新增: | |
| 237 | 新增: UpdateDays(); | |
| 238 | 新增: } | |
| 239 | 新增: | |
| 240 | 新增: private void OnShowSelect(object obj) | |
| 241 | 新增: { | |
| 242 | 新增: IsOpen = true; | |
| 243 | 新增: | |
| 244 | 新增: IsFirstClick = true; | |
| 245 | 新增: } | |
| 246 | 新增: | |
| 247 | 新增: private void SelectContainer_Loaded(object sender, RoutedEventArgs e) | |
| 248 | 新增: { | |
| 249 | 新增: Debug.WriteLine("加载"); | |
| 250 | 新增: } | |
| 251 | 新增: | |
| 252 | 新增: public override void OnApplyTemplate() | |
| 253 | 新增: { | |
| 254 | 新增: base.OnApplyTemplate(); | |
| 255 | 新增: | |
| 256 | 新增: SelectContainer = GetTemplateChild("SelectContainer") as Border; | |
| 257 | 新增: | |
| 258 | 新增: UpdateDays(); | |
| 259 | 新增: | |
| 260 | 新增: UpdateDateStr(); | |
| 261 | 新增: | |
| 262 | 新增: | |
| 263 | 新增: } | |
| 264 | 新增: | |
| 265 | 新增: | |
| 266 | 新增: private void Select_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) | |
| 267 | 新增: { | |
| 268 | 新增: } | |
| 269 | 新增: | |
| 270 | 新增: private void UpdateDays() | |
| 271 | 新增: { | |
| 272 | 新增: var list = new List<string>(); | |
| 273 | 新增: int days = DateTime.DaysInMonth(Year, Month); | |
| 274 | 新增: for (int i = 1; i < days + 1; i++) | |
| 275 | 新增: { | |
| 276 | 新增: list.Add(i.ToString()); | |
| 277 | 新增: } | |
| 278 | 新增: Days = list; | |
| 279 | 新增: | |
| 280 | 新增: } | |
| 281 | 新增: | |
| 282 | 新增: private void UpdateDateStr() | |
| 283 | 新增: { | |
| 284 | 新增: DateStr = Date.ToString("yyyy年MM月dd日"); | |
| 285 | 新增: if (Date.Date == DateTime.Now.Date) | |
| 286 | 新增: { | |
| 287 | 新增: DateStr = "今天"; | |
| 288 | 新增: } | |
| 289 | 新增: if (SelectType == DateSelectType.Month) | |
| 290 | 新增: { | |
| 291 | 新增: DateStr = Date.ToString("yyyy年MM月"); | |
| 292 | 新增: | |
| 293 | 新增: } | |
| 294 | 新增: else if (SelectType == DateSelectType.Year) | |
| 295 | 新增: { | |
| 296 | 新增: DateStr = Date.ToString("yyyy年"); | |
| 297 | 新增: | |
| 298 | 新增: } | |
| 299 | 新增: } | |
| 300 | 新增: } | |
| 301 | 新增: | |
| 302 | 新增:} | |
| @@ -0,0 +1,15 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Linq; | |
| 4 | 新增:using System.Text; | |
| 5 | 新增:using System.Threading.Tasks; | |
| 6 | 新增: | |
| 7 | 新增:namespace UI.Controls.Select | |
| 8 | 新增:{ | |
| 9 | 新增: public enum DateSelectType | |
| 10 | 新增: { | |
| 11 | 新增: Day, | |
| 12 | 新增: Month, | |
| 13 | 新增: Year, | |
| 14 | 新增: } | |
| 15 | 新增:} | |
| @@ -10,6 +10,15 @@ namespace UI.Controls.Select | ||
| 10 | 10 | { |
| 11 | 11 | public class Option : Control |
| 12 | 12 | { |
| 13 | 新增: public bool IsShowIcon | |
| 14 | 新增: { | |
| 15 | 新增: get { return (bool)GetValue(IsShowIconProperty); } | |
| 16 | 新增: set { SetValue(IsShowIconProperty, value); } | |
| 17 | 新增: } | |
| 18 | 新增: public static readonly DependencyProperty IsShowIconProperty = | |
| 19 | 新增: DependencyProperty.Register("IsShowIcon", | |
| 20 | 新增: typeof(bool), | |
| 21 | 新增: typeof(Option), new PropertyMetadata(true)); | |
| 13 | 22 | public bool IsChecked |
| 14 | 23 | { |
| 15 | 24 | get { return (bool)GetValue(IsCheckedProperty); } |
| @@ -10,6 +10,15 @@ namespace UI.Controls.Select | ||
| 10 | 10 | { |
| 11 | 11 | public class Select : Control |
| 12 | 12 | { |
| 13 | 新增: public bool IsShowIcon | |
| 14 | 新增: { | |
| 15 | 新增: get { return (bool)GetValue(IsShowIconProperty); } | |
| 16 | 新增: set { SetValue(IsShowIconProperty, value); } | |
| 17 | 新增: } | |
| 18 | 新增: public static readonly DependencyProperty IsShowIconProperty = | |
| 19 | 新增: DependencyProperty.Register("IsShowIcon", | |
| 20 | 新增: typeof(bool), | |
| 21 | 新增: typeof(Select), new PropertyMetadata(true)); | |
| 13 | 22 | public bool IsOpen |
| 14 | 23 | { |
| 15 | 24 | get { return (bool)GetValue(IsOpenProperty); } |
| @@ -84,6 +93,7 @@ namespace UI.Controls.Select | ||
| 84 | 93 | { |
| 85 | 94 | var option = new Option(); |
| 86 | 95 | option.Value = item; |
| 96 | 新增: option.IsShowIcon = IsShowIcon; | |
| 87 | 97 | option.IsChecked = SelectedItem?.Name == item.Name; |
| 88 | 98 | option.MouseLeftButtonUp += Option_MouseLeftButtonUp; ; |
| 89 | 99 | _optionsContainer.Children.Add(option); |
| @@ -102,6 +112,10 @@ namespace UI.Controls.Select | ||
| 102 | 112 | |
| 103 | 113 | private void OnSelectedItemChange() |
| 104 | 114 | { |
| 115 | 新增: if (_optionsContainer == null || SelectedItem == null) | |
| 116 | 新增: { | |
| 117 | 新增: return; | |
| 118 | 新增: } | |
| 105 | 119 | foreach (Option option in _optionsContainer.Children) |
| 106 | 120 | { |
| 107 | 121 | option.IsChecked = SelectedItem.Name == option.Value.Name; |
| @@ -15,13 +15,13 @@ namespace Core.Librarys.Image | ||
| 15 | 15 | { |
| 16 | 16 | public class Imager |
| 17 | 17 | { |
| 18 | 删除: public static BitmapImage Load(string filePath) | |
| 18 | 新增: public static BitmapImage Load(string filePath, string defaultPath = "pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png") | |
| 19 | 19 | { |
| 20 | 20 | try |
| 21 | 21 | { |
| 22 | 删除: if (filePath == null) | |
| 22 | 新增: if (string.IsNullOrEmpty(filePath)) | |
| 23 | 23 | { |
| 24 | 删除: return null; | |
| 24 | 新增: throw new ArgumentNullException(nameof(filePath)); | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | var bitmap = new BitmapImage(); |
| @@ -63,7 +63,7 @@ namespace Core.Librarys.Image | ||
| 63 | 63 | var bitmap = new BitmapImage(); |
| 64 | 64 | bitmap.BeginInit(); |
| 65 | 65 | |
| 66 | 删除: StreamResourceInfo info = Application.GetResourceStream(new Uri("pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png", UriKind.RelativeOrAbsolute)); | |
| 66 | 新增: StreamResourceInfo info = Application.GetResourceStream(new Uri(defaultPath, UriKind.RelativeOrAbsolute)); | |
| 67 | 67 | using (var st = info.Stream) |
| 68 | 68 | { |
| 69 | 69 | bitmap.StreamSource = st; |
| @@ -0,0 +1,81 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Collections.ObjectModel; | |
| 4 | 新增:using System.Linq; | |
| 5 | 新增:using System.Text; | |
| 6 | 新增:using System.Threading.Tasks; | |
| 7 | 新增:using UI.Controls.Charts.Model; | |
| 8 | 新增:using UI.Controls.Select; | |
| 9 | 新增: | |
| 10 | 新增:namespace UI.Models | |
| 11 | 新增:{ | |
| 12 | 新增: public class ChartPageModel : ModelBase | |
| 13 | 新增: { | |
| 14 | 新增: private List<ChartsDataModel> Data_; | |
| 15 | 新增: | |
| 16 | 新增: public List<ChartsDataModel> Data | |
| 17 | 新增: { | |
| 18 | 新增: get | |
| 19 | 新增: { | |
| 20 | 新增: return Data_; | |
| 21 | 新增: } | |
| 22 | 新增: set | |
| 23 | 新增: { | |
| 24 | 新增: Data_ = value; | |
| 25 | 新增: OnPropertyChanged(); | |
| 26 | 新增: } | |
| 27 | 新增: } | |
| 28 | 新增: | |
| 29 | 新增: private ObservableCollection<string> TabbarData_; | |
| 30 | 新增: /// <summary> | |
| 31 | 新增: /// tabbar data | |
| 32 | 新增: /// </summary> | |
| 33 | 新增: public ObservableCollection<string> TabbarData | |
| 34 | 新增: { | |
| 35 | 新增: get { return TabbarData_; } | |
| 36 | 新增: set { TabbarData_ = value; OnPropertyChanged(); } | |
| 37 | 新增: } | |
| 38 | 新增: | |
| 39 | 新增: private int TabbarSelectedIndex_; | |
| 40 | 新增: /// <summary> | |
| 41 | 新增: /// tabbar selected item index | |
| 42 | 新增: /// </summary> | |
| 43 | 新增: public int TabbarSelectedIndex | |
| 44 | 新增: { | |
| 45 | 新增: get { return TabbarSelectedIndex_; } | |
| 46 | 新增: set | |
| 47 | 新增: { | |
| 48 | 新增: TabbarSelectedIndex_ = value; | |
| 49 | 新增: OnPropertyChanged(); | |
| 50 | 新增: } | |
| 51 | 新增: } | |
| 52 | 新增: private string WeekDateStr_; | |
| 53 | 新增: public string WeekDateStr { get { return WeekDateStr_; } set { WeekDateStr_ = value; OnPropertyChanged(); } } | |
| 54 | 新增: private DateTime Date_; | |
| 55 | 新增: public DateTime Date { get { return Date_; } set { Date_ = value; OnPropertyChanged(); } } | |
| 56 | 新增: | |
| 57 | 新增: private List<SelectItemModel> WeekOptions_; | |
| 58 | 新增: | |
| 59 | 新增: public List<SelectItemModel> WeekOptions { get { return WeekOptions_; } set { WeekOptions_ = value; OnPropertyChanged(); } } | |
| 60 | 新增: | |
| 61 | 新增: private SelectItemModel SelectedWeek_; | |
| 62 | 新增: | |
| 63 | 新增: public SelectItemModel SelectedWeek { get { return SelectedWeek_; } set { SelectedWeek_ = value; OnPropertyChanged(); } } | |
| 64 | 新增: | |
| 65 | 新增: private DateTime MonthDate_; | |
| 66 | 新增: public DateTime MonthDate { get { return MonthDate_; } set { MonthDate_ = value; OnPropertyChanged(); } } | |
| 67 | 新增: | |
| 68 | 新增: private DateTime YearDate_; | |
| 69 | 新增: public DateTime YearDate { get { return YearDate_; } set { YearDate_ = value; OnPropertyChanged(); } } | |
| 70 | 新增: | |
| 71 | 新增: private int NameIndexStart_ = 0; | |
| 72 | 新增: public int NameIndexStart { get { return NameIndexStart_; } set { NameIndexStart_ = value; OnPropertyChanged(); } } | |
| 73 | 新增: | |
| 74 | 新增: private List<ChartsDataModel> TopData_; | |
| 75 | 新增: public List<ChartsDataModel> TopData | |
| 76 | 新增: { | |
| 77 | 新增: get { return TopData_; } | |
| 78 | 新增: set { TopData_ = value; OnPropertyChanged(); } | |
| 79 | 新增: } | |
| 80 | 新增: } | |
| 81 | 新增:} | |
| @@ -13,16 +13,44 @@ | ||
| 13 | 13 | <ControlTemplate TargetType="{x:Type local:EmptyData}"> |
| 14 | 14 | <Border > |
| 15 | 15 | |
| 16 | 删除: <StackPanel> | |
| 16 | 新增: <Grid> | |
| 17 | 新增: <Grid.RowDefinitions> | |
| 18 | 新增: <RowDefinition Height="auto"/> | |
| 19 | 新增: <RowDefinition Height="auto"/> | |
| 20 | 新增: </Grid.RowDefinitions> | |
| 17 | 21 | <Grid> |
| 18 | 删除: <local:Icon IconType="Preview" FontSize="100" Foreground="Gray" RenderTransformOrigin=".5,.5" Opacity=".3"> | |
| 19 | 删除: <local:Icon.RenderTransform> | |
| 20 | 删除: <RotateTransform Angle="90" /> | |
| 21 | 删除: </local:Icon.RenderTransform> | |
| 22 | 删除: </local:Icon> | |
| 22 | 新增: <Border Background="White" BorderThickness="4" CornerRadius="10" Width="100" Height="100"> | |
| 23 | 新增: <Border.RenderTransform> | |
| 24 | 新增: <RotateTransform Angle="5"/> | |
| 25 | 新增: </Border.RenderTransform> | |
| 26 | 新增: <Border.Effect> | |
| 27 | 新增: <DropShadowEffect Color="#d8d2d2" BlurRadius="10" Direction="300" ShadowDepth="4" Opacity="0.1" RenderingBias="Performance" ></DropShadowEffect> | |
| 28 | 新增: </Border.Effect> | |
| 29 | 新增: <StackPanel> | |
| 30 | 新增: <Border Background="#c4c4c4" BorderThickness="4" CornerRadius="6" Height="20" Margin="5"/> | |
| 31 | 新增: <Border Background="#f0f0f0" BorderThickness="4" CornerRadius="6" Height="40" Margin="5"/> | |
| 32 | 新增: </StackPanel> | |
| 33 | 新增: | |
| 34 | 新增: </Border> | |
| 35 | 新增: <Border HorizontalAlignment="Left" Margin="30,0,0,30" Background="White" BorderThickness="4" CornerRadius="10" Width="100" Height="100"> | |
| 36 | 新增: | |
| 37 | 新增: <Border.Effect> | |
| 38 | 新增: <DropShadowEffect Color="#d8d2d2" BlurRadius="10" Direction="300" ShadowDepth="4" Opacity="0.1" RenderingBias="Performance" ></DropShadowEffect> | |
| 39 | 新增: </Border.Effect> | |
| 40 | 新增: <StackPanel> | |
| 41 | 新增: <Border Background="#c4c4c4" BorderThickness="4" CornerRadius="6" Height="20" Margin="5"/> | |
| 42 | 新增: <Border Background="#f0f0f0" BorderThickness="4" CornerRadius="6" Height="40" Margin="5"> | |
| 43 | 新增: <TextBlock Foreground="Gray" Opacity=".4" Text="Tai" FontSize="10" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |
| 44 | 新增: </Border> | |
| 45 | 新增: </StackPanel> | |
| 46 | 新增: | |
| 47 | 新增: </Border> | |
| 23 | 48 | </Grid> |
| 24 | 删除: <TextBlock Text="暂时没有数据" HorizontalAlignment="Center" Foreground="Gray" Opacity=".3"/> | |
| 25 | 删除: </StackPanel> | |
| 49 | 新增: <Border Grid.Row="1" Margin="0,10,0,0"> | |
| 50 | 新增: <TextBlock VerticalAlignment="Center" Text="暂时没有数据" FontSize="12" Margin="0,10" HorizontalAlignment="Center" Foreground="Gray" Opacity=".7"/> | |
| 51 | 新增: | |
| 52 | 新增: </Border> | |
| 53 | 新增: </Grid> | |
| 26 | 54 | |
| 27 | 55 | </Border> |
| 28 | 56 | |
| @@ -0,0 +1,20 @@ | ||
| 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.Base"> | |
| 4 | 新增: <Style TargetType="{x:Type local:View}"> | |
| 5 | 新增: <Setter Property="SnapsToDevicePixels" | |
| 6 | 新增: Value="true" /> | |
| 7 | 新增: <Setter Property="Background" Value="Transparent"/> | |
| 8 | 新增: | |
| 9 | 新增: <Setter Property="Template"> | |
| 10 | 新增: <Setter.Value> | |
| 11 | 新增: <ControlTemplate TargetType="{x:Type local:View}"> | |
| 12 | 新增: <Border Background="{TemplateBinding Background}" SnapsToDevicePixels="True"> | |
| 13 | 新增: <ContentPresenter/> | |
| 14 | 新增: </Border> | |
| 15 | 新增: | |
| 16 | 新增: </ControlTemplate> | |
| 17 | 新增: </Setter.Value> | |
| 18 | 新增: </Setter> | |
| 19 | 新增: </Style> | |
| 20 | 新增:</ResourceDictionary> | |
| 文件末尾没有换行 | ||
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 2 | 2 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | 删除: xmlns:local="clr-namespace:UI.Controls.Charts"> | |
| 3 | 新增: xmlns:local="clr-namespace:UI.Controls.Charts" xmlns:base="clr-namespace:UI.Controls.Base" xmlns:converter="clr-namespace:UI.Controls.Converters"> | |
| 4 | 新增: <converter:HextoColorConverter x:Key="HextoColorConverter"/> | |
| 4 | 5 | <Style TargetType="{x:Type local:Charts}"> |
| 5 | 6 | <Setter Property="SnapsToDevicePixels" |
| 6 | 7 | Value="true" /> |
| @@ -28,10 +29,138 @@ | ||
| 28 | 29 | <Grid x:Name="MonthContainer"> |
| 29 | 30 | </Grid> |
| 30 | 31 | </Grid> |
| 32 | 新增: | |
| 33 | 新增: <Grid x:Name="Column" Visibility="Collapsed"> | |
| 34 | 新增: <Grid x:Name="ColumnEmpty" Visibility="Collapsed"> | |
| 35 | 新增: <base:EmptyData/> | |
| 36 | 新增: </Grid> | |
| 37 | 新增: <Grid x:Name="ColumnMain"> | |
| 38 | 新增: <Grid.RowDefinitions> | |
| 39 | 新增: <RowDefinition Height="auto"/> | |
| 40 | 新增: <RowDefinition Height="*"/> | |
| 41 | 新增: <RowDefinition Height="auto"/> | |
| 42 | 新增: </Grid.RowDefinitions> | |
| 43 | 新增: <StackPanel> | |
| 44 | 新增: <TextBlock Text="总计" Foreground="#626262"/> | |
| 45 | 新增: <TextBlock Margin="0,10,0,0" Text="{TemplateBinding Total}" FontSize="20" Foreground="#1a1919"/> | |
| 46 | 新增: </StackPanel> | |
| 47 | 新增: <Grid Grid.Row="1" Margin="0,20,0,0"> | |
| 48 | 新增: <TextBlock Panel.ZIndex="2" Margin="0,-8,0,0" HorizontalAlignment="Right" VerticalAlignment="Top" Text="{TemplateBinding Maximum}" Foreground="#ccc" FontSize="12"/> | |
| 49 | 新增: | |
| 50 | 新增: <TextBlock Panel.ZIndex="2" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{TemplateBinding Median}" Foreground="#ccc" FontSize="12"/> | |
| 51 | 新增: <Line Stroke="#ccc" Opacity="1" HorizontalAlignment="Stretch" | |
| 52 | 新增: X2="{Binding ActualWidth, RelativeSource={RelativeSource Self}}" | |
| 53 | 新增: StrokeDashArray="2 5" StrokeThickness=".8" VerticalAlignment="Center" Margin="10,0"/> | |
| 54 | 新增: | |
| 55 | 新增: <Line Stroke="#ccc" Opacity="1" HorizontalAlignment="Stretch" | |
| 56 | 新增: X2="{Binding ActualWidth, RelativeSource={RelativeSource Self}}" | |
| 57 | 新增: StrokeDashArray="2 5" StrokeThickness=".8" VerticalAlignment="Top" Margin="10,0"/> | |
| 58 | 新增: | |
| 59 | 新增: <Border BorderThickness="1,0,0,1" BorderBrush="#eeeef2"> | |
| 60 | 新增: <Grid x:Name="ColumnContainer"> | |
| 61 | 新增: | |
| 62 | 新增: </Grid> | |
| 63 | 新增: </Border> | |
| 64 | 新增: </Grid> | |
| 65 | 新增: <!--信息--> | |
| 66 | 新增: <Grid Grid.Row="2" Margin="0,5,0,0"> | |
| 67 | 新增: <ListView ItemsSource="{TemplateBinding ColumnInfoList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" > | |
| 68 | 新增: <ListBox.Resources> | |
| 69 | 新增: <Style TargetType="{x:Type ListView}"> | |
| 70 | 新增: <Setter Property="OverridesDefaultStyle" Value="True"/> | |
| 71 | 新增: | |
| 72 | 新增: <Setter Property="Template"> | |
| 73 | 新增: <Setter.Value> | |
| 74 | 新增: <ControlTemplate TargetType="{x:Type ListView}"> | |
| 75 | 新增: <Border> | |
| 76 | 新增: <ItemsPresenter /> | |
| 77 | 新增: </Border> | |
| 78 | 新增: </ControlTemplate> | |
| 79 | 新增: </Setter.Value> | |
| 80 | 新增: </Setter> | |
| 81 | 新增: </Style> | |
| 82 | 新增: <Style TargetType="{x:Type ListViewItem}"> | |
| 83 | 新增: <Setter Property="OverridesDefaultStyle" Value="True"/> | |
| 84 | 新增: <Setter Property="Template"> | |
| 85 | 新增: <Setter.Value> | |
| 86 | 新增: <ControlTemplate TargetType="{x:Type ListViewItem}"> | |
| 87 | 新增: <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="White" Margin="0" CornerRadius="10"> | |
| 88 | 新增: | |
| 89 | 新增: <ContentPresenter/> | |
| 90 | 新增: </Border> | |
| 91 | 新增: <!--<ControlTemplate.Triggers> | |
| 92 | 新增: <Trigger Property="IsMouseOver" Value="True"> | |
| 93 | 新增: --> | |
| 94 | 新增: <!--<Setter TargetName="Border" Property="Background" Value="#FFE8E6FF"/>--> | |
| 95 | 新增: <!-- | |
| 96 | 新增: <Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/> | |
| 97 | 新增: | |
| 98 | 新增: </Trigger> | |
| 99 | 新增: </ControlTemplate.Triggers>--> | |
| 100 | 新增: </ControlTemplate> | |
| 101 | 新增: </Setter.Value> | |
| 102 | 新增: </Setter> | |
| 103 | 新增: | |
| 104 | 新增: </Style> | |
| 105 | 新增: </ListBox.Resources> | |
| 106 | 新增: <ListBox.ItemsPanel> | |
| 107 | 新增: <ItemsPanelTemplate> | |
| 108 | 新增: <WrapPanel/> | |
| 109 | 新增: </ItemsPanelTemplate> | |
| 110 | 新增: </ListBox.ItemsPanel> | |
| 111 | 新增: <ListView.ItemTemplate> | |
| 112 | 新增: <DataTemplate> | |
| 113 | 新增: | |
| 114 | 新增: <WrapPanel Orientation="Vertical"> | |
| 115 | 新增: <Border Width="auto" Height="30" Margin="0,0,10,0"> | |
| 116 | 新增: <Grid> | |
| 117 | 新增: <Grid.ColumnDefinitions> | |
| 118 | 新增: <ColumnDefinition Width="20"/> | |
| 119 | 新增: <ColumnDefinition Width="30"/> | |
| 120 | 新增: <ColumnDefinition Width="auto"/> | |
| 121 | 新增: <ColumnDefinition Width="auto"/> | |
| 122 | 新增: | |
| 123 | 新增: </Grid.ColumnDefinitions> | |
| 124 | 新增: <Border Width="12" CornerRadius="4" Height="12" Background="{Binding Color,Converter={StaticResource HextoColorConverter}}"> | |
| 125 | 新增: <!--颜色--> | |
| 126 | 新增: </Border> | |
| 127 | 新增: <Border Grid.Column="1"> | |
| 128 | 新增: <!--图标--> | |
| 129 | 新增: <base:Img Width="20" Height="20" URL="{Binding Icon}"/> | |
| 130 | 新增: </Border> | |
| 131 | 新增: <Border Grid.Column="2" Margin="5,0,0,0"> | |
| 132 | 新增: <!--名称--> | |
| 133 | 新增: <TextBlock Foreground="#5c5c5c" VerticalAlignment="Center" Text="{Binding Name}"/> | |
| 134 | 新增: </Border> | |
| 135 | 新增: <Border Grid.Column="3"> | |
| 136 | 新增: <!--总计和百分比--> | |
| 137 | 新增: <TextBlock FontSize="12" Margin="5,0,0,0" Foreground="#FF8A8A8A" VerticalAlignment="Center" Text="{Binding Text}"/> | |
| 138 | 新增: | |
| 139 | 新增: </Border> | |
| 140 | 新增: | |
| 141 | 新增: </Grid> | |
| 142 | 新增: </Border> | |
| 143 | 新增: | |
| 144 | 新增: </WrapPanel> | |
| 145 | 新增: </DataTemplate> | |
| 146 | 新增: </ListView.ItemTemplate> | |
| 147 | 新增: </ListView> | |
| 148 | 新增: </Grid> | |
| 149 | 新增: </Grid> | |
| 150 | 新增: </Grid> | |
| 31 | 151 | </Grid> |
| 32 | 152 | </Border> |
| 33 | 153 | |
| 34 | 154 | <ControlTemplate.Triggers> |
| 155 | 新增: <MultiTrigger> | |
| 156 | 新增: <MultiTrigger.Conditions> | |
| 157 | 新增: <Condition Property="IsEmpty" Value="True"/> | |
| 158 | 新增: <Condition Property="ChartsType" Value="Column"/> | |
| 159 | 新增: </MultiTrigger.Conditions> | |
| 160 | 新增: <Setter Property="Visibility" Value="Visible" TargetName="ColumnEmpty"/> | |
| 161 | 新增: <Setter Property="Visibility" Value="Collapsed" TargetName="ColumnMain"/> | |
| 162 | 新增: </MultiTrigger> | |
| 163 | 新增: | |
| 35 | 164 | <Trigger Property="ChartsType" |
| 36 | 165 | Value="HorizontalA"> |
| 37 | 166 | <Setter TargetName="HorizontalA" Property="Visibility" Value="Visible"/> |
| @@ -44,6 +173,10 @@ | ||
| 44 | 173 | Value="Month"> |
| 45 | 174 | <Setter TargetName="Month" Property="Visibility" Value="Visible"/> |
| 46 | 175 | </Trigger> |
| 176 | 新增: <Trigger Property="ChartsType" | |
| 177 | 新增: Value="Column"> | |
| 178 | 新增: <Setter TargetName="Column" Property="Visibility" Value="Visible"/> | |
| 179 | 新增: </Trigger> | |
| 47 | 180 | </ControlTemplate.Triggers> |
| 48 | 181 | </ControlTemplate> |
| 49 | 182 | </Setter.Value> |
| @@ -0,0 +1,94 @@ | ||
| 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.Charts" | |
| 4 | 新增: xmlns:base="clr-namespace:UI.Controls.Base"> | |
| 5 | 新增: <Style TargetType="{x:Type local:ChartItemTypeColumn}"> | |
| 6 | 新增: <Setter Property="SnapsToDevicePixels" | |
| 7 | 新增: Value="true" /> | |
| 8 | 新增: | |
| 9 | 新增: <Setter Property="Background" Value="Transparent"/> | |
| 10 | 新增: <!--<Setter Property="Margin" Value="5,0"/>--> | |
| 11 | 新增: | |
| 12 | 新增: <Setter Property="Template"> | |
| 13 | 新增: <Setter.Value> | |
| 14 | 新增: <ControlTemplate TargetType="{x:Type local:ChartItemTypeColumn}"> | |
| 15 | 新增: <Border Background="{TemplateBinding Background}" SnapsToDevicePixels="True"> | |
| 16 | 新增: <Grid> | |
| 17 | 新增: <Grid x:Name="Normal"> | |
| 18 | 新增: <Grid.RowDefinitions> | |
| 19 | 新增: <RowDefinition Height="*"/> | |
| 20 | 新增: <RowDefinition Height="30"/> | |
| 21 | 新增: </Grid.RowDefinitions> | |
| 22 | 新增: <Grid x:Name="ValueContainer" > | |
| 23 | 新增: <Border Background="Transparent" x:Name="ValueBorder"> | |
| 24 | 新增: <Rectangle | |
| 25 | 新增: x:Name="ValueBlockObj" | |
| 26 | 新增: RadiusX="4" | |
| 27 | 新增: RadiusY="4" | |
| 28 | 新增: Fill="#cccccc" | |
| 29 | 新增: Width="{Binding ElementName=ValueContainer,Path=ActualWidth}" | |
| 30 | 新增: VerticalAlignment="Bottom" | |
| 31 | 新增: HorizontalAlignment="Center" | |
| 32 | 新增: /> | |
| 33 | 新增: </Border> | |
| 34 | 新增: </Grid> | |
| 35 | 新增: <Grid Grid.Row="1"> | |
| 36 | 新增: <TextBlock FontSize="12" HorizontalAlignment="Center" Margin="0,10,0,0" Text="{TemplateBinding ColumnName}" Foreground="#FF8A8A8A" /> | |
| 37 | 新增: </Grid> | |
| 38 | 新增: | |
| 39 | 新增: | |
| 40 | 新增: | |
| 41 | 新增: </Grid> | |
| 42 | 新增: | |
| 43 | 新增: <Grid x:Name="Loading" Visibility="Collapsed"> | |
| 44 | 新增: | |
| 45 | 新增: </Grid> | |
| 46 | 新增: </Grid> | |
| 47 | 新增: <VisualStateManager.VisualStateGroups> | |
| 48 | 新增: <VisualStateGroup x:Name="CommonStates"> | |
| 49 | 新增: <VisualStateGroup.Transitions> | |
| 50 | 新增: <VisualTransition GeneratedDuration="0:0:.2" /> | |
| 51 | 新增: <VisualTransition GeneratedDuration="0" | |
| 52 | 新增: To="Pressed" /> | |
| 53 | 新增: </VisualStateGroup.Transitions> | |
| 54 | 新增: <VisualState x:Name="NormalState" /> | |
| 55 | 新增: <VisualState x:Name="MouseOver"> | |
| 56 | 新增: <Storyboard > | |
| 57 | 新增: <ColorAnimation Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" | |
| 58 | 新增: Storyboard.TargetName="ValueBorder" To="#7FF1F1F1" > | |
| 59 | 新增: <ColorAnimation.EasingFunction> | |
| 60 | 新增: <CubicEase EasingMode="EaseInOut"/> | |
| 61 | 新增: </ColorAnimation.EasingFunction> | |
| 62 | 新增: </ColorAnimation> | |
| 63 | 新增: <!--<ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" | |
| 64 | 新增: Storyboard.TargetName="IconBorder" To="#2b20d9" > | |
| 65 | 新增: <ColorAnimation.EasingFunction> | |
| 66 | 新增: <CubicEase EasingMode="EaseInOut"/> | |
| 67 | 新增: </ColorAnimation.EasingFunction> | |
| 68 | 新增: </ColorAnimation> | |
| 69 | 新增: <ColorAnimation Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" | |
| 70 | 新增: Storyboard.TargetName="IconBorder" To="#ffffff" > | |
| 71 | 新增: <ColorAnimation.EasingFunction> | |
| 72 | 新增: <CubicEase EasingMode="EaseInOut"/> | |
| 73 | 新增: </ColorAnimation.EasingFunction> | |
| 74 | 新增: </ColorAnimation>--> | |
| 75 | 新增: </Storyboard> | |
| 76 | 新增: </VisualState> | |
| 77 | 新增: <VisualState x:Name="Pressed"> | |
| 78 | 新增: | |
| 79 | 新增: </VisualState> | |
| 80 | 新增: </VisualStateGroup> | |
| 81 | 新增: </VisualStateManager.VisualStateGroups> | |
| 82 | 新增: </Border> | |
| 83 | 新增: | |
| 84 | 新增: <ControlTemplate.Triggers> | |
| 85 | 新增: <!--<Trigger Property="IsLoading" Value="True"> | |
| 86 | 新增: <Setter TargetName="Loading" Property="Visibility" Value="Visible"/> | |
| 87 | 新增: <Setter TargetName="Normal" Property="Visibility" Value="Hidden"/> | |
| 88 | 新增: </Trigger>--> | |
| 89 | 新增: </ControlTemplate.Triggers> | |
| 90 | 新增: </ControlTemplate> | |
| 91 | 新增: </Setter.Value> | |
| 92 | 新增: </Setter> | |
| 93 | 新增: </Style> | |
| 94 | 新增:</ResourceDictionary> | |
| 文件末尾没有换行 | ||
| @@ -11,12 +11,14 @@ | ||
| 11 | 11 | <ResourceDictionary Source="/Tai;component/Themes/Base/Img.xaml"/> |
| 12 | 12 | <ResourceDictionary Source="/Tai;component/Themes/Base/CheckBox.xaml"/> |
| 13 | 13 | <ResourceDictionary Source="/Tai;component/Themes/Base/Text.xaml"/> |
| 14 | 新增: <ResourceDictionary Source="/Tai;component/Themes/Base/View.xaml"/> | |
| 14 | 15 | |
| 15 | 16 | <ResourceDictionary Source="/Tai;component/Themes/PageContainer.xaml"/> |
| 16 | 17 | <ResourceDictionary Source="/Tai;component/Themes/Charts/Charts.xaml"/> |
| 17 | 18 | <ResourceDictionary Source="/Tai;component/Themes/Charts/ChartsItemTypeA.xaml"/> |
| 18 | 19 | <ResourceDictionary Source="/Tai;component/Themes/Charts/ChartsItemTypeCard.xaml"/> |
| 19 | 20 | <ResourceDictionary Source="/Tai;component/Themes/Charts/ChartsItemTypeMonth.xaml"/> |
| 21 | 新增: <ResourceDictionary Source="/Tai;component/Themes/Charts/ChartsItemTypeColumn.xaml"/> | |
| 20 | 22 | |
| 21 | 23 | <ResourceDictionary Source="/Tai;component/Themes/Tabbar/Tabbar.xaml"/> |
| 22 | 24 | <ResourceDictionary Source="/Tai;component/Themes/DatePickerBar/DatePickerBar.xaml"/> |
| @@ -34,6 +36,7 @@ | ||
| 34 | 36 | <ResourceDictionary Source="/Tai;component/Themes/Select/Select.xaml"/> |
| 35 | 37 | <ResourceDictionary Source="/Tai;component/Themes/Select/Option.xaml"/> |
| 36 | 38 | <ResourceDictionary Source="/Tai;component/Themes/Select/ImageSelect.xaml"/> |
| 39 | 新增: <ResourceDictionary Source="/Tai;component/Themes/Select/DateSelect.xaml"/> | |
| 37 | 40 | |
| 38 | 41 | </ResourceDictionary.MergedDictionaries> |
| 39 | 42 | |
| @@ -0,0 +1,184 @@ | ||
| 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.Select" xmlns:base="clr-namespace:UI.Controls.Base" xmlns:button="clr-namespace:UI.Controls.Button" xmlns:converter="clr-namespace:UI.Controls.Converters"> | |
| 4 | 新增: <converter:ToStringConverter x:Key="ToStringConverter"/> | |
| 5 | 新增: | |
| 6 | 新增: <Style TargetType="{x:Type local:DateSelect}"> | |
| 7 | 新增: <Setter Property="SnapsToDevicePixels" | |
| 8 | 新增: Value="true" /> | |
| 9 | 新增: | |
| 10 | 新增: <Setter Property="Background" Value="Transparent"/> | |
| 11 | 新增: | |
| 12 | 新增: <Setter Property="Template"> | |
| 13 | 新增: <Setter.Value> | |
| 14 | 新增: <ControlTemplate TargetType="{x:Type local:DateSelect}"> | |
| 15 | 新增: <Border SnapsToDevicePixels="True" Background="{TemplateBinding Background}" HorizontalAlignment="Left" > | |
| 16 | 新增: <Grid> | |
| 17 | 新增: <!--当前选择项--> | |
| 18 | 新增: <Border x:Name="Main" Margin="0,10,0,0" Background="#f9f9f9" HorizontalAlignment="Left" Padding="15,5" CornerRadius="5"> | |
| 19 | 新增: <Border.InputBindings> | |
| 20 | 新增: <MouseBinding Gesture="LeftClick" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=ShowSelectCommand}"/> | |
| 21 | 新增: </Border.InputBindings> | |
| 22 | 新增: <Border.Effect> | |
| 23 | 新增: <DropShadowEffect Color="#d8d2d2" BlurRadius="1" Direction="300" ShadowDepth="4" Opacity="0.1" RenderingBias="Performance" ></DropShadowEffect> | |
| 24 | 新增: </Border.Effect> | |
| 25 | 新增: <StackPanel Orientation="Horizontal"> | |
| 26 | 新增: <base:Icon x:Name="Icon" IconType="DateTime"/> | |
| 27 | 新增: <TextBlock Foreground="#1a1a1a" Text="{TemplateBinding DateStr}" VerticalAlignment="Center" Margin="5,0,0,0"/> | |
| 28 | 新增: </StackPanel> | |
| 29 | 新增: </Border> | |
| 30 | 新增: | |
| 31 | 新增: <!--选择--> | |
| 32 | 新增: <Popup | |
| 33 | 新增: x:Name="Popup" | |
| 34 | 新增: Placement="Bottom" | |
| 35 | 新增: PlacementTarget="{Binding ElementName=Main}" | |
| 36 | 新增: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" > | |
| 37 | 新增: <Border | |
| 38 | 新增: x:Name="SelectContainer" | |
| 39 | 新增: CornerRadius="10" | |
| 40 | 新增: BorderBrush="#CCC" | |
| 41 | 新增: BorderThickness="1" | |
| 42 | 新增: Background="White" Padding="10" MaxHeight="300" Margin="10"> | |
| 43 | 新增: <Border.Effect> | |
| 44 | 新增: <DropShadowEffect BlurRadius="6" ShadowDepth="2" Direction="315" Color="Gray" Opacity=".1"/> | |
| 45 | 新增: </Border.Effect> | |
| 46 | 新增: <Grid> | |
| 47 | 新增: <Grid.RowDefinitions> | |
| 48 | 新增: <RowDefinition Height="40"/> | |
| 49 | 新增: <RowDefinition Height="auto"/> | |
| 50 | 新增: <RowDefinition Height="auto"/> | |
| 51 | 新增: | |
| 52 | 新增: </Grid.RowDefinitions> | |
| 53 | 新增: <!--年份月份选择--> | |
| 54 | 新增: <Border> | |
| 55 | 新增: <Grid> | |
| 56 | 新增: <Grid.ColumnDefinitions> | |
| 57 | 新增: <ColumnDefinition Width="*"/> | |
| 58 | 新增: <ColumnDefinition Width="*"/> | |
| 59 | 新增: | |
| 60 | 新增: </Grid.ColumnDefinitions> | |
| 61 | 新增: <!--年份选择--> | |
| 62 | 新增: <StackPanel Orientation="Horizontal"> | |
| 63 | 新增: <button:IconButton Icon="Back" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetYearCommand}" CommandParameter="-1"/> | |
| 64 | 新增: <TextBlock Width="50" TextAlignment="Center" Margin="5,0" VerticalAlignment="Center" Text="{TemplateBinding Year ,Converter= {StaticResource ToStringConverter}}"/> | |
| 65 | 新增: <button:IconButton Icon="Forward" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetYearCommand}" CommandParameter="1"/> | |
| 66 | 新增: | |
| 67 | 新增: </StackPanel> | |
| 68 | 新增: <StackPanel Grid.Column="1" Orientation="Horizontal" x:Name="MonthSelect" Visibility="Collapsed"> | |
| 69 | 新增: <button:IconButton Icon="Back" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetMonthCommand}" CommandParameter="-1"/> | |
| 70 | 新增: <TextBlock Width="30" TextAlignment="Center" Margin="5,0" VerticalAlignment="Center" Text="{TemplateBinding Month ,Converter= {StaticResource ToStringConverter}}"/> | |
| 71 | 新增: <button:IconButton Icon="Forward" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetMonthCommand}" CommandParameter="1"/> | |
| 72 | 新增: | |
| 73 | 新增: </StackPanel> | |
| 74 | 新增: </Grid> | |
| 75 | 新增: | |
| 76 | 新增: </Border> | |
| 77 | 新增: <!--日选择--> | |
| 78 | 新增: <Border Grid.Row="1" Width="250" x:Name="DaySelect" Visibility="Collapsed"> | |
| 79 | 新增: <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" > | |
| 80 | 新增: <!--<i:Interaction.Triggers> | |
| 81 | 新增: <i:EventTrigger EventName="MouseLeftButtonUp"> | |
| 82 | 新增: <i:InvokeCommandAction Command="{Binding GotoDetailCommand}" | |
| 83 | 新增: CommandParameter="{Binding SelectedItem}" /> | |
| 84 | 新增: </i:EventTrigger> | |
| 85 | 新增: </i:Interaction.Triggers>--> | |
| 86 | 新增: <ListBox.Resources> | |
| 87 | 新增: <Style TargetType="{x:Type ListView}"> | |
| 88 | 新增: <Setter Property="OverridesDefaultStyle" Value="True"/> | |
| 89 | 新增: | |
| 90 | 新增: <Setter Property="Template"> | |
| 91 | 新增: <Setter.Value> | |
| 92 | 新增: <ControlTemplate TargetType="{x:Type ListView}"> | |
| 93 | 新增: <Border> | |
| 94 | 新增: <ItemsPresenter /> | |
| 95 | 新增: </Border> | |
| 96 | 新增: </ControlTemplate> | |
| 97 | 新增: </Setter.Value> | |
| 98 | 新增: </Setter> | |
| 99 | 新增: </Style> | |
| 100 | 新增: <Style TargetType="{x:Type ListViewItem}"> | |
| 101 | 新增: <Setter Property="OverridesDefaultStyle" Value="True"/> | |
| 102 | 新增: <Setter Property="Foreground" Value="#1a1a1a"/> | |
| 103 | 新增: | |
| 104 | 新增: <Setter Property="Template"> | |
| 105 | 新增: <Setter.Value> | |
| 106 | 新增: <ControlTemplate TargetType="{x:Type ListViewItem}"> | |
| 107 | 新增: <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="White" Margin="0,0,0,0" Padding="0" Width="35" Height="35" CornerRadius="5"> | |
| 108 | 新增: <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/> | |
| 109 | 新增: </Border> | |
| 110 | 新增: <ControlTemplate.Triggers> | |
| 111 | 新增: <Trigger Property="IsMouseOver" Value="True"> | |
| 112 | 新增: <Setter TargetName="Border" Property="Background" Value="#FFE8E6FF"/> | |
| 113 | 新增: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>--> | |
| 114 | 新增: | |
| 115 | 新增: </Trigger> | |
| 116 | 新增: <Trigger Property="IsSelected" Value="True"> | |
| 117 | 新增: <Setter TargetName="Border" Property="Background" Value="#2b20d9"/> | |
| 118 | 新增: <Setter Property="Foreground" Value="White"/> | |
| 119 | 新增: | |
| 120 | 新增: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>--> | |
| 121 | 新增: | |
| 122 | 新增: </Trigger> | |
| 123 | 新增: </ControlTemplate.Triggers> | |
| 124 | 新增: </ControlTemplate> | |
| 125 | 新增: </Setter.Value> | |
| 126 | 新增: </Setter> | |
| 127 | 新增: | |
| 128 | 新增: </Style> | |
| 129 | 新增: </ListBox.Resources> | |
| 130 | 新增: <ListBox.ItemsPanel> | |
| 131 | 新增: <ItemsPanelTemplate> | |
| 132 | 新增: <WrapPanel/> | |
| 133 | 新增: </ItemsPanelTemplate> | |
| 134 | 新增: </ListBox.ItemsPanel> | |
| 135 | 新增: <ListView.ItemTemplate> | |
| 136 | 新增: <DataTemplate> | |
| 137 | 新增: | |
| 138 | 新增: <WrapPanel Orientation="Horizontal"> | |
| 139 | 新增: <Border > | |
| 140 | 新增: | |
| 141 | 新增: <TextBlock Text="{Binding}" /> | |
| 142 | 新增: | |
| 143 | 新增: </Border> | |
| 144 | 新增: | |
| 145 | 新增: </WrapPanel> | |
| 146 | 新增: </DataTemplate> | |
| 147 | 新增: </ListView.ItemTemplate> | |
| 148 | 新增: </ListView> | |
| 149 | 新增: </Border> | |
| 150 | 新增: <Border Grid.Row="2" HorizontalAlignment="Right"> | |
| 151 | 新增: <StackPanel Orientation="Horizontal"> | |
| 152 | 新增: <button:Button Content="确认" Width="100" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=DoneCommand}"/> | |
| 153 | 新增: </StackPanel> | |
| 154 | 新增: </Border> | |
| 155 | 新增: </Grid> | |
| 156 | 新增: | |
| 157 | 新增: </Border> | |
| 158 | 新增: </Popup> | |
| 159 | 新增: </Grid> | |
| 160 | 新增: </Border> | |
| 161 | 新增: <ControlTemplate.Triggers> | |
| 162 | 新增: <Trigger Property="SelectType" Value="Day"> | |
| 163 | 新增: <Setter Property="Visibility" TargetName="DaySelect" Value="Visible"/> | |
| 164 | 新增: <Setter Property="Visibility" TargetName="MonthSelect" Value="Visible"/> | |
| 165 | 新增: </Trigger> | |
| 166 | 新增: <Trigger Property="SelectType" Value="Month"> | |
| 167 | 新增: <Setter Property="Visibility" TargetName="DaySelect" Value="Collapsed"/> | |
| 168 | 新增: <Setter Property="Visibility" TargetName="MonthSelect" Value="Visible"/> | |
| 169 | 新增: | |
| 170 | 新增: </Trigger> | |
| 171 | 新增: <Trigger Property="SelectType" Value="Year"> | |
| 172 | 新增: <Setter Property="Visibility" TargetName="DaySelect" Value="Collapsed"/> | |
| 173 | 新增: <Setter Property="Visibility" TargetName="MonthSelect" Value="Collapsed"/> | |
| 174 | 新增: </Trigger> | |
| 175 | 新增: <Trigger Property="IsMouseOver" Value="True"> | |
| 176 | 新增: <Setter Property="Background" TargetName="Main" Value="#FFE8E6FF"/> | |
| 177 | 新增: <Setter TargetName="Icon" Property="Foreground" Value="#2b20d9"/> | |
| 178 | 新增: </Trigger> | |
| 179 | 新增: </ControlTemplate.Triggers> | |
| 180 | 新增: </ControlTemplate> | |
| 181 | 新增: </Setter.Value> | |
| 182 | 新增: </Setter> | |
| 183 | 新增: </Style> | |
| 184 | 新增:</ResourceDictionary> | |
| 文件末尾没有换行 | ||
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | <Grid.ColumnDefinitions> |
| 19 | 19 | <ColumnDefinition Width="30"/> |
| 20 | 20 | |
| 21 | 删除: <ColumnDefinition Width="40"/> | |
| 21 | 新增: <ColumnDefinition Width="auto"/> | |
| 22 | 22 | <ColumnDefinition Width="*"/> |
| 23 | 23 | |
| 24 | 24 | </Grid.ColumnDefinitions> |
| @@ -50,7 +50,7 @@ | ||
| 50 | 50 | </Grid> |
| 51 | 51 | </Border> |
| 52 | 52 | <!--图标--> |
| 53 | 删除: <Border Grid.Column="1" Margin="5,0,0,0"> | |
| 53 | 新增: <Border Grid.Column="1" Margin="5,0,0,0" x:Name="Img"> | |
| 54 | 54 | <base:Img URL="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Option}}, Path=Value.Img}" Width="25" Height="25" VerticalAlignment="Center"/> |
| 55 | 55 | </Border> |
| 56 | 56 | <!--文字--> |
| @@ -65,6 +65,9 @@ | ||
| 65 | 65 | |
| 66 | 66 | </Border> |
| 67 | 67 | <ControlTemplate.Triggers> |
| 68 | 新增: <Trigger Property="IsShowIcon" Value="False"> | |
| 69 | 新增: <Setter Property="Visibility" TargetName="Img" Value="Collapsed"/> | |
| 70 | 新增: </Trigger> | |
| 68 | 71 | <Trigger Property="IsChecked" Value="True"> |
| 69 | 72 | <Setter TargetName="CheckStyle" Property="Visibility" Value="Visible"/> |
| 70 | 73 | <Setter TargetName="UnCheckStyle" Property="Visibility" Value="Collapsed"/> |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 2 | 2 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | 删除: xmlns:local="clr-namespace:UI.Controls.Select" xmlns:base="clr-namespace:UI.Controls.Base"> | |
| 3 | 新增: xmlns:local="clr-namespace:UI.Controls.Select" xmlns:base="clr-namespace:UI.Controls.Base" xmlns:sys="clr-namespace:System;assembly=mscorlib"> | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | <Style TargetType="{x:Type local:Select}"> |
| @@ -12,15 +12,16 @@ | ||
| 12 | 12 | <Setter Property="Template"> |
| 13 | 13 | <Setter.Value> |
| 14 | 14 | <ControlTemplate TargetType="{x:Type local:Select}"> |
| 15 | 删除: <Border Background="{TemplateBinding Background}" HorizontalAlignment="Left" > | |
| 15 | 新增: <Border Background="{TemplateBinding Background}" HorizontalAlignment="Left" SnapsToDevicePixels="True"> | |
| 16 | 16 | <Grid> |
| 17 | 17 | <!--当前选择项--> |
| 18 | 删除: <Border x:Name="Main" Margin="0,10,0,0" Background="#f9f9f9" HorizontalAlignment="Left" Padding="15,5" CornerRadius="5"> | |
| 18 | 新增: <Border x:Name="Main" Background="#f9f9f9" HorizontalAlignment="Left" Padding="15,5" CornerRadius="5"> | |
| 19 | 19 | <Border.Effect> |
| 20 | 20 | <DropShadowEffect Color="#d8d2d2" BlurRadius="1" Direction="300" ShadowDepth="4" Opacity="0.1" RenderingBias="Performance" ></DropShadowEffect> |
| 21 | 21 | </Border.Effect> |
| 22 | 22 | <StackPanel Orientation="Horizontal"> |
| 23 | 删除: <base:Img URL="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Img}" Width="30" Height="30" VerticalAlignment="Center"/> | |
| 23 | 新增: <!--<TextBlock x:Name="PlaceholderText" Text="请选择" Visibility="Collapsed"/>--> | |
| 24 | 新增: <base:Img x:Name="Img" URL="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Img}" Width="25" Height="25" VerticalAlignment="Center"/> | |
| 24 | 25 | <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Name}" VerticalAlignment="Center" Margin="5,0,0,0"/> |
| 25 | 26 | </StackPanel> |
| 26 | 27 | </Border> |
| @@ -52,6 +53,18 @@ | ||
| 52 | 53 | <Trigger Property="IsMouseOver" Value="True"> |
| 53 | 54 | <Setter Property="Background" TargetName="Main" Value="#FFE8E6FF"/> |
| 54 | 55 | </Trigger> |
| 56 | 新增: <Trigger Property="IsShowIcon" Value="False"> | |
| 57 | 新增: <Setter Property="Visibility" TargetName="Img" Value="Collapsed"/> | |
| 58 | 新增: </Trigger> | |
| 59 | 新增: <!--<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Img}" Value="{x:Static sys:String.Empty}"> | |
| 60 | 新增: <Setter Property="Visibility" TargetName="Img" Value="Collapsed"/> | |
| 61 | 新增: | |
| 62 | 新增: </DataTrigger> | |
| 63 | 新增: <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Name}" Value=""> | |
| 64 | 新增: <Setter Property="Visibility" TargetName="Img" Value="Collapsed"/> | |
| 65 | 新增: <Setter Property="Visibility" TargetName="PlaceholderText" Value="Visible"/> | |
| 66 | 新增: | |
| 67 | 新增: </DataTrigger>--> | |
| 55 | 68 | </ControlTemplate.Triggers> |
| 56 | 69 | </ControlTemplate> |
| 57 | 70 | </Setter.Value> |
| @@ -0,0 +1,319 @@ | ||
| 1 | 新增:using Core.Librarys; | |
| 2 | 新增:using Core.Models; | |
| 3 | 新增:using Core.Servicers.Interfaces; | |
| 4 | 新增:using System; | |
| 5 | 新增:using System.Collections.Generic; | |
| 6 | 新增:using System.Linq; | |
| 7 | 新增:using System.Text; | |
| 8 | 新增:using System.Threading.Tasks; | |
| 9 | 新增:using UI.Controls; | |
| 10 | 新增:using UI.Controls.Charts.Model; | |
| 11 | 新增:using UI.Controls.Select; | |
| 12 | 新增:using UI.Librays; | |
| 13 | 新增:using UI.Models; | |
| 14 | 新增:using UI.Views; | |
| 15 | 新增: | |
| 16 | 新增:namespace UI.ViewModels | |
| 17 | 新增:{ | |
| 18 | 新增: public class ChartPageVM : ChartPageModel | |
| 19 | 新增: { | |
| 20 | 新增: private readonly ICategorys categorys; | |
| 21 | 新增: private readonly IData data; | |
| 22 | 新增: private readonly MainViewModel mainVM; | |
| 23 | 新增: public Command ToDetailCommand { get; set; } | |
| 24 | 新增: | |
| 25 | 新增: public ChartPageVM(IData data, ICategorys categorys, MainViewModel mainVM) | |
| 26 | 新增: { | |
| 27 | 新增: this.data = data; | |
| 28 | 新增: this.categorys = categorys; | |
| 29 | 新增: this.mainVM = mainVM; | |
| 30 | 新增: | |
| 31 | 新增: | |
| 32 | 新增: ToDetailCommand = new Command(new Action<object>(OnTodetailCommand)); | |
| 33 | 新增: | |
| 34 | 新增: TabbarData = new System.Collections.ObjectModel.ObservableCollection<string>() | |
| 35 | 新增: { | |
| 36 | 新增: "按天","按周","按月","按年" | |
| 37 | 新增: }; | |
| 38 | 新增: | |
| 39 | 新增: var weekOptions = new List<SelectItemModel>(); | |
| 40 | 新增: weekOptions.Add(new SelectItemModel() | |
| 41 | 新增: { | |
| 42 | 新增: Name = "本周" | |
| 43 | 新增: }); | |
| 44 | 新增: weekOptions.Add(new SelectItemModel() | |
| 45 | 新增: { | |
| 46 | 新增: Name = "上周" | |
| 47 | 新增: }); | |
| 48 | 新增: | |
| 49 | 新增: WeekOptions = weekOptions; | |
| 50 | 新增: | |
| 51 | 新增: SelectedWeek = weekOptions[0]; | |
| 52 | 新增: | |
| 53 | 新增: MonthDate = DateTime.Now; | |
| 54 | 新增: | |
| 55 | 新增: TabbarSelectedIndex = 0; | |
| 56 | 新增: | |
| 57 | 新增: Date = DateTime.Now; | |
| 58 | 新增: | |
| 59 | 新增: YearDate = DateTime.Now; | |
| 60 | 新增: | |
| 61 | 新增: LoadDayData(); | |
| 62 | 新增: | |
| 63 | 新增: PropertyChanged += ChartPageVM_PropertyChanged; | |
| 64 | 新增: } | |
| 65 | 新增: | |
| 66 | 新增: private void OnTodetailCommand(object obj) | |
| 67 | 新增: { | |
| 68 | 新增: var data = obj as ChartsDataModel; | |
| 69 | 新增: | |
| 70 | 新增: if (data != null) | |
| 71 | 新增: { | |
| 72 | 新增: var model = data.Data as DailyLogModel; | |
| 73 | 新增: if (model != null && model.AppModel != null) | |
| 74 | 新增: { | |
| 75 | 新增: mainVM.Data = model.AppModel; | |
| 76 | 新增: mainVM.Uri = nameof(DetailPage); | |
| 77 | 新增: } | |
| 78 | 新增: | |
| 79 | 新增: } | |
| 80 | 新增: } | |
| 81 | 新增: | |
| 82 | 新增: private void ChartPageVM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) | |
| 83 | 新增: { | |
| 84 | 新增: if (e.PropertyName == nameof(Date)) | |
| 85 | 新增: { | |
| 86 | 新增: LoadDayData(); | |
| 87 | 新增: } | |
| 88 | 新增: if (e.PropertyName == nameof(TabbarSelectedIndex)) | |
| 89 | 新增: { | |
| 90 | 新增: if (TabbarSelectedIndex == 0) | |
| 91 | 新增: { | |
| 92 | 新增: NameIndexStart = 0; | |
| 93 | 新增: | |
| 94 | 新增: LoadDayData(); | |
| 95 | 新增: } | |
| 96 | 新增: else if (TabbarSelectedIndex == 1) | |
| 97 | 新增: { | |
| 98 | 新增: LoadWeekData(); | |
| 99 | 新增: } | |
| 100 | 新增: else if (TabbarSelectedIndex == 2) | |
| 101 | 新增: { | |
| 102 | 新增: NameIndexStart = 1; | |
| 103 | 新增: | |
| 104 | 新增: LoadMonthlyData(); | |
| 105 | 新增: } | |
| 106 | 新增: else if (TabbarSelectedIndex == 3) | |
| 107 | 新增: { | |
| 108 | 新增: LoadYearData(); | |
| 109 | 新增: } | |
| 110 | 新增: | |
| 111 | 新增: } | |
| 112 | 新增: if (e.PropertyName == nameof(SelectedWeek)) | |
| 113 | 新增: { | |
| 114 | 新增: LoadWeekData(); | |
| 115 | 新增: } | |
| 116 | 新增: if (e.PropertyName == nameof(MonthDate)) | |
| 117 | 新增: { | |
| 118 | 新增: LoadMonthlyData(); | |
| 119 | 新增: } | |
| 120 | 新增: if (e.PropertyName == nameof(YearDate)) | |
| 121 | 新增: { | |
| 122 | 新增: LoadYearData(); | |
| 123 | 新增: } | |
| 124 | 新增: } | |
| 125 | 新增: | |
| 126 | 新增: /// <summary> | |
| 127 | 新增: /// 加载天数据 | |
| 128 | 新增: /// </summary> | |
| 129 | 新增: private void LoadDayData() | |
| 130 | 新增: { | |
| 131 | 新增: Task.Run(() => | |
| 132 | 新增: { | |
| 133 | 新增: var list = data.GetCategoryHoursData(Date); | |
| 134 | 新增: | |
| 135 | 新增: var chartData = new List<ChartsDataModel>(); | |
| 136 | 新增: | |
| 137 | 新增: foreach (var item in list) | |
| 138 | 新增: { | |
| 139 | 新增: var category = categorys.GetCategory(item.CategoryID); | |
| 140 | 新增: | |
| 141 | 新增: chartData.Add(new ChartsDataModel() | |
| 142 | 新增: { | |
| 143 | 新增: | |
| 144 | 新增: Name = category.Name, | |
| 145 | 新增: Icon = category.IconFile, | |
| 146 | 新增: Values = item.Values, | |
| 147 | 新增: }); | |
| 148 | 新增: } | |
| 149 | 新增: | |
| 150 | 新增: Data = chartData; | |
| 151 | 新增: | |
| 152 | 新增: LoadTopData(); | |
| 153 | 新增: }); | |
| 154 | 新增: } | |
| 155 | 新增: | |
| 156 | 新增: /// <summary> | |
| 157 | 新增: /// 加载周数据 | |
| 158 | 新增: /// </summary> | |
| 159 | 新增: private void LoadWeekData() | |
| 160 | 新增: { | |
| 161 | 新增: Task.Run(() => | |
| 162 | 新增: { | |
| 163 | 新增: var weekDateArr = SelectedWeek.Name == "本周" ? Time.GetThisWeekDate() : Time.GetLastWeekDate(); | |
| 164 | 新增: | |
| 165 | 新增: WeekDateStr = weekDateArr[0].ToString("yyyy年MM月dd日") + " 到 " + weekDateArr[1].ToString("yyyy年MM月dd日"); | |
| 166 | 新增: | |
| 167 | 新增: var list = data.GetCategoryRangeData(weekDateArr[0], weekDateArr[1]); | |
| 168 | 新增: | |
| 169 | 新增: var chartData = new List<ChartsDataModel>(); | |
| 170 | 新增: | |
| 171 | 新增: string[] weekNames = { "周一", "周二", "周三", "周四", "周五", "周六", "周日", }; | |
| 172 | 新增: foreach (var item in list) | |
| 173 | 新增: { | |
| 174 | 新增: var category = categorys.GetCategory(item.CategoryID); | |
| 175 | 新增: | |
| 176 | 新增: chartData.Add(new ChartsDataModel() | |
| 177 | 新增: { | |
| 178 | 新增: | |
| 179 | 新增: Name = category.Name, | |
| 180 | 新增: Icon = category.IconFile, | |
| 181 | 新增: Values = item.Values, | |
| 182 | 新增: ColumnNames = weekNames | |
| 183 | 新增: }); | |
| 184 | 新增: } | |
| 185 | 新增: | |
| 186 | 新增: Data = chartData; | |
| 187 | 新增: }); | |
| 188 | 新增: | |
| 189 | 新增: | |
| 190 | 新增: LoadTopData(); | |
| 191 | 新增: | |
| 192 | 新增: } | |
| 193 | 新增: | |
| 194 | 新增: /// <summary> | |
| 195 | 新增: /// 加载月数据 | |
| 196 | 新增: /// </summary> | |
| 197 | 新增: private void LoadMonthlyData() | |
| 198 | 新增: { | |
| 199 | 新增: Task.Run(() => | |
| 200 | 新增: { | |
| 201 | 新增: var dateArr = Time.GetMonthDate(MonthDate); | |
| 202 | 新增: | |
| 203 | 新增: var list = data.GetCategoryRangeData(dateArr[0], dateArr[1]); | |
| 204 | 新增: | |
| 205 | 新增: var chartData = new List<ChartsDataModel>(); | |
| 206 | 新增: | |
| 207 | 新增: foreach (var item in list) | |
| 208 | 新增: { | |
| 209 | 新增: var category = categorys.GetCategory(item.CategoryID); | |
| 210 | 新增: | |
| 211 | 新增: chartData.Add(new ChartsDataModel() | |
| 212 | 新增: { | |
| 213 | 新增: | |
| 214 | 新增: Name = category.Name, | |
| 215 | 新增: Icon = category.IconFile, | |
| 216 | 新增: Values = item.Values, | |
| 217 | 新增: }); | |
| 218 | 新增: } | |
| 219 | 新增: | |
| 220 | 新增: Data = chartData; | |
| 221 | 新增: | |
| 222 | 新增: LoadTopData(); | |
| 223 | 新增: }); | |
| 224 | 新增: | |
| 225 | 新增: } | |
| 226 | 新增: | |
| 227 | 新增: /// <summary> | |
| 228 | 新增: /// 加载年份数据 | |
| 229 | 新增: /// </summary> | |
| 230 | 新增: private void LoadYearData() | |
| 231 | 新增: { | |
| 232 | 新增: Task.Run(() => | |
| 233 | 新增: { | |
| 234 | 新增: var list = data.GetCategoryYearData(YearDate); | |
| 235 | 新增: | |
| 236 | 新增: var chartData = new List<ChartsDataModel>(); | |
| 237 | 新增: | |
| 238 | 新增: string[] names = new string[12]; | |
| 239 | 新增: for (int i = 0; i < 12; i++) | |
| 240 | 新增: { | |
| 241 | 新增: names[i] = (i + 1) + "月"; | |
| 242 | 新增: } | |
| 243 | 新增: | |
| 244 | 新增: foreach (var item in list) | |
| 245 | 新增: { | |
| 246 | 新增: var category = categorys.GetCategory(item.CategoryID); | |
| 247 | 新增: | |
| 248 | 新增: chartData.Add(new ChartsDataModel() | |
| 249 | 新增: { | |
| 250 | 新增: | |
| 251 | 新增: Name = category.Name, | |
| 252 | 新增: Icon = category.IconFile, | |
| 253 | 新增: Values = item.Values, | |
| 254 | 新增: ColumnNames = names | |
| 255 | 新增: }); | |
| 256 | 新增: } | |
| 257 | 新增: | |
| 258 | 新增: Data = chartData; | |
| 259 | 新增: | |
| 260 | 新增: LoadTopData(); | |
| 261 | 新增: }); | |
| 262 | 新增: } | |
| 263 | 新增: | |
| 264 | 新增: private void LoadTopData() | |
| 265 | 新增: { | |
| 266 | 新增: Task.Run(() => | |
| 267 | 新增: { | |
| 268 | 新增: var dateStart = Date.Date; | |
| 269 | 新增: var dateEnd = Date.Date; | |
| 270 | 新增: if (TabbarSelectedIndex == 1) | |
| 271 | 新增: { | |
| 272 | 新增: // 周 | |
| 273 | 新增: var weekDateArr = SelectedWeek.Name == "本周" ? Time.GetThisWeekDate() : Time.GetLastWeekDate(); | |
| 274 | 新增: | |
| 275 | 新增: dateStart = weekDateArr[0]; | |
| 276 | 新增: dateEnd = weekDateArr[1]; | |
| 277 | 新增: | |
| 278 | 新增: } | |
| 279 | 新增: else if (TabbarSelectedIndex == 2) | |
| 280 | 新增: { | |
| 281 | 新增: // 月 | |
| 282 | 新增: var dateArr = Time.GetMonthDate(MonthDate); | |
| 283 | 新增: dateStart = dateArr[0]; | |
| 284 | 新增: dateEnd = dateArr[1]; | |
| 285 | 新增: } | |
| 286 | 新增: else if (TabbarSelectedIndex == 3) | |
| 287 | 新增: { | |
| 288 | 新增: // 年 | |
| 289 | 新增: var dateArr = Time.GetYearDate(YearDate); | |
| 290 | 新增: dateStart = dateArr[0]; | |
| 291 | 新增: dateEnd = dateArr[1]; | |
| 292 | 新增: } | |
| 293 | 新增: var list = data.GetDateRangelogList(dateStart, dateEnd, 3); | |
| 294 | 新增: | |
| 295 | 新增: TopData = MapToChartsData(list); | |
| 296 | 新增: }); | |
| 297 | 新增: } | |
| 298 | 新增: | |
| 299 | 新增: private List<ChartsDataModel> MapToChartsData(IEnumerable<Core.Models.DailyLogModel> list) | |
| 300 | 新增: { | |
| 301 | 新增: var resData = new List<ChartsDataModel>(); | |
| 302 | 新增: | |
| 303 | 新增: foreach (var item in list) | |
| 304 | 新增: { | |
| 305 | 新增: | |
| 306 | 新增: var bindModel = new ChartsDataModel(); | |
| 307 | 新增: bindModel.Data = item; | |
| 308 | 新增: bindModel.Name = item.AppModel?.Name; | |
| 309 | 新增: bindModel.Value = item.Time; | |
| 310 | 新增: bindModel.Tag = Timer.Fromat(item.Time); | |
| 311 | 新增: bindModel.PopupText = item.AppModel?.File; | |
| 312 | 新增: bindModel.Icon = item.AppModel?.IconFile; | |
| 313 | 新增: resData.Add(bindModel); | |
| 314 | 新增: } | |
| 315 | 新增: | |
| 316 | 新增: return resData; | |
| 317 | 新增: } | |
| 318 | 新增: } | |
| 319 | 新增:} | |
| @@ -74,6 +74,7 @@ namespace UI.ViewModels | ||
| 74 | 74 | IndexUriList.Add(nameof(IndexPage)); |
| 75 | 75 | IndexUriList.Add(nameof(DataPage)); |
| 76 | 76 | IndexUriList.Add(nameof(CategoryPage)); |
| 77 | 新增: IndexUriList.Add(nameof(ChartPage)); | |
| 77 | 78 | |
| 78 | 79 | |
| 79 | 80 | Items.Add(new Controls.Navigation.Models.NavigationItemModel() |
| @@ -89,7 +90,7 @@ namespace UI.ViewModels | ||
| 89 | 90 | Icon = Controls.Base.IconTypes.BIDashboard, |
| 90 | 91 | Title = "统计", |
| 91 | 92 | ID = 1, |
| 92 | 删除: Uri = nameof(DataPage), | |
| 93 | 新增: Uri = nameof(ChartPage), | |
| 93 | 94 | |
| 94 | 95 | }); |
| 95 | 96 | Items.Add(new Controls.Navigation.Models.NavigationItemModel() |
| @@ -0,0 +1,51 @@ | ||
| 1 | 新增:<Page x:Class="UI.Views.ChartPage" | |
| 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:charts="clr-namespace:UI.Controls.Charts" xmlns:Tabbar="clr-namespace:UI.Controls.Tabbar" xmlns:select="clr-namespace:UI.Controls.Select" xmlns:base="clr-namespace:UI.Controls.Base" xmlns:DatePickerBar="clr-namespace:UI.Controls.DatePickerBar" | |
| 7 | 新增: mc:Ignorable="d" | |
| 8 | 新增: d:DesignHeight="450" d:DesignWidth="800" | |
| 9 | 新增: Title="ChartPage"> | |
| 10 | 新增: | |
| 11 | 新增: <Grid> | |
| 12 | 新增: <StackPanel Margin="20"> | |
| 13 | 新增: <TextBlock Text="统计" FontSize="18" Margin="0,5,0,20"/> | |
| 14 | 新增: <Tabbar:Tabbar Data="{Binding TabbarData}" SelectedIndex="{Binding TabbarSelectedIndex,Mode=TwoWay}"/> | |
| 15 | 新增: <Border> | |
| 16 | 新增: <Grid> | |
| 17 | 新增: <!--按天--> | |
| 18 | 新增: <base:View Condition="0" Value="{Binding TabbarSelectedIndex}"> | |
| 19 | 新增: <select:DateSelect Date="{Binding Date,Mode=TwoWay}"/> | |
| 20 | 新增: </base:View> | |
| 21 | 新增: | |
| 22 | 新增: <!--按周--> | |
| 23 | 新增: <base:View Condition="1" Value="{Binding TabbarSelectedIndex}"> | |
| 24 | 新增: <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> | |
| 25 | 新增: <select:Select IsShowIcon="False" SelectedItem="{Binding SelectedWeek,Mode=TwoWay}" Options="{Binding WeekOptions}"/> | |
| 26 | 新增: <TextBlock Foreground="#626262" Margin="20,0,0,0" FontSize="14" Text="{Binding WeekDateStr}" VerticalAlignment="Center"/> | |
| 27 | 新增: </StackPanel> | |
| 28 | 新增: </base:View> | |
| 29 | 新增: <!--按月--> | |
| 30 | 新增: <base:View Condition="2" Value="{Binding TabbarSelectedIndex}"> | |
| 31 | 新增: <select:DateSelect Date="{Binding MonthDate,Mode=TwoWay}" SelectType="Month"/> | |
| 32 | 新增: | |
| 33 | 新增: </base:View> | |
| 34 | 新增: <!--按年--> | |
| 35 | 新增: <base:View Condition="3" Value="{Binding TabbarSelectedIndex}"> | |
| 36 | 新增: <select:DateSelect Date="{Binding YearDate,Mode=TwoWay}" SelectType="Year"/> | |
| 37 | 新增: | |
| 38 | 新增: </base:View> | |
| 39 | 新增: </Grid> | |
| 40 | 新增: </Border> | |
| 41 | 新增: <Border Margin="0,20,0,0" Height="330" Width="680" HorizontalAlignment="Left" Background="White" Padding="20" CornerRadius="10"> | |
| 42 | 新增: <charts:Charts NameIndexStart="{Binding NameIndexStart}" ChartsType="Column" Data="{Binding Data}"/> | |
| 43 | 新增: | |
| 44 | 新增: </Border> | |
| 45 | 新增: <TextBlock Text="最为频繁" FontSize="15" Margin="0,20,0,5"/> | |
| 46 | 新增: <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}"/> | |
| 48 | 新增: </Border> | |
| 49 | 新增: </StackPanel> | |
| 50 | 新增: </Grid> | |
| 51 | 新增:</Page> | |
| @@ -0,0 +1,49 @@ | ||
| 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 | 新增:using UI.Controls.Charts.Model; | |
| 16 | 新增:using UI.ViewModels; | |
| 17 | 新增: | |
| 18 | 新增:namespace UI.Views | |
| 19 | 新增:{ | |
| 20 | 新增: /// <summary> | |
| 21 | 新增: /// ChartPage.xaml 的交互逻辑 | |
| 22 | 新增: /// </summary> | |
| 23 | 新增: public partial class ChartPage : Page | |
| 24 | 新增: { | |
| 25 | 新增: public ChartPage(ChartPageVM vm) | |
| 26 | 新增: { | |
| 27 | 新增: InitializeComponent(); | |
| 28 | 新增: DataContext = vm; | |
| 29 | 新增: | |
| 30 | 新增: //var data = new List<ChartsDataModel>(); | |
| 31 | 新增: //data.Add(new ChartsDataModel() | |
| 32 | 新增: //{ | |
| 33 | 新增: // Name="分布", | |
| 34 | 新增: // //Color= "#2f69fe", | |
| 35 | 新增: // Values = new double[] { 10, 20, 30, 40,30,403,30,50,43,43,23,65,87,43,23,23 } | |
| 36 | 新增: //}); | |
| 37 | 新增: //data.Add(new ChartsDataModel() | |
| 38 | 新增: //{ | |
| 39 | 新增: // Name = "测试", | |
| 40 | 新增: | |
| 41 | 新增: // //Color = "#da4d07", | |
| 42 | 新增: // Values = new double[] { 110, 30, 10, 20, 330, 203, 3, 500, 53, 93, 23, 65, 87, 43, 23, 23 } | |
| 43 | 新增: //}); | |
| 44 | 新增: | |
| 45 | 新增: | |
| 46 | 新增: //test.Data = data; | |
| 47 | 新增: } | |
| 48 | 新增: } | |
| 49 | 新增:} | |
| @@ -69,7 +69,7 @@ | ||
| 69 | 69 | <TextBlock Text="{Binding Process.Data.AppModel.Category.Name}" VerticalAlignment="Center" Margin="5,0,0,0"/> |
| 70 | 70 | </StackPanel> |
| 71 | 71 | </Border>--> |
| 72 | 删除: <Select:Select ToolTip="分类" SelectedItem="{Binding Category,Mode=TwoWay}" Options="{Binding Categorys}"/> | |
| 72 | 新增: <Select:Select Margin="0,10,0,0" ToolTip="分类" SelectedItem="{Binding Category,Mode=TwoWay}" Options="{Binding Categorys}"/> | |
| 73 | 73 | |
| 74 | 74 | </StackPanel> |
| 75 | 75 | |

