From b6a210c5b82c2cf0215e8cdb61e1ab2c1b43f0dd Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 7 May 2019 16:10:45 +0300 Subject: Resolved PPC CPU usage by events. --- .../Modules/Tango.PPC.Events/Resources/Styles.xaml | 54 +++++++++++++++++++++- .../Tango.PPC.Events/ViewModels/MainViewVM.cs | 7 ++- .../Modules/Tango.PPC.Events/Views/MainView.xaml | 2 +- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/Views/LayoutView.xaml | 2 +- .../PPC/Tango.PPC.UI/Views/MainView.xaml | 2 +- 6 files changed, 62 insertions(+), 7 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml index 468ba228d..53102d8ec 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Resources/Styles.xaml @@ -4,7 +4,7 @@ xmlns:converters="clr-namespace:Tango.PPC.Events.Converters" xmlns:local="clr-namespace:Tango.PPC.Events.Resources"> - + - + + + + + + + + + \ No newline at end of file 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()); + } } }); } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml index af42a5576..f263e4b7b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Views/MainView.xaml @@ -135,7 +135,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index a6fbaa3ce..24512bf27 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.0.22.0")] +[assembly: AssemblyVersion("1.0.23.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 18c8cc7ae..82a57a22b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -283,7 +283,7 @@ - + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index 604c79aeb..9899e60d4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -82,7 +82,7 @@ - + -- cgit v1.3.1