diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs index dcf6afb97..997ea70d5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs @@ -97,7 +97,7 @@ namespace Tango.PPC.Events.ViewModels using (var db = ObservablesContext.CreateDefault()) { var last_week = DateTime.UtcNow.AddDays(-7); - HistoryEvents = (await db.MachinesEvents.Where(x => x.MachineGuid == MachineProvider.Machine.Guid && x.DateTime > last_week).Include(x => x.EventType).Where(x => (EventTypeNotificationTimes)x.EventType.EventNotificationTime != EventTypeNotificationTimes.None).ToListAsync()).OrderByDescending(x => x.DateTime).ToObservableCollection(); + HistoryEvents = (await db.MachinesEvents.Where(x => x.MachineGuid == MachineProvider.Machine.Guid && x.DateTime > last_week).Take(100).Include(x => x.EventType).Where(x => (EventTypeNotificationTimes)x.EventType.EventNotificationTime != EventTypeNotificationTimes.None).ToListAsync()).OrderByDescending(x => x.DateTime).ToObservableCollection(); } MachineProvider.MachineOperator.StatusChanged += MachineOperator_StatusChanged; @@ -177,6 +177,11 @@ namespace Tango.PPC.Events.ViewModels _notifications.Remove(item); NotificationProvider.PopNotification(item.Value); } + + if (HistoryEvents.Count > 100) + { + HistoryEvents.Remove(HistoryEvents.Last()); + } } }); } |
