diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-07 16:10:45 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-07 16:10:45 +0300 |
| commit | b6a210c5b82c2cf0215e8cdb61e1ab2c1b43f0dd (patch) | |
| tree | ba79c2d4833fa28e4428b94f4da8b9e9eb876ca1 /Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels | |
| parent | a895c48616d94c8be0ef33f0ce58d9457d5dfd1b (diff) | |
| download | Tango-b6a210c5b82c2cf0215e8cdb61e1ab2c1b43f0dd.tar.gz Tango-b6a210c5b82c2cf0215e8cdb61e1ab2c1b43f0dd.zip | |
Resolved PPC CPU usage by events.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels')
| -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()); + } } }); } |
