aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Models/JerricanLevelModel.cs
blob: 052ef90f67d5ba2ac000008cc09657f16eedc1af (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;
using Tango.Core;
using Tango.Core.Commands;
using Tango.Integration.Operation;

namespace Tango.PPC.UI.Models
{
    public class JerricanLevelModel : ExtendedObject
    {
        public RelayCommand PressedCommand { get; set; }

        public event EventHandler<JerricanLevelModel> PressedEvent;

        public double Max { get; set; }

        private double _level;
        public double Level
        {
            get { return _level; }
            set { _level = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsMidTankLow)); }
        }

        private bool _bJerricanPresent;

        public bool JerricanPresent
        {
            get { return _bJerricanPresent; }
            set
            {
                _bJerricanPresent = value;
                RaisePropertyChangedAuto();
            }
        }

        private bool _fillingTimeoutError;

        public bool FillingTimeoutError
        {
            get { return _fillingTimeoutError; }
            set { _fillingTimeoutError = value; RaisePropertyChangedAuto(); }
        }

        private bool _midTankEmpty;

        public bool MidTankEmpty
        {
            get { return _midTankEmpty; }
            set { _midTankEmpty = value; RaisePropertyChangedAuto(); }
        }

        private bool _midTankRefillPumpActive;

        public bool MidTankRefillPumpActive
        {
            get { return _midTankRefillPumpActive; }
            set { _midTankRefillPumpActive = value; RaisePropertyChangedAuto(); }
        }

        public bool IsMidTankLow
        {
            get { return Level <= 0.5; }
        }

        private TimeSpan _remainingTimeoutError_;
        public TimeSpan RemainingTimeoutError
        {
            get { return _remainingTimeoutError_; }
            set { _remainingTimeoutError_ = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasRemainingTimeoutError)); }
        }

        public bool HasRemainingTimeoutError
        {
            get { return RemainingTimeoutError > TimeSpan.Zero; }
        }


        public IdsPack IDSPack { get; set; }

        public JerricanLevelModel()
        {
            //RemainingTimeoutError = new TimeSpan(1,2,0);
            JerricanPresent = true;
            //FillingTimeoutError = MidTankEmpty = MidTankRefillPumpActive = false;

            PressedCommand = new RelayCommand(() => PressedEvent?.Invoke(this, this));
        }
    }
}