diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-05-07 19:27:19 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-05-07 19:27:19 +0300 |
| commit | 4635d671ecc0ac65372ebaaa7044230f44317c77 (patch) | |
| tree | 6630bf6940552c46ae2d0f90632d2c5fff4d848a /Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels/MainViewVM.cs | |
| parent | 51f0a70bca80ccad4eae7c4abf0c09a6215540a9 (diff) | |
| parent | 952b8d7f3c81d6943d0bbf665b74ff58ab8c1201 (diff) | |
| download | Tango-4635d671ecc0ac65372ebaaa7044230f44317c77.tar.gz Tango-4635d671ecc0ac65372ebaaa7044230f44317c77.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
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()); + } } }); } |
