|
@@ -44,6 +44,7 @@ namespace Venus_MainPages.ViewModels
|
|
|
DispatcherTimer timer = new DispatcherTimer();
|
|
|
public List<SolidColorBrush> solidColorBrushes = new List<SolidColorBrush> ();
|
|
|
DateTime currentTime;
|
|
|
+ private bool firstFlag = true;
|
|
|
#endregion
|
|
|
|
|
|
#region 属性
|
|
@@ -70,6 +71,10 @@ namespace Venus_MainPages.ViewModels
|
|
|
public DelegateCommand<object> LoadCommand =>
|
|
|
_LoadCommand ?? (_LoadCommand = new DelegateCommand<object>(OnLoad));
|
|
|
|
|
|
+ private DelegateCommand _UnLoadCommand;
|
|
|
+ public DelegateCommand UnLoadCommand =>
|
|
|
+ _UnLoadCommand ?? (_UnLoadCommand = new DelegateCommand(OnUnLoad));
|
|
|
+
|
|
|
private DelegateCommand<object> _ParameterCheckCommand;
|
|
|
public DelegateCommand<object> ParameterCheckCommand =>
|
|
|
_ParameterCheckCommand ?? (_ParameterCheckCommand = new DelegateCommand<object>(OnParameterCheck));
|
|
@@ -118,11 +123,20 @@ namespace Venus_MainPages.ViewModels
|
|
|
#region 命令方法
|
|
|
private void OnLoad(Object eventView)
|
|
|
{
|
|
|
- this.DataHistoryView = (DataHistoryView)eventView;
|
|
|
- this.DataHistoryView.wfTimeFrom.Value = DateTime.Today;
|
|
|
- this.DataHistoryView.wfTimeTo.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59, 999);
|
|
|
- //this.DataHistoryView.MyDrawGraphicsControl.PointCollections=new PointCollection(new Point[] {})
|
|
|
-
|
|
|
+ if (firstFlag)
|
|
|
+ {
|
|
|
+ this.DataHistoryView = (DataHistoryView)eventView;
|
|
|
+ this.DataHistoryView.wfTimeFrom.Value = DateTime.Today;
|
|
|
+ this.DataHistoryView.wfTimeTo.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59, 999);
|
|
|
+ //this.DataHistoryView.MyDrawGraphicsControl.PointCollections=new PointCollection(new Point[] {})
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void OnUnLoad()
|
|
|
+ {
|
|
|
+ GC.Collect(); // This should pick up the control removed at a previous MouseDown
|
|
|
+ GC.WaitForPendingFinalizers(); // Doesn't help either
|
|
|
+ GC.Collect();
|
|
|
+ GC.WaitForPendingFinalizers(); // Doesn't help either
|
|
|
}
|
|
|
private void OnParameterCheck(object obj)
|
|
|
{
|