From bd3cb640be12621ac37253e8a8c627ae40692e4d Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 7 Feb 2019 15:39:12 +0200 Subject: Some fixes and improvements for PPC & Machine Studio. --- .../Tango.PPC.Events/Tango.PPC.Events.csproj | 8 ++++++++ .../Tango.PPC.Events/ViewModels/MainViewVM.cs | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj index f38fe9162..fa7583e85 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/Tango.PPC.Events.csproj @@ -129,6 +129,10 @@ {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} Tango.Logging @@ -145,6 +149,10 @@ {fd86424c-6e84-491b-8df9-3d0f5c236a2a} Tango.Touch + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + {0be74eee-22cb-4dba-b896-793b9e1a3ac0} Tango.PPC.Common 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 ed35a9b2d..9ee24ad38 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 @@ -12,6 +12,7 @@ using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Notifications.NotificationItems; using Tango.PPC.Events.Enumerations; using System.Data.Entity; +using Tango.Integration.Operation; namespace Tango.PPC.Events.ViewModels { @@ -98,6 +99,26 @@ namespace Tango.PPC.Events.ViewModels 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(); } + + MachineProvider.MachineOperator.StatusChanged += MachineOperator_StatusChanged; + } + + private void MachineOperator_StatusChanged(object sender, MachineStatuses status) + { + if (status == MachineStatuses.Disconnected) + { + foreach (var notification in _notifications.ToList()) + { + NotificationProvider.PopNotification(notification.Value); + } + + _notifications.Clear(); + + InvokeUI(() => + { + CurrentEvents.Clear(); + }); + } } private void EventLogger_EventReceived(object sender, MachinesEvent ev) -- cgit v1.3.1