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. --- .../Dialogs/FirmwareNotificationView.xaml | 55 ++++++++++++++++++++ .../Dialogs/FirmwareNotificationView.xaml.cs | 28 ++++++++++ .../Dialogs/FirmwareNotificationViewVM.cs | 22 ++++++++ .../Dialogs/GeneralInformationView.xaml | 15 ++++++ .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 10 +++- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 60 ++++++++++++++++++++-- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- 7 files changed, 186 insertions(+), 6 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationViewVM.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml new file mode 100644 index 000000000..6951ce0ad --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml @@ -0,0 +1,55 @@ + + + + + CLOSE + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml.cs new file mode 100644 index 000000000..ba264c8a4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Dialogs +{ + /// + /// Interaction logic for SpoolReplaceView.xaml + /// + public partial class FirmwareNotificationView : UserControl + { + public FirmwareNotificationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationViewVM.cs new file mode 100644 index 000000000..dd3989566 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/FirmwareNotificationViewVM.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.MachineStatus; +using Tango.SharedUI; + +namespace Tango.PPC.UI.Dialogs +{ + public class FirmwareNotificationViewVM : DialogViewVM + { + public NotificationType Type { get; set; } + public String Title { get; set; } + public String Message { get; set; } + + public FirmwareNotificationViewVM() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml index 85d905841..c7b7e2952 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/GeneralInformationView.xaml @@ -55,6 +55,21 @@ + + + + + Machine Name: + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index f0a513cb5..31c46b296 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -225,6 +225,10 @@ JerricanReplaceView.xaml + + FirmwareNotificationView.xaml + + WasteReplacementView.xaml @@ -405,6 +409,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -1035,7 +1043,7 @@ if $(ConfigurationName) == X1 copy /Y "$(ProjectDir)Intro.wmv" "$(TargetDir)" - + 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 } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + -- cgit v1.3.1