From 64bcf92608faae31b7cd31ac3da5c7d1d7ebcd0b Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 14 Jul 2018 21:27:57 +0300 Subject: Implemented job completed notification item. --- .../JobCompletedNotificationItem.cs | 20 ++++++++++++++++ .../JobCompletedNotificationItemView.xaml | 16 +++++++++++++ .../JobCompletedNotificationItemView.xaml.cs | 28 ++++++++++++++++++++++ .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 11 +++++++++ .../Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs | 15 +++++++++++- 5 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItem.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItemView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItemView.xaml.cs (limited to 'Software/Visual_Studio/PPC/Modules') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItem.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItem.cs new file mode 100644 index 000000000..5c48dc606 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItem.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.Jobs.NotificationItems +{ + public class JobCompletedNotificationItem : NotificationItem + { + public override Type ViewType + { + get + { + return typeof(JobCompletedNotificationItemView); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItemView.xaml new file mode 100644 index 000000000..b96337eff --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItemView.xaml @@ -0,0 +1,16 @@ + + + + + The job has been completed + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItemView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItemView.xaml.cs new file mode 100644 index 000000000..b6d9797e5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NotificationItems/JobCompletedNotificationItemView.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.Jobs.NotificationItems +{ + /// + /// Interaction logic for JobCompletedNotificationItemView.xaml + /// + public partial class JobCompletedNotificationItemView : UserControl + { + public JobCompletedNotificationItemView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index aafa028c7..9ff90ca42 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -92,6 +92,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -159,6 +163,10 @@ + + + JobCompletedNotificationItemView.xaml + Code @@ -322,5 +330,8 @@ + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index 9a0d0f8ab..f3d16e899 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -8,6 +8,7 @@ using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Navigation; using Tango.PPC.Jobs.AppBarItems; +using Tango.PPC.Jobs.NotificationItems; using Tango.PPC.Jobs.Views; namespace Tango.PPC.Jobs.ViewModels @@ -45,6 +46,18 @@ namespace Tango.PPC.Jobs.ViewModels Job = jobHandler.Job; jobHandler.StatusChanged += JobHandler_StatusChanged; jobHandler.Stopped += JobHandler_Stopped; + jobHandler.Completed += JobHandler_Completed; + } + + private void JobHandler_Completed(object sender, EventArgs e) + { + InvokeUI(() => + { + NotificationProvider.PushNotification().Pressed += (_, __) => + { + NavigationManager.NavigateTo(nameof(JobView)); + }; + }); } public override void OnNavigatedFrom() @@ -53,7 +66,7 @@ namespace Tango.PPC.Jobs.ViewModels if (MachineProvider.MachineOperator.IsPrinting) { - NotificationProvider.PushAppBarItem().Preesed += (_, __) => + NotificationProvider.PushAppBarItem().Pressed += (_, __) => { NotificationProvider.CurrentAppBarItem.Close(); NavigationManager.NavigateTo(nameof(JobProgressView)); -- cgit v1.3.1