aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Models/DispenserController.cs
blob: a3ee9a6135b2b493f3895114e0b2f084f8fe9a3d (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core;
using Tango.Core.Commands;
using Tango.Integration.Operation;
using Tango.PMR.Diagnostics;

namespace Tango.PPC.Technician.Models
{
    public class DispenserController : ExtendedObject
    {
        private IMachineOperator _operator;

        public String Name { get; set; }
        public int Index { get; set; }

        private bool _isMovingUp;
        public bool IsMovingUp
        {
            get { return _isMovingUp; }
            set { _isMovingUp = value; RaisePropertyChangedAuto(); }
        }

        private bool _isMovingDown;
        public bool IsMovingDown
        {
            get { return _isMovingDown; }
            set { _isMovingDown = value; RaisePropertyChangedAuto(); }
        }


        private bool _isHoming;
        public bool IsHoming
        {
            get { return _isHoming; }
            set { _isHoming = value; RaisePropertyChangedAuto(); }
        }

        public RelayCommand MoveUpCommand { get; set; }
        public RelayCommand MoveDownCommand { get; set; }
        public RelayCommand HomeCommand { get; set; }

        public DispenserController(IMachineOperator machineOperator)
        {
            _operator = machineOperator;
        }

        public DispenserController()
        {
            MoveUpCommand = new RelayCommand(MoveUp, () => !IsHoming && !IsMovingDown);
            MoveDownCommand = new RelayCommand(MoveDown, () => !IsHoming && !IsMovingUp);
            HomeCommand = new RelayCommand(Home, () => !IsMovingUp && !IsMovingDown);
        }

        private void Home()
        {

        }

        private void MoveDown()
        {

        }

        private async void MoveUp()
        {
            await _operator.StartDispenserJogging(new DispenserJoggingRequest());
        }
    }
}