From 3d8c362cd5409246c7026ea956ce10d51ed9ebc3 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 21 Aug 2025 16:49:02 +0300 Subject: Telemetry Wires. Implemented Firmware User Notifications. Added Missing UI Settings Units Display. Add Machine Name to General Information Dialog. --- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 60 ++++++++++++++++++++-- 1 file changed, 56 insertions(+), 4 deletions(-) (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 67b007371..33e5239b0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -25,6 +25,7 @@ using Tango.PPC.UI.AppBarItems; using Tango.PPC.Common.Notifications.NotificationItems; using Tango.Core.Commands; using System.Timers; +using Tango.PMR.MachineStatus; namespace Tango.PPC.UI.ViewModels { @@ -104,16 +105,18 @@ namespace Tango.PPC.UI.ViewModels _screenSaverTimer.Elapsed += _screenSaverTimer_Elapsed; _screenSaverTimer.Start(); + + MachineProvider.MachineOperator.NotificationAvailable += MachineOperator_NotificationAvailable; } #region Waste Replacement private void MachineOperator_WasteReplacementRequired(object sender, EventArgs e) { - InvokeUI(async () => + InvokeUI(async () => { var vm = await NotificationProvider.ShowDialog(); - + if (MachineProvider.IsConnected) { try @@ -298,7 +301,7 @@ namespace Tango.PPC.UI.ViewModels private void MachineOperator_ThreadLoadingConfirmationRequired(object sender, ThreadLoadingConfirmationRequiredEventArgs e) { -// DisplayThreadLoading(e); + // DisplayThreadLoading(e); } #endregion @@ -340,7 +343,56 @@ namespace Tango.PPC.UI.ViewModels IsScreenSaverOn = true; } } - + + #endregion + + #region Firmware Notifications + + private void MachineOperator_NotificationAvailable(object sender, PMR.MachineStatus.StartNotificationResponse e) + { + InvokeUI(async () => + { + if (!e.IsBlocking) + { + NotificationProvider.PushNotification(new MessageNotificationItem() + { + CanClose = true, + MessageType = ConvertNotificationToMessageType(e.Type), + Message = e.Title, + ExpandedMessage = e.Message + }); + } + else + { + await NotificationProvider.ShowDialog(new FirmwareNotificationViewVM() + { + Type = e.Type, + Title = e.Title, + Message = e.Message + }); + } + }); + } + + private MessageNotificationItem.MessageNotificationItemTypes ConvertNotificationToMessageType(NotificationType type) + { + switch (type) + { + case NotificationType.NotifyInfo: + return MessageNotificationItem.MessageNotificationItemTypes.Info; + case NotificationType.NotifyWarning: + return MessageNotificationItem.MessageNotificationItemTypes.Warning; + case NotificationType.NotifyError: + return MessageNotificationItem.MessageNotificationItemTypes.Error; + case NotificationType.NotifyCritical: + return MessageNotificationItem.MessageNotificationItemTypes.Critical; + case NotificationType.NotifySuccess: + return MessageNotificationItem.MessageNotificationItemTypes.Success; + default: + return MessageNotificationItem.MessageNotificationItemTypes.Info; + } + } + #endregion } } -- cgit v1.3.1