| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using OHV.Common.Model;
- using OHV.SqliteDAL;
- using Prism.Commands;
- using Prism.Mvvm;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Security.Permissions;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Input;
- namespace OHV.Module.MainViews.Views
- {
- public class HistoryViewModel : BindableBase
- {
- SqliteManager sql;
- List<HisAlarm> _alarmList;
- public List<HisAlarm> AlarmList
- {
- get { return this._alarmList; }
- set { this.SetProperty( ref this._alarmList , value ); }
- }
- public ICommand AlarmResetCommand { get; set; }
- public HistoryViewModel( SqliteManager _sql )
- {
- this.sql = _sql;
- //this.AlarmResetCommand = new DelegateCommand( ExecuteAlarmResetCommand );
- var ll = sql.HisAlarmDAL.GetAll();
- if ( ll == null )
- this.AlarmList = new List<HisAlarm>();
- else
- this.AlarmList = ll.OrderByDescending( x => x.OccurTime ).ToList();
- //this.sql.HisAlarmDAL.OnChangeTable += HisAlarmDAL_ChangedProperty;
- }
- private void HisAlarmDAL_ChangedProperty()
- {
- if ( this.AlarmList == null )
- return;
- this.AlarmList.Clear();
- this.AlarmList = null;
- this.AlarmList = sql.HisAlarmDAL.GetAll().OrderByDescending( x => x.OccurTime ).ToList();
- }
- public void RefashList()
- {
- if ( this.AlarmList == null )
- return;
- this.AlarmList.Clear();
- this.AlarmList = null;
- this.AlarmList = sql.HisAlarmDAL.GetAll().OrderByDescending( x => x.OccurTime ).ToList();
- }
- public void Init( )
- {
- //RefashList();
- }
- }
- }
|