aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL/Entities/Rml.cs
blob: fd8f3d2d19ba1b0b1ee5383401094c3d82227b76 (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 ColorMine.ColorSpaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace Tango.BL.Entities
{
    public partial class Rml : RmlBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Rml" /> class.
        /// </summary>
        public Rml() : base()
        {

        }

        protected override void OnWhitePointLChanged(double whitepointl)
        {
            base.OnWhitePointLChanged(whitepointl);
            UpdateColor();
        }

        protected override void OnWhitePointAChanged(double whitepointa)
        {
            base.OnWhitePointAChanged(whitepointa);
            UpdateColor();
        }

        protected override void OnWhitePointBChanged(double whitepointb)
        {
            base.OnWhitePointBChanged(whitepointb);
            UpdateColor();
        }

        private void UpdateColor()
        {
            RaisePropertyChanged(nameof(Color));
        }

        public Color Color
        {
            get
            {
                Lab lab = new Lab(WhitePointA, WhitePointA, WhitePointB);
                Rgb rgb = lab.To<Rgb>();
                return Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B);
            }
        }

        public ProcessParametersTablesGroup GetActiveProcessGroup()
        {
            return ProcessParametersTablesGroups.FirstOrDefault(x => x.Active);
        }
    }
}