aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IMachineSetupView.cs
blob: 65b194f7b65ef1de40895720b98d6f2955249c76 (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.PPC.Common;
using static Tango.PPC.UI.ViewModels.MachineSetupViewVM;

namespace Tango.PPC.UI.ViewsContracts
{
    /// <summary>
    /// Represents the machine setup view contract.
    /// </summary>
    /// <seealso cref="Tango.PPC.Common.IPPCView" />
    public interface IMachineSetupView : IPPCView
    {
        /// <summary>
        /// Appends the log.
        /// </summary>
        /// <param name="log">The log.</param>
        void AppendLog(String log);

        /// <summary>
        /// Navigates to the specified machine setup view.
        /// </summary>
        /// <param name="view">The view.</param>
        Task NavigateTo(MachineSetupView view);
    }
}
ghlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using ColorMine.ColorSpaces;
using LiteDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using Tango.Core;

namespace Tango.PPC.Jobs.Models
{
    public class TrialsLogModel: ExtendedObject
    {
        #region Properties

        [BsonIgnore]
        public String JobRunGuid { get; set; }

        private int _trialNumber;

        public int TrialNumber
        {
            get { return _trialNumber; }
            set
            {
                _trialNumber = value;
                RaisePropertyChangedAuto();
                RaisePropertyChanged(nameof(Trial));
            }
        }
        
        [BsonIgnore]
        public string Trial {
            get {
                if(TrialNumber == 0)
                    return "T";
                return TrialNumber.ToString();
                }
        }
        //LAB
        private double? _l;

        public double? L
        {
            get { return _l; }
            set { _l = value;
            RaisePropertyChanged(nameof(LAB));
                OnLABChanged();}
        }
        private double? _a;

        public double? A
        {
            get { return _a; }
            set { _a = value;
                
                    RaisePropertyChanged(nameof(LAB)); OnLABChanged(); }
        }
        private double? _b;

        public double? B
        {
            get { return _b; }
            set { _b = value; RaisePropertyChanged(nameof(LAB)); OnLABChanged(); }
        }
        public double VectorCorrectionL { get; set; }
        public double VectorCorrectionA { get; set; }
        public double VectorCorrectionB { get; set; }

        public double LightnessOffset { get; set; }
        public double ChromaOffset { get; set; }
        public double HueOffset { get; set; }

        public bool IsManualCorrection { get; set; }
        //LCH
        private double _LCH_C;

        public double LCH_C
        {
            get { return _LCH_C; }
            set {
                _LCH_C = value;
                //RaisePropertyChanged(nameof(LAB));
            }
        }

        private double _h;

        public double H
        {
            get { return _h; }
            set { _h = value;
                //RaisePropertyChanged(nameof(LAB));
            }
        }

        public double dL { get; set; }
        public double dC { get; set; }
        public double dH { get; set; }

        public bool CorrectOnlyHue { get; set; }

        public double SuggestionL { get; set; }
        public double SuggestionA { get; set; }
        public double SuggestionB { get; set; }

        public double C { get; set; }
        public double M { get; set; }
        public double Y { get; set; }
        public double K { get; set; }

        [BsonIgnore]
        public string CMYK
        {
            get
            {
                return String.Format("{0:0.##},{1:0.##},{2:0.##},{3:0.##}", C, M, Y, K);
            }
        }
        
        public double NewSuggestionL { get; set; }
        public double NewSuggestionA { get; set; }
        public double NewSuggestionB { get; set; }

        private DateTime _date;

        public DateTime Date
        {
            get { return _date; }
            set { _date = value; RaisePropertyChangedAuto(); }
        }

        private double? _deltaE;

        public double? DeltaE
        {
            get { return _deltaE; }
            set { _deltaE = value;
                RaisePropertyChangedAuto();
                RaisePropertyChanged(nameof(DeltaEDisplay));
            }
        }

        public string DeltaEDisplay
        {
            get
            {
                if (DeltaE == null)
                    return "";
               // if (IsBest)
                //    return String.Format($"{DeltaE:0.##} Best");
                return String.Format($"{DeltaE:0.##}");
            }
        }
        private bool _IsActiveTrial;
        [BsonIgnore]
        public bool IsActiveTrial
        {
            get { return _IsActiveTrial; }
            set { _IsActiveTrial = value;
            RaisePropertyChangedAuto();
            }
        }

        [BsonIgnore]
        public string LAB
        {
            get {
                if(!ValidationLAB())
                    return "";
                return String.Format("{0:0.##},{1:0.##},{2:0.##}", L, A, B); }
        }

        private bool _istested;

        public bool IsTested
        {
            get { return _istested; }
            set
            {
                _istested = value;
                if (_istested)
                {
                    IsSelectionEnable = true;
                }
            }
        }

        private bool  _isBest;

        public bool  IsBest
        {
            get { return _isBest; }
            set { _isBest = value;
                RaisePropertyChangedAuto();
                RaisePropertyChanged(nameof(DeltaEDisplay));}
        }




        private bool _isSelectionEnable;
        [BsonIgnore]
        public bool IsSelectionEnable
        {
            get { return _isSelectionEnable; }
            set { _isSelectionEnable = value;
            RaisePropertyChangedAuto();
            }
        }

        [BsonIgnore]
        public System.Windows.Media.Color SuggestedColor
        {
            get {
                Lab lab = new Lab() { L = NewSuggestionL, A = NewSuggestionA, B = NewSuggestionB };
                //Cmyk cmyk = new Cmyk { C = C, M = M, Y = Y, K = K};
                IRgb RGB = lab.ToRgb();
                //IRgb RGB = cmyk.ToRgb();
                return Color.FromRgb((byte)RGB.R, (byte)RGB.G, (byte)RGB.B);
            }
            
        }


        #endregion


        public TrialsLogModel(int trial, double c, double m, double y, double k)
        {
            TrialNumber = trial;
            IsActiveTrial = false;
            C = c;
            M = m;
            Y = y;
            K = k;
            L = A = B = null; 
            Date = DateTime.UtcNow;
            RaisePropertyChanged(nameof(CMYK));
            IsTested = false;
            IsSelectionEnable = true;
            IsBest = false;
        }

        #region Methods

        private bool ValidationLAB()
        {
            if (L == null || L < 0 || L > 100
                    || A == null || A < -128 || A > 127
                    || B == null || B < -128 || B > 127)
                return false;
            return true;
        }

        private void OnLABChanged()
        {
            if (ValidationLAB())
            {
                ;
            }
        }

        #endregion

       
    }
}