aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs60
1 files changed, 56 insertions, 4 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 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<WasteReplacementViewVM>();
-
+
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<FirmwareNotificationViewVM>(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
}
}