aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-09-16 17:48:16 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-09-16 17:48:16 +0300
commit161fe6f6d2b29ba3deb641cdc049ad0d8f58004e (patch)
tree20318bb7ea4a243b8c2e9757e4635e8d5f5cb728 /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
parent30fcfa4100a9d00e887c6e17e32e427b05296ce7 (diff)
parentb674a2e7751daa80c0d74207968bf8e3d18d7faf (diff)
downloadTango-161fe6f6d2b29ba3deb641cdc049ad0d8f58004e.tar.gz
Tango-161fe6f6d2b29ba3deb641cdc049ad0d8f58004e.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/EmergencyViewVM.cs51
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs1
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs29
3 files changed, 81 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/EmergencyViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/EmergencyViewVM.cs
new file mode 100644
index 000000000..87b3c012b
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/EmergencyViewVM.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Integration.Emergency;
+using Tango.PPC.Common;
+using Tango.PPC.Common.Navigation;
+
+namespace Tango.PPC.UI.ViewModels
+{
+ public class EmergencyViewVM : PPCViewModel
+ {
+ private bool _isActive;
+
+ public override void OnApplicationStarted()
+ {
+
+ }
+
+ public override void OnApplicationReady()
+ {
+ base.OnApplicationReady();
+ MachineProvider.MachineOperator.EmergencyNotificationProvider.StatusChanged += EmergencyNotificationProvider_StatusChanged;
+ }
+
+ private void EmergencyNotificationProvider_StatusChanged(object sender, EmergencyStatusChangedEventArgs e)
+ {
+ InvokeUI(async () =>
+ {
+ if (e.Status == EmergencyStatus.On && !_isActive)
+ {
+ LogManager.Log("Emergency switch activated...");
+ _isActive = true;
+ await NavigationManager.NavigateTo(NavigationView.EmergencyView);
+ }
+ else if (_isActive)
+ {
+ LogManager.Log("Emergency switch deactivated...");
+ _isActive = false;
+ await NavigationManager.NavigateTo(NavigationView.LayoutView);
+ }
+
+ if (e.Status == EmergencyStatus.Error && e.ErrorException != null)
+ {
+ LogManager.Log(e.ErrorException, "Error occurred while detecting emergency switch.");
+ }
+ });
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs
index 80a95d1bf..f1127ebfe 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.Core.DI;
+using Tango.Core.ExtensionMethods;
using Tango.Integration.ExternalBridge;
using Tango.PMR.Integration;
using Tango.PPC.Common;
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
index a4f550a39..01a47539e 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System.Windows.Threading;
using Tango.Core.DI;
using Tango.Integration.ExternalBridge;
+using Tango.Integration.Operation;
using Tango.PPC.Common;
using Tango.PPC.Common.Application;
using Tango.PPC.Common.Authentication;
@@ -14,6 +15,7 @@ using Tango.PPC.Common.Modules;
using Tango.PPC.Common.Navigation;
using Tango.PPC.Common.Notifications;
using Tango.PPC.Common.WatchDog;
+using Tango.PPC.UI.Dialogs;
using Tango.SharedUI;
namespace Tango.PPC.UI.ViewModels
@@ -49,6 +51,13 @@ namespace Tango.PPC.UI.ViewModels
/// </summary>
public override void OnApplicationStarted()
{
+
+ }
+
+ public override void OnApplicationReady()
+ {
+ base.OnApplicationReady();
+ MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived;
}
#region Event Handlers
@@ -63,6 +72,26 @@ namespace Tango.PPC.UI.ViewModels
CurrentDateTime = DateTime.Now;
}
+ private void MachineOperator_CartridgeValidationRequestReceived(object sender, CartridgeValidationEventArgs e)
+ {
+ InvokeUI(async () =>
+ {
+ var vm = await NotificationProvider.ShowDialog<CartridgeValidationViewVM>(new CartridgeValidationViewVM()
+ {
+ IDSPacks = MachineProvider.Machine.Configuration.NoneEmptyIdsPacks.ToList(),
+ });
+
+ if (vm.DialogResult)
+ {
+ e.Approve(vm.SelectedIDSPack.PackIndex);
+ }
+ else
+ {
+ e.Decline();
+ }
+ });
+ }
+
#endregion
}
}