diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-06-23 09:42:28 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-06-23 09:42:28 +0300 |
| commit | 3b661bbfd2b66788efcf6f445e03069df7248889 (patch) | |
| tree | 90fd360a2a705d05e0fc071914770201907dd578 /Software/Visual_Studio/PPC | |
| parent | 230f73f478a6428a975a51789b6f43ca7a8a5ef8 (diff) | |
| download | Tango-3b661bbfd2b66788efcf6f445e03069df7248889.tar.gz Tango-3b661bbfd2b66788efcf6f445e03069df7248889.zip | |
Implemented head type checking on PPC.
Diffstat (limited to 'Software/Visual_Studio/PPC')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 28 |
1 files changed, 28 insertions, 0 deletions
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; /// <summary> @@ -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."; } /// <summary> @@ -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 } } |
