From 3b661bbfd2b66788efcf6f445e03069df7248889 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 23 Jun 2021 09:42:28 +0300 Subject: Implemented head type checking on PPC. --- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels') 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 c22d690aa..9074bcd4c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -22,6 +22,7 @@ using Tango.PPC.UI.Dialogs; using Tango.SharedUI; using System.Data.Entity; using Tango.PPC.UI.AppBarItems; +using Tango.PPC.Common.Notifications.NotificationItems; namespace Tango.PPC.UI.ViewModels { @@ -36,6 +37,7 @@ namespace Tango.PPC.UI.ViewModels private bool _isThreadLoadingShown; private PowerUpAppBarItem _powerUpAppBar; private bool _started; + private MessageNotificationItem _headTypeNotification; private DateTime _currentDateTime; /// @@ -53,6 +55,12 @@ namespace Tango.PPC.UI.ViewModels _date_timer.Interval = TimeSpan.FromSeconds(1); _date_timer.Tick += _date_timer_Tick; _date_timer.Start(); + + _headTypeNotification = new MessageNotificationItem(); + _headTypeNotification.CanClose = false; + _headTypeNotification.MessageType = MessageNotificationItem.MessageNotificationItemTypes.Error; + _headTypeNotification.Priority = NotificationItem.NotificationPriority.Critical; + _headTypeNotification.Message = "Machine head type mismatch."; } /// @@ -74,6 +82,8 @@ namespace Tango.PPC.UI.ViewModels MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted; MachineProvider.MachineOperator.PowerUpProgress += MachineOperator_PowerUpProgress; MachineProvider.MachineOperator.PowerUpEnded += MachineOperator_PowerUpEnded; + + MachineProvider.MachineConnected += MachineProvider_MachineConnected; } #region Power Up @@ -247,5 +257,23 @@ namespace Tango.PPC.UI.ViewModels // DisplayThreadLoading(e); } #endregion + + #region Head Type Check + + private void MachineProvider_MachineConnected(object sender, EventArgs e) + { + NotificationProvider.PopNotification(_headTypeNotification); + + if (MachineProvider.MachineOperator.DeviceInformation != null) + { + if (MachineProvider.Machine.HeadType != (int)MachineProvider.MachineOperator.DeviceInformation.HeadType) + { + _headTypeNotification.ExpandedMessage = $"Machine configuration reports head type '{MachineProvider.Machine.MachineHeadType}' while firmware device reports '{MachineProvider.MachineOperator.DeviceInformation.HeadType}'."; + NotificationProvider.PushNotification(_headTypeNotification); + } + } + } + + #endregion } } -- cgit v1.3.1