diff --git a/UI/Controls/DatePickerBar/DatePickerBar.cs b/UI/Controls/DatePickerBar/DatePickerBar.cs
index 04bde1bd88f58c7cbf2aa1b5eb558a4122e74fcb..1a77a9e9bdd2b4446835c54b2f8af88440abab85 100644
--- a/UI/Controls/DatePickerBar/DatePickerBar.cs
+++ b/UI/Controls/DatePickerBar/DatePickerBar.cs
@@ -175,6 +175,10 @@ namespace UI.Controls.DatePickerBar
MonthsList.SelectedItemChanged += DateChanged;
}
+ if(ShowType== DatePickerShowType.Year)
+ {
+ SelectedDateString = SelectedDate.ToString("yyyy");
+ }
}
private void DateChanged(object sender, EventArgs e)
diff --git a/UI/Controls/DatePickerBar/DatePickerShowType.cs b/UI/Controls/DatePickerBar/DatePickerShowType.cs
index 2c290427c9d61d9c02a8396f0f8814bdac9f13db..436da8c9521e6825fd62fdf0a60090a3601313b5 100644
--- a/UI/Controls/DatePickerBar/DatePickerShowType.cs
+++ b/UI/Controls/DatePickerBar/DatePickerShowType.cs
@@ -19,5 +19,9 @@ namespace UI.Controls.DatePickerBar
/// 月
///
Month,
+ ///
+ /// 年
+ ///
+ Year,
}
}
diff --git a/UI/Models/DataPageModel.cs b/UI/Models/DataPageModel.cs
index 410f146ff06ca8e85f8982f877227a8832c7671d..625fdf259d3c262f94276089e3d571ff14ef02b4 100644
--- a/UI/Models/DataPageModel.cs
+++ b/UI/Models/DataPageModel.cs
@@ -64,5 +64,15 @@ namespace UI.Models
get { return MonthDate_; }
set { MonthDate_ = value; OnPropertyChanged(); }
}
+
+ private DateTime YearDate_;
+ ///
+ /// date
+ ///
+ public DateTime YearDate
+ {
+ get { return YearDate_; }
+ set { YearDate_ = value; OnPropertyChanged(); }
+ }
}
}
diff --git a/UI/Themes/DatePickerBar/DatePickerBar.xaml b/UI/Themes/DatePickerBar/DatePickerBar.xaml
index 76496f3211f8a2890028859c1aa09baed30e67c4..3d154c83f1dc4b9cb647f794366b44051942d2ff 100644
--- a/UI/Themes/DatePickerBar/DatePickerBar.xaml
+++ b/UI/Themes/DatePickerBar/DatePickerBar.xaml
@@ -86,7 +86,7 @@
-
+
-
+
@@ -135,7 +135,9 @@
-
+
+
+
diff --git a/UI/ViewModels/DataPageVM.cs b/UI/ViewModels/DataPageVM.cs
index 88fec526b148663cedf72264942984eb3a3a9a48..12a5cb70ba344b6959787c4a1e5db81311bf9d43 100644
--- a/UI/ViewModels/DataPageVM.cs
+++ b/UI/ViewModels/DataPageVM.cs
@@ -40,7 +40,7 @@ namespace UI.ViewModels
TabbarData = new System.Collections.ObjectModel.ObservableCollection()
{
- "按天查看","按月查看"
+ "按天查看","按月查看","按年查看"
};
TabbarSelectedIndex = 0;
@@ -83,7 +83,7 @@ namespace UI.ViewModels
}
}
- else
+ else if (TabbarSelectedIndex == 1)
{
if (MonthDate == DateTime.MinValue)
{
@@ -94,6 +94,17 @@ namespace UI.ViewModels
LoadData(MonthDate);
}
}
+ else if (TabbarSelectedIndex == 2)
+ {
+ if (YearDate == DateTime.MinValue)
+ {
+ YearDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
+ }
+ else
+ {
+ LoadData(YearDate);
+ }
+ }
}
}
@@ -113,11 +124,15 @@ namespace UI.ViewModels
dateStart = new DateTime(date.Year, date.Month, 1);
dateEnd = new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month));
}
- else
+ else if (TabbarSelectedIndex == 0)
{
dateStart = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
dateEnd = new DateTime(date.Year, date.Month, date.Day, 23, 59, 59);
-
+ }
+ else if (TabbarSelectedIndex == 2)
+ {
+ dateStart = new DateTime(date.Year, 1, 1, 0, 0, 0);
+ dateEnd = new DateTime(date.Year, 12, DateTime.DaysInMonth(date.Year, 12), 23, 59, 59);
}
var list = data.GetDateRangelogList(dateStart, dateEnd);
Data = MapToChartsData(list);
diff --git a/UI/Views/DataPage.xaml b/UI/Views/DataPage.xaml
index d5042e515db13c3c25420d312b636a33aba7966f..484f82105ea070500bc08a8bb15e39de157f80c4 100644
--- a/UI/Views/DataPage.xaml
+++ b/UI/Views/DataPage.xaml
@@ -45,6 +45,13 @@
+
+
+
+
+
+
+