aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs29
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs83
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs109
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs2
5 files changed, 222 insertions, 3 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs
index 2033fac48..8a071f126 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs
@@ -668,7 +668,7 @@ namespace Tango.PPC.Jobs.Models
}
/// <summary>
- /// Sets the new color.
+ /// Sets the new color from MyColors.
/// </summary>
public void SetNewColor( BrushStopModel newBrushStop)
{
@@ -794,6 +794,33 @@ namespace Tango.PPC.Jobs.Models
return color;
}
+ public void SetMyColor(FavoriteColor favoriteColor)
+ {
+ Color = favoriteColor.Color;
+ BestMatchColor = favoriteColor.Color;
+ ColorSpace = favoriteColor.ColorSpace;
+ // _colorcatalogsitem = favoriteColor.ColorCatalogsItem;
+
+ PreventPropertyUpdate = true;
+
+ Cyan = favoriteColor.Cyan;
+ Magenta = favoriteColor.Magenta;
+ Yellow = favoriteColor.Yellow;
+ Black = favoriteColor.Black;
+
+ Red = favoriteColor.Red;
+ Green = favoriteColor.Green;
+ Blue = favoriteColor.Blue;
+ L = favoriteColor.L;
+ A = favoriteColor.A;
+ B = favoriteColor.B;
+ BestMatchL = favoriteColor.L;
+ BestMatchA = favoriteColor.A;
+ BestMatchB = favoriteColor.B;
+ PreventPropertyUpdate = false;
+ LiquidVolumesOutOfRange = false;
+ }
+
#endregion
#region changes
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs
new file mode 100644
index 000000000..511a90e15
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs
@@ -0,0 +1,83 @@
+using LiteDB;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+using Tango.PPC.Jobs.MyColors;
+using Tango.SharedUI;
+
+namespace Tango.PPC.Jobs.Models
+{
+ public class ColorLibrary: ExtendedObject
+ {
+ private ObservableCollection<FavoriteColor> _colorList;
+ public ObservableCollection<FavoriteColor> ColorList
+ {
+ get { return _colorList; }
+ set { _colorList = value; }
+ }
+
+ [BsonId]
+ public Int32 ID { get; set; }
+
+ private string _name;
+ public string Name
+ {
+ get { return _name; }
+ set { _name = value; }
+ }
+
+ private bool _editColorsGroupMode;
+ [BsonIgnore]
+ public bool EditColorsGroupMode
+ {
+ get { return _editColorsGroupMode; }
+ set { _editColorsGroupMode = value; RaisePropertyChangedAuto(); }
+ }
+
+
+ public ColorLibrary()
+ {
+ _colorList = new ObservableCollection<FavoriteColor>();
+ EditColorsGroupMode = false;
+ }
+
+ public void Loading()
+ {
+ //loading form database
+ }
+
+ public void AddToLibrary(FavoriteColor color)
+ {
+ ColorList.Add(color);
+ RaisePropertyChanged(nameof(ColorList));
+
+ Task.Factory.StartNew(() =>
+ {
+ MyColorsEngine.Default.UpdateLibrary(this);
+ });
+ }
+
+ public void RemoveFromLibrary(FavoriteColor color)
+ {
+ ColorList.Remove(color);
+ RaisePropertyChanged(nameof(ColorList));
+
+ Task.Factory.StartNew(() =>
+ {
+ MyColorsEngine.Default.UpdateLibrary(this);
+ });
+ }
+
+ public void Delete()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ MyColorsEngine.Default.Delete(this);
+ });
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs
new file mode 100644
index 000000000..43d41539e
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using Tango.BL.Enumerations;
+using Tango.SharedUI;
+using System.Windows;
+using ColorMine.ColorSpaces;
+using Tango.Core;
+using LiteDB;
+
+namespace Tango.PPC.Jobs.Models
+{
+ public class FavoriteColor : ExtendedObject
+ {
+
+ #region Properties
+
+ [BsonId]
+ public Int32 ID { get; set; }
+
+ private string _name;
+
+ public string Name
+ {
+ get { return _name; }
+ set
+ {
+ _name = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+
+ public String RmlGuid { get; set; }
+
+ public ColorSpaces ColorSpace { get; set; }
+
+ public Double Cyan { get; set; }
+
+ public Double Magenta { get; set; }
+
+ public Double Yellow { get; set; }
+
+ public Double Black { get; set; }
+
+ public Int32 Red { get; set; }
+
+ public Int32 Green { get; set; }
+
+ public Int32 Blue { get; set; }
+
+ public Double L { get; set; }
+
+ public Double A { get; set; }
+
+ public Double B { get; set; }
+
+ public double Hue { get; set; }
+
+ public double Saturation { get; set; }
+
+ public double Brightness { get; set; }
+
+ public int BestMatchR { get; set; }
+
+ public int BestMatchG { get; set; }
+
+ public int BestMatchB { get; set; }
+
+ [BsonIgnore]
+ public Color Color
+ {
+ get
+ {
+ return Color.FromRgb((byte)BestMatchR, (byte)BestMatchG, (byte)BestMatchB);
+ }
+ set
+ {
+ BestMatchR = value.R;
+ BestMatchG = value.G;
+ BestMatchB = value.B;
+ RaisePropertyChangedAuto();
+ }
+ }
+
+ [BsonIgnore]
+ public SolidColorBrush Brush
+ {
+ get { return new SolidColorBrush(Color); }
+ }
+
+ #endregion
+
+ public FavoriteColor()
+ {
+ Hue = Saturation = 0;
+ Brightness = 100;
+ L = 100;
+ A = B = 0;
+
+ Red = Green = Blue = 255;
+ Cyan = Magenta = Yellow = Black = 0;
+ Color = Colors.White;
+ ColorSpace = ColorSpaces.Volume;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs
index 0106d82c4..bc6997120 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs
@@ -11,7 +11,7 @@ using Tango.SharedUI;
namespace Tango.PPC.Jobs.Models
{
- public class JobModel : ViewModel
+ public class JobModel : ExtendedObject
{
private bool _preventChange;
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs
index 3b4644a8d..b65d7e156 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs
@@ -18,7 +18,7 @@ using Tango.PPC.Jobs.UndoRedoCommands;
namespace Tango.PPC.Jobs.Models
{
- public class SegmentModel : ViewModel
+ public class SegmentModel : ExtendedObject
{
private double _lastLength;
private LinearGradientBrush _brush;