aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs
blob: 93cea9485109161950563f8e6194bf5e28c6e156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.PPC.Common;
using Tango.PPC.Jobs.Messages;
using Tango.PPC.Jobs.Views;

namespace Tango.PPC.Jobs.ViewModels
{
    public class JobSummeryViewVM : PPCViewModel
    {
        private Job _job;
        /// <summary>
        /// Gets or sets the job.
        /// </summary>
        public Job Job
        {
            get { return _job; }
            set { _job = value; RaisePropertyChangedAuto(); }
        }

        public RelayCommand DyeCommand { get; set; }

        public RelayCommand EditCommand { get; set; }

        public JobSummeryViewVM()
        {
            RegisterForMessage<JobSelectedMessage>(HandleJobSelectedMessage);

            DyeCommand = new RelayCommand(StartJob);
            EditCommand = new RelayCommand(EditJob);
        }

        private void HandleJobSelectedMessage(JobSelectedMessage message)
        {
            Job = message.Job;
        }

        private void EditJob()
        {
            NavigationManager.NavigateTo<JobsModule>(false, nameof(JobView));
        }

        private void StartJob()
        {
            MachineProvider.MachineOperator.Print(Job);
            NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView));
        }

        public override void OnApplicationStarted()
        {

        }
    }
}