aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-02-10 18:28:41 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-02-10 18:28:41 +0200
commita65868d1d77b1929b855abd0c19bdc08bc9cee9d (patch)
tree09486bed718fb096914780f33313fb82a0207c87 /Software/Visual_Studio/PPC/Modules/Tango.PPC.Events/ViewModels
parent82179e1b69b62b971a04af571979e7d10c60fd7a (diff)
parentac9678197fc6142595089155d98442239a64e6d7 (diff)
downloadTango-a65868d1d77b1929b855abd0c19bdc08bc9cee9d.tar.gz
Tango-a65868d1d77b1929b855abd0c19bdc08bc9cee9d.zip
merge
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.cs21
1 files changed, 21 insertions, 0 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 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)