using HardwareData; namespace HistoryUI.ViewModels; public partial class AlarmViewModel(Hardwares hardwares, IORM orm) : BaseViewModel(hardwares, orm) { [RelayCommand] protected override void Query() { if (!base.QueryBase(out byte mini8, out byte Channel)) return; //ChannelData channelData = new(); //channelData.ChannelIndex = 0; //channelData.Name = "All"; //base.Channels[0] = channelData; _orm.Query($"Error-Mini8-{mini8}", t => t.DateTime >= this.StartTime && t.DateTime <= this.EndTime && t.PV < 1600 && t.PV > 10, QueryResult); } private void QueryResult(List results) { results = [.. results.OrderBy(t => t.DateTime)]; App.Current.Dispatcher?.Invoke(() => { base.Results = null; Dictionary temp = []; for (int i = 1; i <= results.Count; i++) { temp.Add(i, results[i - 1]); } base.Results = temp; }); } }