aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs61
1 files changed, 38 insertions, 23 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
index 46c6d7ffd..1a980fc4a 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
@@ -9,7 +9,9 @@ using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.PPC.Common;
using Tango.PPC.Common.Messages;
+using Tango.PPC.Common.Navigation;
using Tango.PPC.Jobs.Messages;
+using Tango.PPC.Jobs.NavigationObjects;
using Tango.PPC.Jobs.Views;
namespace Tango.PPC.Jobs.ViewModels
@@ -18,7 +20,7 @@ namespace Tango.PPC.Jobs.ViewModels
/// Represents the job summary view model.
/// </summary>
/// <seealso cref="Tango.PPC.Common.PPCViewModel" />
- public class JobSummeryViewVM : PPCViewModel
+ public class JobSummeryViewVM : PPCViewModel, INavigationObjectReceiver<JobSummeryNavigationObject>
{
private ObservablesContext _context;
@@ -32,6 +34,18 @@ namespace Tango.PPC.Jobs.ViewModels
set { _job = value; RaisePropertyChangedAuto(); }
}
+ private TimeSpan _estimatedDuration;
+ /// <summary>
+ /// Gets or sets the duration of the estimated.
+ /// </summary>
+
+ public TimeSpan EstimatedDuration
+ {
+ get { return _estimatedDuration; }
+ set { _estimatedDuration = value; RaisePropertyChangedAuto(); }
+ }
+
+
/// <summary>
/// Gets or sets the dye command.
/// </summary>
@@ -47,23 +61,11 @@ namespace Tango.PPC.Jobs.ViewModels
/// </summary>
public JobSummeryViewVM()
{
- RegisterForMessage<JobSelectedMessage>(HandleJobSelectedMessage);
-
DyeCommand = new RelayCommand(StartJob);
EditCommand = new RelayCommand(EditJob);
}
/// <summary>
- /// Handles the job selected message.
- /// </summary>
- /// <param name="message">The message.</param>
- private void HandleJobSelectedMessage(JobSelectedMessage message)
- {
- _context = message.Context;
- Job = message.Job;
- }
-
- /// <summary>
/// Edits the job.
/// </summary>
private void EditJob()
@@ -81,16 +83,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
LogManager.Log("Start job command pressed. Starting job and navigating to job progress view...");
- Job = await new JobBuilder(_context).Set(Job.Guid)
- .WithConfiguration()
- .WithRML()
- .WithUser()
- .WithSegments()
- .WithBrushStops()
- .BuildAsync();
-
- PrintingManager.Print(Job, _context);
- await NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView));
+ await PrintingManager.Print(Job, _context);
+ await NavigationManager.NavigateTo<JobsModule>(false, nameof(JobProgressView));
}
catch (Exception ex)
{
@@ -106,5 +100,26 @@ namespace Tango.PPC.Jobs.ViewModels
{
}
+
+ public async void OnNavigatedToWithObject(JobSummeryNavigationObject obj)
+ {
+ _context = obj.Context;
+ Job = obj.Job;
+
+ Job = await new JobBuilder(_context).Set(Job.Guid)
+ .WithConfiguration()
+ .WithRML()
+ .WithUser()
+ .WithSegments()
+ .WithBrushStops()
+ .BuildAsync();
+
+
+ try
+ {
+ EstimatedDuration = await Job.GetEstimatedDuration();
+ }
+ catch { }
+ }
}
}