| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using HardwareData;
- namespace HistoryUI.ViewModels;
- public partial class AlarmViewModel(Hardwares hardwares, IORM orm) : BaseViewModel<DBWarning>(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<DBWarning>($"Error-Mini8-{mini8}",
- t => t.DateTime >= this.StartTime
- && t.DateTime <= this.EndTime &&
- t.PV < 1600 && t.PV > 10,
- QueryResult);
- }
- private void QueryResult(List<DBWarning> results)
- {
- results = [.. results.OrderBy(t => t.DateTime)];
- App.Current.Dispatcher?.Invoke(() =>
- {
- base.Results = null;
- Dictionary<int, DBWarning> temp = [];
- for (int i = 1; i <= results.Count; i++)
- {
- temp.Add(i, results[i - 1]);
- }
- base.Results = temp;
- });
- }
- }
|