aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/CalibrationMeasurementModel.cs90
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs43
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataViewVM.cs10
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs551
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs9
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/LiquidVolumeVM.cs13
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs155
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RmlDeleteDialogViewVM.cs95
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml213
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml.cs42
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlDeleteDialogView.xaml82
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlDeleteDialogView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml9
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml8
15 files changed, 1341 insertions, 35 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/CalibrationMeasurementModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/CalibrationMeasurementModel.cs
new file mode 100644
index 000000000..6345d5f59
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/CalibrationMeasurementModel.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+using Tango.BL.Enumerations;
+using Tango.PMR.Printing;
+
+namespace Tango.MachineStudio.RML.Models
+{
+ public static class ColorCalibrationExt
+ {
+ public static Dictionary<LiquidTypes, LAB> TargetLiquidTypeToLAB = new Dictionary<LiquidTypes, LAB>
+ {
+ {LiquidTypes.Cyan, new LAB(51.94591,-18.3438,-39.0577)},
+ {LiquidTypes.Magenta, new LAB(47.46248, 65.84478, 3.922838)},
+ {LiquidTypes.Yellow, new LAB(84.41956,-0.27005, 94.05445)},
+ {LiquidTypes.Black, new LAB(26.57986, -0.13567, 0.948574)},
+ };
+ public static Dictionary<LiquidTypes, string> DisplayLiquidTypeToLABType = new Dictionary<LiquidTypes, string>
+ {
+ {LiquidTypes.Cyan, "L"},
+ {LiquidTypes.Magenta, "L"},
+ {LiquidTypes.Yellow, "B"},
+ {LiquidTypes.Black, "L"},
+ };
+ };
+
+ public class LAB
+ {
+ public double L { get; set; }
+ public double A { get; set; }
+ public double B { get; set; }
+
+ public LAB( double l, double a, double b)
+ {
+ L = l; B = b; A = a;
+ }
+ };
+
+ public class CalibrationMeasurementModel : ExtendedObject
+ {
+ #region properties
+ private double _l;
+
+ public double L
+ {
+ get { return _l; }
+ set { _l = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _a;
+
+ public double A
+ {
+ get { return _a; }
+ set { _a = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _b;
+
+ public double B
+ {
+ get { return _b; }
+ set { _b = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _ink;
+
+ public double Ink
+ {
+ get { return _ink; }
+ set { _ink = value; RaisePropertyChangedAuto(); }
+ }
+ #endregion
+
+ public CalibrationMeasurementModel()
+ {
+
+ }
+ public CalibrationMeasurementModel(Tango.MachineStudio.RML.Models.ColorLinearizationModel.LinearizationDataItem model)
+ {
+ L = model.L;
+ A = model.A;
+ B = model.B;
+ Ink = model.InkPercentage;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs
new file mode 100644
index 000000000..23179b3f2
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Models/ColorLinearizationModel.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Documents;
+
+namespace Tango.MachineStudio.RML.Models
+{
+ public class ColorLinearizationModel
+ {
+ public class LinearizationDataItem
+ {
+ public double InkPercentage { get; set; }
+ public double L { get; set; }
+ public double A { get; set; }
+ public double B { get; set; }
+ }
+
+ public ColorLinearizationModel()
+ {
+
+ }
+
+ public void GetDataFromFile(string fileName, out List<LinearizationDataItem> items, ref string errors)
+ {
+ items = null;
+ try
+ {
+ using (ExcelReader reader = new ExcelReader(fileName))
+ {
+ items = reader.GetDataByIndex<LinearizationDataItem>("Sheet1", 2);
+ }
+ }
+ catch (Exception ex)
+ {
+ errors = ex.Message;
+ }
+
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj
index a413223c3..38d289c58 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj
@@ -49,6 +49,12 @@
<Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
</Reference>
+ <Reference Include="OxyPlot">
+ <HintPath>..\..\..\packages\OxyPlot.Core.2.0.0\lib\net45\OxyPlot.dll</HintPath>
+ </Reference>
+ <Reference Include="OxyPlot.Wpf">
+ <HintPath>..\..\..\packages\OxyPlot.Wpf.2.0.0\lib\net45\OxyPlot.Wpf.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
@@ -73,7 +79,9 @@
<Link>GlobalVersionInfo.cs</Link>
</Compile>
<Compile Include="Contracts\IMainView.cs" />
+ <Compile Include="Models\CalibrationMeasurementModel.cs" />
<Compile Include="Models\CctModel.cs" />
+ <Compile Include="Models\ColorLinearizationModel.cs" />
<Compile Include="RMLModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
@@ -93,16 +101,21 @@
<Compile Include="ViewModels\CalibrationDataPointVM.cs" />
<Compile Include="ViewModels\CalibrationDataViewVM.cs" />
<Compile Include="ViewModels\CalibrationDataVM.cs" />
+ <Compile Include="ViewModels\ColorCalibrationViewVM.cs" />
<Compile Include="ViewModels\ColorConversionViewVM.cs" />
<Compile Include="ViewModels\LiquidVolumeVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
<Compile Include="ViewModels\RgbVM.cs" />
+ <Compile Include="ViewModels\RmlDeleteDialogViewVM.cs" />
<Compile Include="Views\AddLiquidFactorView.xaml.cs">
<DependentUpon>AddLiquidFactorView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\CalibrationDataView.xaml.cs">
<DependentUpon>CalibrationDataView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\ColorCalibrationView.xaml.cs">
+ <DependentUpon>ColorCalibrationView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\ColorConversionView.xaml.cs">
<DependentUpon>ColorConversionView.xaml</DependentUpon>
</Compile>
@@ -112,6 +125,9 @@
<Compile Include="Views\ProcessParametersView.xaml.cs">
<DependentUpon>ProcessParametersView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\RmlDeleteDialogView.xaml.cs">
+ <DependentUpon>RmlDeleteDialogView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\RmlsView.xaml.cs">
<DependentUpon>RmlsView.xaml</DependentUpon>
</Compile>
@@ -151,6 +167,10 @@
<Project>{40085232-aced-4cbe-945b-90ba8153c151}</Project>
<Name>Tango.BrushPicker</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.ColorCalibration\Tango.ColorCalibration.csproj">
+ <Project>{b60c695c-61e8-4091-b506-4c45349c04aa}</Project>
+ <Name>Tango.ColorCalibration</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\Tango.ColorConversion\Tango.ColorConversion.csproj">
<Project>{b4fe6485-4161-4b36-bc08-67e0b53d01b7}</Project>
<Name>Tango.ColorConversion</Name>
@@ -212,6 +232,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Views\ColorCalibrationView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\ColorConversionView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -224,6 +248,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\RmlDeleteDialogView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\RmlsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataViewVM.cs
index b34ef83bc..fd69fef35 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataViewVM.cs
@@ -6,6 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Calibration;
+using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Notifications;
@@ -106,5 +107,14 @@ namespace Tango.MachineStudio.RML.ViewModels
_notification.ShowError("An error occurred while trying to export the calibration data.");
}
}
+
+ public void ApplyCalibrationData(LiquidType liquidType, List<CalibrationDataPointVM> newpoints)
+ {
+ CalibrationDataVM vm = LiquidsCalibrationData.FirstOrDefault(x => x.LiquidType == liquidType);
+ if(vm != null)
+ {
+ newpoints.ForEach(x => vm.CalibrationPoints.Add(x));
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs
new file mode 100644
index 000000000..f04eccd90
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorCalibrationViewVM.cs
@@ -0,0 +1,551 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Entities;
+using Tango.Core;
+using Tango.Core.Commands;
+using Tango.MachineStudio.RML.Models;
+using Tango.SharedUI;
+using OxyPlot;
+using OxyPlot.Wpf;
+using OxyPlot.Annotations;
+using Tango.ColorCalibration;
+using Tango.PMR.ColorLab;
+using Tango.Logging;
+using Tango.MachineStudio.Common.Notifications;
+using System.Text.RegularExpressions;
+using Microsoft.Win32;
+
+namespace Tango.MachineStudio.RML.ViewModels
+{
+ public class ColorCalibrationViewVM : ExtendedObject
+ {
+ private IColorCalibrator _calibrator;
+ private ILinearizationMeasurements _linearizationMeasurementscalibrator;
+ private INotificationProvider _notification;
+
+ #region Properties
+
+ private Rml _rml;
+ public Rml RML
+ {
+ get { return _rml; }
+ set { _rml = value; RaisePropertyChangedAuto(); }
+ }
+
+ private BL.Entities.LiquidType _liquidType;
+
+ public BL.Entities.LiquidType LiquidType
+ {
+ get { return _liquidType; }
+ set { _liquidType = value; RaisePropertyChangedAuto(); RaisePropertyChanged("LiquidTypeName"); }
+ }
+
+ private List<BL.Entities.LiquidType> _liquidTypes;
+
+ public List<BL.Entities.LiquidType> LiquidTypes
+ {
+ get { return _liquidTypes; }
+ set { _liquidTypes = value; }
+ }
+
+
+ private ObservableCollection<CalibrationMeasurementModel> _measurements;
+ public ObservableCollection<CalibrationMeasurementModel> Measurements
+ {
+ get
+ {
+ return _measurements;
+ }
+ set
+ {
+ _measurements = value; RaisePropertyChangedAuto();
+ }
+ }
+
+
+ private double _factor;
+
+ public double Factor
+ {
+ get { return _factor; }
+ set { _factor = value; RaisePropertyChangedAuto(); }
+ }
+
+ private string _errorMessage;
+
+ public string ErrorMessage
+ {
+ get { return _errorMessage; }
+ set { _errorMessage = value; RaisePropertyChangedAuto(); }
+ }
+ private bool _hasError;
+
+ public bool HasError
+ {
+ get { return _hasError; }
+ set { _hasError = value; RaisePropertyChangedAuto(); }
+ }
+
+ public RelayCommand ImportDataCommand { get; set; }
+ public RelayCommand CreateGraphCommand { get; set; }
+ public RelayCommand CreateLinearizationGraphCommand { get; set; }
+ public RelayCommand ExportGraphCommand { get; set; }
+ public RelayCommand ApplyCalibrationDataCommand { get; set; }
+
+
+ public string LiquidTypeName
+ {
+ get { return LiquidType == null ?"" : LiquidType.Name; }
+ }
+
+ public Plot PlotControl { get; set; }
+ private IList<DataPoint> _points;
+ /// <summary>
+ /// Binding to ItemsSource of line chart.
+ /// </summary>
+ public IList<DataPoint> Points
+ {
+ get { return _points; }
+ set
+ {
+ _points = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+ private IList<DataPoint> _targetPoints;
+ /// <summary>
+ /// Binding to ItemsSource of line chart.
+ /// </summary>
+ public IList<DataPoint> TargetPoints
+ {
+ get { return _targetPoints; }
+ set
+ {
+ _targetPoints = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+ private int _step;
+ public int XStep
+ {
+ get { return _step; }
+ set { _step = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _from;
+ /// <summary>
+ /// From use to binding to bottom axis min value
+ /// </summary>
+ public double From
+ {
+ get { return _from; }
+ set
+ {
+ _from = value; RaisePropertyChangedAuto();
+ }
+ }
+
+ private double _to;
+ /// <summary>
+ /// To use to binding to bottom axis max value
+ /// </summary>
+ public double To
+ {
+ get { return _to; }
+ set
+ {
+ _to = value; RaisePropertyChangedAuto();
+ }
+ }
+
+ private double _LabMinVal;
+
+ public double LabMinVal
+ {
+ get { return _LabMinVal; }
+ set { _LabMinVal = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _LabMaxVal;
+
+ public double LabMaxVal
+ {
+ get { return _LabMaxVal; }
+ set { _LabMaxVal = value; RaisePropertyChangedAuto(); }
+ }
+
+ public Plot LABLinearizationPlotControl { get; set; }
+ public Plot LinearizationPlotControl { get; set; }
+ private IList<DataPoint> _linearizationPoints;
+ /// <summary>
+ /// Binding to ItemsSource of line chart.
+ /// </summary>
+ public IList<DataPoint> LinearizationPoints
+ {
+ get { return _linearizationPoints; }
+ set
+ {
+ _linearizationPoints = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+
+ private IList<DataPoint> _LPoints;
+
+ public IList<DataPoint> LPoints
+ {
+ get { return _LPoints; }
+ set { _LPoints = value; }
+ }
+
+ private IList<DataPoint> _APoints;
+
+ public IList<DataPoint> APoints
+ {
+ get { return _APoints; }
+ set { _APoints = value; }
+ }
+
+ private IList<DataPoint> _BPoints;
+
+ public IList<DataPoint> BPoints
+ {
+ get { return _BPoints; }
+ set { _BPoints = value; }
+ }
+
+
+ #endregion
+
+ public ColorCalibrationViewVM(INotificationProvider notification)
+ {
+ _notification = notification;
+ Measurements = new ObservableCollection<CalibrationMeasurementModel>()
+ {
+ new CalibrationMeasurementModel(),
+ new CalibrationMeasurementModel(),
+ new CalibrationMeasurementModel(),
+ };
+ Factor = 0;
+ HasError = false;
+ ImportDataCommand = new RelayCommand(ImportDataForCalcFactorExcel);
+ CreateGraphCommand = new RelayCommand(CreateGraph);
+ CreateLinearizationGraphCommand = new RelayCommand(CreateLinearizationGraph);
+ ExportGraphCommand = new RelayCommand(ExportGraph);
+ ApplyCalibrationDataCommand = new RelayCommand(ApplyCalibrationData);
+ this.Points = new List<DataPoint>();
+ TargetPoints = new List<DataPoint>();
+ LinearizationPoints = new List<DataPoint>();
+ LPoints = new List<DataPoint>();
+ APoints = new List<DataPoint>();
+ BPoints = new List<DataPoint>();
+ }
+
+ public void Loading()
+ {
+ LiquidType = LiquidTypes.Count > 0 ? LiquidTypes[0] : null;
+ _calibrator = new DefaultColorCalibrator();
+ _linearizationMeasurementscalibrator = new DefaultColorCalibrator();
+
+ }
+
+ public void ClearResults()
+ {
+ Points.Clear();
+ TargetPoints.Clear();
+ ErrorMessage = "";
+ HasError = false;
+ Factor = 0.0;
+ }
+
+ private double GetLiquidFactor()
+ {
+ try
+ {
+ CalibrationInput conversionInput = new CalibrationInput();
+ Measurements.ToList().ForEach(x => conversionInput.Measurements.Add(new CalibrationMeasurement { L = x.L, A = x.A, B = x.B, NanoliterPerCentimeter = x.Ink }));
+ conversionInput.LiquidType = PMR.ColorLab.LiquidType.TryParse(_liquidType.Type.ToString(), out PMR.ColorLab.LiquidType outValue) ? outValue : PMR.ColorLab.LiquidType.Black;
+
+
+ LAB lab;
+ if (ColorCalibrationExt.TargetLiquidTypeToLAB.TryGetValue(_liquidType.Type, out lab))
+ {
+ conversionInput.TargetL = lab.L;
+ conversionInput.TargetA = lab.A;
+ conversionInput.TargetB = lab.B;
+ }
+ CalibrationOutput result = _calibrator.GetLiquidFactor(conversionInput);
+
+ ErrorMessage = result.ErrorMessage;
+ HasError = false == String.IsNullOrEmpty(ErrorMessage);
+
+ return result.LiquidFactor;
+ }
+ catch (Exception ex )
+ {
+ HasError = true;
+ ErrorMessage = "Error occurred while trying to call GetLiquidFactor.";
+ LogManager.Log(ex, "Error occurred while trying to call GetLiquidFactor.");
+ }
+ return 0.0;
+ }
+
+ private void ImportDataForCalcFactorExcel()
+ {
+ OpenFileDialog dlg = new OpenFileDialog();
+
+ try
+ {
+ dlg.Title = $"Import excel file for calculate Factor";
+ dlg.Filter = "Excel Files|*.xlsx";
+ if (dlg.ShowDialog().Value)
+ {
+ ClearResults();
+
+ List<ColorLinearizationModel.LinearizationDataItem> items;//List<LinearizationDataItem> items
+ ColorLinearizationModel model = new ColorLinearizationModel();
+ string error = "";
+ model.GetDataFromFile(dlg.FileName, out items, ref error);
+ if (false == String.IsNullOrEmpty(error) || items == null || items.Count == 0)
+ {
+ _notification.ShowError("An error occurred while trying to import data form the selected excel file. Please check the file format if valid and is available to read.");
+ return;
+ }
+ Measurements.Clear();
+ items.ForEach(x => Measurements.Add(new CalibrationMeasurementModel(x)));
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error importing excel file " + dlg.FileName);
+ _notification.ShowError("An error occurred while trying to import the selected excel file. Please check the file format if valid and is available to read.");
+ }
+ }
+ #region CreateGraph
+
+ private async void CreateGraph(object obj)
+ {
+ if (_liquidType == null)
+ return;
+ ClearResults();
+ PlotControl.InvalidatePlot(true);
+ string labType = ColorCalibrationExt.DisplayLiquidTypeToLABType[_liquidType.Type];
+ await Task.Factory.StartNew(() =>
+ {
+ Factor = GetLiquidFactor( );
+ });
+
+ DataPoint targetPoint = GetTargetPoint();
+
+ To = 0;
+ From = 0;
+
+ Measurements.ToList().ForEach(x =>{ Points.Add(new DataPoint(x.Ink, labType == "L" ? x.L : x.B));
+ TargetPoints.Add(new DataPoint(x.Ink, targetPoint.Y)); });
+
+ _to = labType == "L"? 100 : 128;
+ _from = labType == "L" ? 0 : -127;
+
+ RaisePropertyChanged("To");
+ RaisePropertyChanged("From");
+ XStep = (int)(Points.Count / 6);
+ RaisePropertyChanged("CalibrationType");
+ PlotControl.InvalidatePlot(true);
+
+ }
+
+ private DataPoint GetTargetPoint()
+ {
+ var listValues = Measurements.ToList();
+ if (listValues.Count == 0 || Factor <=0)
+ return new DataPoint(0, 0);
+
+ string labType = ColorCalibrationExt.DisplayLiquidTypeToLABType[_liquidType.Type];
+
+ var left = listValues.Where(y => y.Ink == listValues.Min(x => x.Ink)).ToList().First();
+ var right = listValues.Where(y => y.Ink == listValues.Max(x => x.Ink)).ToList().First();
+ // Normalize start/end to left right to make the offset calc simpler.
+ DataPoint leftPoint = new DataPoint(left.Ink, labType == "L" ? left.L : left.B);
+ DataPoint rightPoint = new DataPoint(right.Ink, labType == "L" ? right.L : right.B);
+
+ double deltaX = rightPoint.X - leftPoint.X;
+ double deltaY = rightPoint.Y - leftPoint.Y;
+
+ // prevents division by zero exceptions.
+ if (deltaX == 0 )
+ return new DataPoint(0, 0);
+
+ double slope = deltaY / deltaX;
+ double offset = leftPoint.Y - leftPoint.X * slope;
+ double calculatedY = Factor * slope + offset;
+
+ return new DataPoint(Factor, calculatedY); ;
+ }
+
+ #endregion
+ #region CreateLinearizationGraph
+
+ private async void CreateLinearizationGraph(object obj)
+ {
+ if (_liquidType == null )
+ return;
+
+ string labType = ColorCalibrationExt.DisplayLiquidTypeToLABType[_liquidType.Type];
+
+ ColorLinearizationModel model = new ColorLinearizationModel();
+ string fileName = GetInkDataFileOpen();// @"C:\Test\Test Input Lineration.xlsx";//dialog to open file
+ if (fileName == null)
+ return;
+
+ LinearizationPoints.Clear();
+ LinearizationPlotControl.InvalidatePlot(true);
+ LPoints.Clear();
+ APoints.Clear();
+ BPoints.Clear();
+ LabMinVal = LabMaxVal = 0;
+ LABLinearizationPlotControl.InvalidatePlot(true);
+
+ List<ColorLinearizationModel.LinearizationDataItem> items;
+ string errors = "";
+ model.GetDataFromFile(fileName, out items, ref errors);
+ if(false == String.IsNullOrEmpty(errors) || items == null || items.Count == 0)
+ {
+ _notification.ShowError("An error occurred while trying to import data form the selected excel file. Please check the file format if valid and is available to read.");
+ return;
+ }
+
+ List<double> outputPoints = new List<double>();
+
+ await Task.Factory.StartNew(() =>
+ {
+ outputPoints = GetLinearizationMeasurements(items);
+ });
+
+ LabMinVal = items.Min(x => Math.Min(x.L, Math.Min(x.A, x.B)));
+ LabMaxVal = items.Max(x => Math.Max(x.L, Math.Max(x.A, x.B)));
+ foreach (var labItem in items)
+ {
+ LPoints.Add(new DataPoint(labItem.InkPercentage, labItem.L));
+ APoints.Add(new DataPoint(labItem.InkPercentage, labItem.A));
+ BPoints.Add(new DataPoint(labItem.InkPercentage, labItem.B));
+ }
+ LABLinearizationPlotControl.InvalidatePlot(true);
+
+ if (outputPoints == null || outputPoints.Count != items.Count)
+ return;
+
+ foreach (var nw in items.Zip(outputPoints, Tuple.Create))
+ {
+ LinearizationPoints.Add(new DataPoint(nw.Item1.InkPercentage, nw.Item2));
+ }
+
+ LinearizationPlotControl.InvalidatePlot(true);
+ }
+
+ /// <summary>
+ /// Open file dialog and get name of file
+ /// </summary>
+ /// <returns></returns>
+ private String GetInkDataFileOpen()
+ {
+ OpenFileDialog dlg = new OpenFileDialog();
+ dlg.Title = "Select Ink data file";
+ dlg.Filter = "Excel |*.xlsx";
+ if (dlg.ShowDialogCenter())
+ {
+ return dlg.FileName;
+ }
+
+ return null;
+ }
+
+ private List<double> GetLinearizationMeasurements(List<ColorLinearizationModel.LinearizationDataItem> items)
+ {
+ try
+ {
+ LinearizationInput linearizationInput = new LinearizationInput();
+ items.ForEach(x => linearizationInput.Measurements.Add(new LinearizationMeasurement { L = x.L, A = x.A, B = x.B, InkPercentage = x.InkPercentage }));
+ linearizationInput.LiquidType = PMR.ColorLab.LiquidType.TryParse(_liquidType.Type.ToString(), out PMR.ColorLab.LiquidType outValue) ? outValue : PMR.ColorLab.LiquidType.Black;
+
+ LinearizationOutput result = _linearizationMeasurementscalibrator.GetLinearizationMeasurements(linearizationInput);
+
+ if(!String.IsNullOrEmpty(result.ErrorMessage))
+ {
+ LogManager.Log(result.ErrorMessage, "GetLinearizationMeasurements returns error." + result.ErrorMessage);
+ InvokeUI(() =>
+ {
+ _notification.ShowError("Linearization failed. " + result.ErrorMessage);
+ });
+ }
+
+ LAB lab;
+ if (ColorCalibrationExt.TargetLiquidTypeToLAB.TryGetValue(_liquidType.Type, out lab))
+ {
+ linearizationInput.TargetL = lab.L;
+ linearizationInput.TargetA = lab.A;
+ linearizationInput.TargetB = lab.B;
+ }
+ return result.InkPercentage.ToList();
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error occurred while trying to call GetLinearizationMeasurements.");
+ }
+ return null;
+ }
+ #endregion
+
+ #region Export graph
+ /// <summary>
+ /// Exports the graph point to Excel file.
+ /// </summary>
+ protected void ExportGraph()
+ {
+ SaveFileDialog dlg = new SaveFileDialog();
+ try
+ {
+ dlg.Title = $"Export excel calibration file for {LiquidType.Name}";
+ dlg.Filter = "Excel Files|*.xlsx";
+ dlg.DefaultExt = ".xlsx";
+ dlg.FileName = $"CData_{LiquidType.Name}_v{LiquidType.Version}.xlsx";
+ if (dlg.ShowDialog().Value)
+ {
+ List<CalibrationPoint> points = new List<CalibrationPoint>();
+ LinearizationPoints.ToList().ForEach(x=> points.Add(ToCalibrationPoint(x)));
+ BL.Calibration.CalibrationHelper.ExportCalibrationDataToExcel(points, dlg.FileName);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error exporting excel file " + dlg.FileName);
+ _notification.ShowError("An error occurred while trying to export the calibration data.");
+ }
+ }
+ public CalibrationPoint ToCalibrationPoint(DataPoint point)
+ {
+ return new CalibrationPoint()
+ {
+ X = point.X,
+ Y = point.Y,
+ };
+ }
+
+ /// <summary>
+ /// Applies the calibration data.
+ /// </summary>
+ protected void ApplyCalibrationData()
+ {
+ if (LinearizationPoints.Count == 0)
+ return;
+
+ List<CalibrationDataPointVM> points = new List<CalibrationDataPointVM>();
+ LinearizationPoints.ToList().ForEach(x => points.Add(new CalibrationDataPointVM(x.X, x.Y)));
+ ViewModelLocator.MainViewVM.CalibrationDataViewVM.ApplyCalibrationData(LiquidType, points);
+ }
+ #endregion
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs
index f583fa15e..95de19f42 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs
@@ -111,6 +111,7 @@ namespace Tango.MachineStudio.RML.ViewModels
Color = x.LiquidType.Color,
Name = x.LiquidType.Name,
LiquidType = x.LiquidType,
+ MaxNanoliterPerCentimeter = x.MaxNlPerCm,
}).ToObservableCollection();
}
@@ -309,16 +310,16 @@ namespace Tango.MachineStudio.RML.ViewModels
}
}
- private double GetTotalMaximumLiquidVolumeLimit()
+ private double GetTotalMaximumLiquidNlPerCMLimit()
{
try
{
var tables = RML.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList();
- return (tables[1].MaxInkUptake / tables[0].MaxInkUptake) * 100;
+ return tables.Max(x => x.MaxInkUptake);
}
catch
{
- return BrushStop.MAX_TOTAL_LIQUID_VOLUME;
+ return BrushStop.MAX_INK_UPTAKE;
}
}
@@ -329,7 +330,7 @@ namespace Tango.MachineStudio.RML.ViewModels
if (LiquidsCalibrationData == null || _prevent_inverse_conversion) return;
//TODO: This is temporary because of out of range volumes.
- if (LiquidVolumes.Where(x => x.LiquidType.HasPigment).Sum(x => x.Volume) > GetTotalMaximumLiquidVolumeLimit())
+ if (LiquidVolumes.Where(x => x.LiquidType.HasPigment).Sum(x => x.NanoliterPerCentimeter) > GetTotalMaximumLiquidNlPerCMLimit())
{
IsVolumesOutOfRange = true;
return;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/LiquidVolumeVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/LiquidVolumeVM.cs
index 7399d62af..27b811bb6 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/LiquidVolumeVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/LiquidVolumeVM.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.BL.Dispensing;
using Tango.BL.Entities;
using Tango.Core;
using Tango.SharedUI;
@@ -47,5 +48,17 @@ namespace Tango.MachineStudio.RML.ViewModels
get { return _liquidType; }
set { _liquidType = value; RaisePropertyChangedAuto(); }
}
+
+ public double MaxNanoliterPerCentimeter { get; set; }
+
+ public double NanoliterPerCentimeter
+ {
+ get
+ {
+ StandardColorDispensingCalc calc = new StandardColorDispensingCalc();
+ return calc.CalculateNanoliterPerCentimeter(Volume, MaxNanoliterPerCentimeter);
+ }
+ }
+
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
index 1ceaf07df..cadd1fb95 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
@@ -45,6 +45,20 @@ namespace Tango.MachineStudio.RML.ViewModels
set { _rmls = value; RaisePropertyChangedAuto(); }
}
+ private ICollectionView _rmlssCollectionView;
+ /// <summary>
+ /// Gets or sets the RML collection view.
+ /// </summary>
+ public ICollectionView RmlsCollectionView
+ {
+ get { return _rmlssCollectionView; }
+ set
+ {
+ _rmlssCollectionView = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+
private ObservableCollection<MediaMaterial> _materials;
public ObservableCollection<MediaMaterial> Materials
{
@@ -164,6 +178,22 @@ namespace Tango.MachineStudio.RML.ViewModels
set { _selectedSpool = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
}
+ private ColorCalibrationViewVM _colorCalibrationVM;
+ public ColorCalibrationViewVM ColorCalibrationVM
+ {
+ get { return _colorCalibrationVM; }
+ set { _colorCalibrationVM = value; RaisePropertyChangedAuto(); }
+ }
+
+ private String _RMLFilter;
+ /// <summary>
+ /// Gets or sets the job filter.
+ /// </summary>
+ public String RMLFilter
+ {
+ get { return _RMLFilter; }
+ set { _RMLFilter = value; RaisePropertyChangedAuto(); OnRMLFilterChanged(); }
+ }
/// <summary>
/// Gets or sets the manage RML command.
@@ -252,31 +282,57 @@ namespace Tango.MachineStudio.RML.ViewModels
private async void LoadRmls()
{
- if (_rmls_context != null) _rmls_context.Dispose();
+ try
+ {
+ IsFree = false;
- _rmls_context = ObservablesContext.CreateDefault();
- Rmls = await new RmlsCollectionBuilder(_rmls_context).SetAll().WithLiquidFactors().WithMediaProperties().BuildAsync();
+ using (_notification.PushTaskItem("Loading Rmls..."))
+ {
+ if (_rmls_context != null) _rmls_context.Dispose();
- //Load CCT file names...
- var ccts = await _rmls_context.Ccts.Select(x => new
- {
- x.Guid,
- x.FileName
- }).ToListAsync();
+ _rmls_context = ObservablesContext.CreateDefault();
+ Rmls = await new RmlsCollectionBuilder(_rmls_context).SetAll().WithLiquidFactors().WithMediaProperties().BuildAsync();
+ //Load CCT file names...
+ var ccts = await _rmls_context.Ccts.Select(x => new
+ {
+ x.Guid,
+ x.FileName
+ }).ToListAsync();
- foreach (var rml in Rmls)
- {
- var cct = ccts.SingleOrDefault(x => x.Guid == rml.CctGuid);
+ foreach (var rml in Rmls)
+ {
+ var cct = ccts.SingleOrDefault(x => x.Guid == rml.CctGuid);
- if (cct != null)
- {
- rml.Cct = new Cct()
+ if (cct != null)
+ {
+ rml.Cct = new Cct()
+ {
+ Guid = cct.Guid,
+ FileName = cct.FileName,
+ };
+ }
+ }
+ RmlsCollectionView = CollectionViewSource.GetDefaultView(Rmls);
+ RmlsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Rml.LastUpdated), ListSortDirection.Descending));
+ //RmlsCollectionView.Filter = new Predicate<object>(FilterCollection);
+
+ RmlsCollectionView.Filter = (rml) =>
{
- Guid = cct.Guid,
- FileName = cct.FileName,
+ Rml r = rml as Rml;
+ return String.IsNullOrWhiteSpace(RMLFilter)
+ || r.Name.ToLower().Contains(RMLFilter.ToLower());
};
+
}
}
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error loading RMLS.\n{ex.FlattenMessage()}");
+ }
+ finally
+ {
+ IsFree = true;
+ }
}
private async void LoadActiveRML(String guid)
@@ -374,6 +430,12 @@ namespace Tango.MachineStudio.RML.ViewModels
LiquidTypesRmls = LiquidTypesRmls,
};
+ ColorCalibrationVM = new ColorCalibrationViewVM(_notification)
+ {
+ RML = ActiveRML,
+ LiquidTypes = LiquidTypesRmls.Where(x => x.LiquidType.HasPigment).ToList().Select(y => y.LiquidType).ToList(),
+ };
+
_rmlBeforeSave = RmlDTO.FromObservable(ActiveRML);
View.NavigateTo(RmlNavigationView.RmlView);
@@ -456,7 +518,7 @@ namespace Tango.MachineStudio.RML.ViewModels
rml.DisplayName = name;
rml.QualificationDate = DateTime.UtcNow;
rml.Manufacturer = "Twine";
- rml.Code = Rmls.Max(x => x.Code) + 1;
+ rml.Code = Rmls.Count > 0 ? Rmls.Max(x => x.Code) + 1 : 1;
rml.MediaMaterial = Materials.FirstOrDefault();
rml.MediaPurpose = Purposes.FirstOrDefault();
rml.MediaCondition = Conditions.FirstOrDefault();
@@ -492,34 +554,62 @@ namespace Tango.MachineStudio.RML.ViewModels
{
if (_notification.ShowQuestion("Removing the selected thread will result in the loss of all related process parameters and default calibration data. Are you sure you want to delete the selected RML?"))
{
- IsFree = false;
-
using (_notification.PushTaskItem("Removing RML..."))
{
try
{
+ IsFree = false;
+
var rml_jobs = await _rmls_context.Jobs.Where(x => x.RmlGuid == SelectedRML.Guid).Include(x => x.Machine).OrderBy(x => x.Machine.SerialNumber).ToListAsync();
if (rml_jobs.Count > 0)
{
- _notification.ShowError($"The following jobs must be removed or change thread type before the selected thread can be deleted:\n{String.Join("\n", rml_jobs.Select(x => $"{x.Machine.SerialNumber} => {x.Name}"))}");
- return;
+ var vm = new RmlDeleteDialogViewVM(SelectedRML, Rmls.ToList(), rml_jobs.ToList());
+ _notification.ShowModalDialog<RmlDeleteDialogViewVM, RmlDeleteDialogView>(vm, (x) => { }, () => { });
+
+ if (!vm.DialogResult)
+ {
+ return;
+ }
+
+ //Perform actions...
+ using (var db = ObservablesContext.CreateDefault())
+ {
+ foreach (var jobAction in vm.JobsActions)
+ {
+ if (jobAction.Action == RmlDeleteDialogViewVM.RmlDeleteJobAction.Delete)
+ {
+ _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.JobDeleted, _authentication.CurrentUser.Guid, jobAction.Job.Name, jobAction.Job.Guid, $"Job deleted due to RML '{SelectedRML.Name}' being removed.");
+ await jobAction.Job.DeleteCascadeAsync(db);
+ }
+ else if (jobAction.Action == RmlDeleteDialogViewVM.RmlDeleteJobAction.Change)
+ {
+ var job = await db.Jobs.SingleOrDefaultAsync(x => x.Guid == jobAction.Job.Guid);
+ job.RmlGuid = jobAction.TargetRml.Guid;
+ _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.JobSaved, _authentication.CurrentUser.Guid, jobAction.Job.Name, jobAction.Job.Guid, $"Job RML changed to '{jobAction.TargetRml.Name}' due to RML '{SelectedRML.Name}' being removed.");
+ }
+ }
+
+ await db.SaveChangesAsync();
+ }
}
await SelectedRML.DeleteCascadeAsync(_rmls_context);
-
_actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlDeleted, _authentication.CurrentUser, SelectedRML.Name, SelectedRML, "RML deleted from Machine Studio.");
LoadRmls();
}
catch (Exception ex)
{
- LogManager.Log(ex, $"Error removing selected RML {SelectedRML.Name}.");
- _notification.ShowError($"An error occurred while trying to remove the selected RML.\n{ex.Message}");
+ LogManager.Log(ex, $"Error removing selected RML {SelectedRML?.Name}.");
+ _notification.ShowError($"An error occurred while trying to remove the selected RML.\n{ex.FlattenMessage()}");
+ LoadRmls();
+ }
+ finally
+ {
+ IsFree = true;
}
}
-
- IsFree = true;
}
}
@@ -641,6 +731,11 @@ namespace Tango.MachineStudio.RML.ViewModels
ActiveProcessParametersTableView.Refresh();
}
+ private void OnRMLFilterChanged()
+ {
+ RmlsCollectionView.Refresh();
+ }
+
private void RemoveLiquidFactor(LiquidTypesRml liquidFactor)
{
if (_notification.ShowQuestion("Removing this liquid factor will remove the liquid type association with the RML and will drop the calibration data. Are you sure?"))
@@ -788,6 +883,12 @@ namespace Tango.MachineStudio.RML.ViewModels
String file = GetCCTFileOpen();
if (file != null)
{
+ if (CCTS.ToList().Exists(x => x.FileName == Path.GetFileName(file)))
+ {
+ _notification.ShowError("The selected CCT file already exists on the database. Please select the CCT file from the dropdown box.");
+ return;
+ }
+
CctModel cctModel = new CctModel();
cctModel.Guid = Guid.NewGuid().ToString();
cctModel.IsNew = true;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RmlDeleteDialogViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RmlDeleteDialogViewVM.cs
new file mode 100644
index 000000000..b4c6c6274
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RmlDeleteDialogViewVM.cs
@@ -0,0 +1,95 @@
+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.SharedUI;
+
+namespace Tango.MachineStudio.RML.ViewModels
+{
+ public class RmlDeleteDialogViewVM : DialogViewVM
+ {
+ public enum RmlDeleteJobAction
+ {
+ Delete,
+ Change
+ }
+
+ public class RmlDeleteJob : ExtendedObject
+ {
+ public Job Job { get; set; }
+ public Machine Machine { get; set; }
+ private RmlDeleteJobAction _action;
+
+ public RmlDeleteJobAction Action
+ {
+ get { return _action; }
+ set { _action = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsDelete)); }
+ }
+
+ public bool IsDelete
+ {
+ get { return Action == RmlDeleteJobAction.Delete; }
+ }
+
+
+ public Rml TargetRml { get; set; }
+
+ public override string ToString()
+ {
+ return $"{Machine.SerialNumber} => {Job.Name} => {Action} {(Action == RmlDeleteJobAction.Change ? $" => {TargetRml.Name}" : String.Empty)}";
+ }
+ }
+
+ private List<Job> _jobsToDelete;
+
+ private List<RmlDeleteJob> _jobsActions;
+ public List<RmlDeleteJob> JobsActions
+ {
+ get { return _jobsActions; }
+ set { _jobsActions = value; RaisePropertyChangedAuto(); }
+ }
+
+ public Rml Rml { get; set; }
+
+ public List<Rml> Rmls { get; set; }
+
+ public List<RmlDeleteJobAction> Actions { get; set; }
+
+ public RmlDeleteDialogViewVM(Rml rml, List<Rml> rmls, List<Job> jobsToDelete)
+ {
+ Rml = rml;
+ Rmls = rmls.Where(x => x.Guid != rml.Guid).ToList();
+ _jobsToDelete = jobsToDelete;
+ JobsActions = new List<RmlDeleteJob>();
+
+ Actions = new List<RmlDeleteJobAction>()
+ {
+ RmlDeleteJobAction.Delete,
+ RmlDeleteJobAction.Change
+ };
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ List<RmlDeleteJob> list = new List<RmlDeleteJob>();
+
+ foreach (var job in _jobsToDelete)
+ {
+ RmlDeleteJob deleteJob = new RmlDeleteJob();
+ deleteJob.Job = job;
+ deleteJob.Action = RmlDeleteJobAction.Delete;
+ deleteJob.Machine = job.Machine;
+ deleteJob.TargetRml = Rmls.FirstOrDefault(x => x.Guid != Rml.Guid);
+
+ list.Add(deleteJob);
+ }
+
+ JobsActions = list;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml
new file mode 100644
index 000000000..116500f80
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml
@@ -0,0 +1,213 @@
+<UserControl x:Class="Tango.MachineStudio.RML.Views.ColorCalibrationView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels"
+ xmlns:global="clr-namespace:Tango.MachineStudio.RML"
+ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:oxy="http://oxyplot.org/wpf"
+ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ mc:Ignorable="d"
+ d:DesignHeight="450" d:DesignWidth="1200" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+
+ <UserControl.Resources>
+ <converters:EmptyStringToNullConverter x:Key="EmptyStringToNullConverter" />
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
+ <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"/>
+ </UserControl.Resources>
+
+ <Grid>
+ <DockPanel>
+ <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Margin="20 10">
+ <TextBlock FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center">Liquid Type:</TextBlock>
+ <ComboBox Margin="40 0 0 0" MinWidth="180" HorizontalAlignment="Left" ItemsSource="{Binding LiquidTypes}"
+ SelectedItem="{Binding LiquidType}" DisplayMemberPath="Name"
+ Style="{StaticResource TransparentComboBoxStyle}" FontSize="16"></ComboBox>
+ </StackPanel>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1.1*"/>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+ <DockPanel Grid.Column="0">
+ <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="20 0 0 0 " Padding="5" CornerRadius="5" Height="40" VerticalAlignment="Top">
+ <Border.Effect>
+ <DropShadowEffect Opacity="0.4" />
+ </Border.Effect>
+ <Grid>
+ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 4 0 0" FontSize="16" Padding="0">LIQUID FACTOR</TextBlock>
+ </Grid>
+ </Border>
+ <Grid Margin="10 20 0 10">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*"/>
+ <ColumnDefinition Width="1*"/>
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="1*"/>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+
+
+ <Grid HorizontalAlignment="Left" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="0" Margin="20 0 10 0">
+ <StackPanel Orientation="Vertical">
+ <Button HorizontalAlignment="Left" Padding="6" Width="120" Background="{StaticResource TransparentBackgroundBrush200}" Command="{Binding ImportDataCommand}" ToolTip="Import data to calculate Liquid factor." Margin="0 0 10 4" BorderBrush="{StaticResource TransparentBackgroundBrush200}">
+ <TextBlock FontSize="14" Foreground="{StaticResource MainWindow.Foreground}">IMPORT DATA</TextBlock>
+ </Button>
+ <DataGrid HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" MaxHeight="280" SelectionUnit="FullRow" BorderBrush="{StaticResource DarkGrayBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="False" ItemsSource="{Binding Measurements}" Margin="0 0 0 50">
+ <DataGrid.CellStyle>
+ <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
+ <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+ </Style>
+ </DataGrid.CellStyle>
+ <DataGrid.Resources>
+ <Style x:Key="CellNumericUpDown" TargetType="{x:Type mahapps:NumericUpDown}" BasedOn="{StaticResource {x:Type mahapps:NumericUpDown}}">
+ <Setter Property="FrameworkElement.HorizontalAlignment" Value="Stretch"/>
+ <Setter Property="HorizontalContentAlignment" Value="Left"/>
+ <Setter Property="Background" Value="Transparent"/>
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
+ <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/>
+ <Setter Property="Focusable" Value="false"/>
+ <Setter Property="IsHitTestVisible" Value="false"/>
+ <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/>
+ <Setter Property="FrameworkElement.VerticalAlignment" Value="Top"/>
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
+ <Setter Property="FrameworkElement.MinHeight" Value="0"/>
+ <Setter Property="HideUpDownButtons" Value="true"/>
+ </Style>
+ <Style x:Key="EditableCellNumericUpDown" TargetType="{x:Type mahapps:NumericUpDown}" BasedOn="{StaticResource {x:Type mahapps:NumericUpDown}}">
+ <Setter Property="FrameworkElement.HorizontalAlignment" Value="Stretch"/>
+ <Setter Property="HorizontalContentAlignment" Value="Left"/>
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
+ <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/>
+ <Setter Property="FrameworkElement.VerticalAlignment" Value="Top"/>
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
+ <Setter Property="FrameworkElement.MinHeight" Value="0"/>
+ </Style>
+ </DataGrid.Resources>
+ <DataGrid.Columns>
+ <mahapps:DataGridNumericUpDownColumn Header="Ink nl/cm" Minimum="0" Maximum="100000" Binding="{Binding Ink}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" />
+ <mahapps:DataGridNumericUpDownColumn Header="L" Minimum="0" Maximum="100" Binding="{Binding L}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}"/>
+ <mahapps:DataGridNumericUpDownColumn Header="A" Minimum="-128" Maximum="127" Binding="{Binding A}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" />
+ <mahapps:DataGridNumericUpDownColumn Header="B" Minimum="-128" Maximum="127" Binding="{Binding B}" HideUpDownButtons="True" Width="1*" ElementStyle="{StaticResource CellNumericUpDown}" EditingElementStyle="{StaticResource EditableCellNumericUpDown}" />
+ </DataGrid.Columns>
+ </DataGrid>
+
+ </StackPanel>
+ </Grid>
+
+ <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="0" Margin="10 0 0 0">
+ <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" BorderBrush="{StaticResource DarkGrayBrush}" CornerRadius="5">
+ <oxy:Plot Title="{Binding LiquidTypeName}" TitleFontSize="14" x:Name="CalibrationPlot" Margin="0 0 10 0" Background="Transparent" >
+ <oxy:Plot.Series >
+ <oxy:LineSeries ItemsSource="{Binding Points}" Color="#73B6EC" MarkerFill="SteelBlue" MarkerType="Circle" />
+ <oxy:LineSeries ItemsSource="{Binding TargetPoints}" Color="#E14141" />
+ </oxy:Plot.Series>
+ <oxy:Plot.Axes>
+ <oxy:LinearAxis Position="Bottom" Title = "nl/cm" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" />
+ <oxy:LinearAxis Position="Left" Title = "Lab" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding From}" Maximum="{Binding To}" />
+ </oxy:Plot.Axes>
+ </oxy:Plot>
+ </Border>
+ </Grid>
+
+ <Border Grid.Row="1" Grid.ColumnSpan="2" BorderBrush="{StaticResource BlueBrush100}" BorderThickness="0" CornerRadius="5" Margin="20 0 20 0">
+ <StackPanel Orientation="Vertical" Grid.Row="0" Margin="2 5 0 0">
+ <Border BorderThickness="0.5" CornerRadius="4" BorderBrush="{StaticResource DarkGrayBrush}" Visibility="{Binding HasError, Converter={StaticResource BooleanToVisibilityInverseConverter}}" Height="Auto" Margin="0 6 0 0">
+ <TextBlock FontSize="16" Foreground="{StaticResource MainWindow.Foreground}" FontWeight="SemiBold" Visibility="{Binding HasError, Converter={StaticResource BooleanToVisibilityInverseConverter}}" Margin="10" >
+ <Run FontSize="16"> Factor: </Run>
+ <Run Text="{Binding Factor,StringFormat='#.0000'}" Foreground="{StaticResource BlueBrush100}"></Run>
+ </TextBlock>
+ </Border>
+
+ <Border BorderThickness="0.5" CornerRadius="4" BorderBrush="{StaticResource DarkGrayBrush}" Visibility="{Binding HasError, Converter={StaticResource BooleanToVisibilityConverter}}" Height="Auto" Margin="0 6 0 0">
+ <TextBlock FontSize="16" Foreground="{StaticResource MainWindow.Foreground}" FontWeight="SemiBold" Visibility="{Binding HasError, Converter={StaticResource BooleanToVisibilityConverter}}" Margin="10" >
+ <Run FontSize="14"> Warning: </Run>
+ <Run Foreground="{StaticResource RedBrush300}" Text="{Binding ErrorMessage}" ></Run>
+ </TextBlock>
+ </Border>
+ </StackPanel>
+ </Border>
+ <Button Grid.Row="2" Grid.Column="1" Margin="0 20 20 0" VerticalAlignment="Bottom" HorizontalAlignment="Right" Background="{StaticResource TransparentBackgroundBrush200}" MinWidth="160" BorderBrush="{StaticResource TransparentBackgroundBrush200}" Command="{Binding CreateGraphCommand}" >
+ <TextBlock FontSize="14" Foreground="{StaticResource MainWindow.Foreground}">GET LIQUID FACTOR</TextBlock>
+ </Button>
+ </Grid>
+ </DockPanel>
+ <DockPanel Grid.Column="1">
+ <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="20 0 0 0 " Padding="5" CornerRadius="5" Height="40" VerticalAlignment="Top">
+ <Border.Effect>
+ <DropShadowEffect Opacity="0.4" />
+ </Border.Effect>
+ <Grid>
+ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 4 0 0" FontSize="16" Padding="0">LINEARIZATION</TextBlock>
+ </Grid>
+ </Border>
+ <Grid Margin="10 20 20 10">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="1*"/>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+ <Grid Grid.Column="0" Margin="10 0 0 0">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="1*"/>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+ <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="0" Margin="0 0 0 0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*"></ColumnDefinition>
+ <ColumnDefinition Width="1*"></ColumnDefinition>
+ </Grid.ColumnDefinitions>
+
+ <Border Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0" BorderBrush="{StaticResource DarkGrayBrush}" CornerRadius="5">
+ <oxy:Plot Title="{Binding LiquidTypeName}" TitleFontSize="14" x:Name="LABLinearizationPlot" Margin="0 0 10 0" Background="Transparent" LegendPlacement="Inside" LegendPosition="TopRight" LegendOrientation="Vertical" LegendFontSize="9" LegendItemAlignment="Left" LegendLineSpacing="3" Foreground="{StaticResource Dialog.Foreground}">
+ <oxy:Plot.Series >
+ <oxy:LineSeries ItemsSource="{Binding LPoints}" Color="LawnGreen" Title="L" StrokeThickness="1.5"/>
+ <oxy:LineSeries ItemsSource="{Binding APoints}" Color="#E14141" Title="A" StrokeThickness="1.5"/>
+ <oxy:LineSeries ItemsSource="{Binding BPoints}" Color="#73B6EC" Title="B" StrokeThickness="1.5"/>
+ </oxy:Plot.Series>
+ <oxy:Plot.Axes>
+ <oxy:LinearAxis Position="Bottom" Title = "Ink%" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" AxisTitleDistance ="12" Minimum="0" Maximum="100" />
+ <oxy:LinearAxis Position="Left" Title = "LAB" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding LabMinVal}" Maximum="{Binding LabMaxVal}" MinorStep="10" />
+ </oxy:Plot.Axes>
+ </oxy:Plot>
+ </Border>
+
+ <Border Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0" BorderThickness="0" BorderBrush="{StaticResource DarkGrayBrush}" CornerRadius="5" >
+ <oxy:Plot Title="{Binding LiquidTypeName}" TitleFontSize="14" x:Name="LinearizationPlot" Margin="0 0 0 0" Background="Transparent" LegendPlacement="Inside" LegendPosition="RightTop" LegendOrientation="Vertical" >
+ <oxy:Plot.Series >
+ <oxy:LineSeries ItemsSource="{Binding LinearizationPoints}" Color="#73B6EC" MarkerFill="SteelBlue" MarkerType="Circle"/>
+ </oxy:Plot.Series>
+ <oxy:Plot.Axes>
+ <oxy:LinearAxis Position="Bottom" Title = "In Ink" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="0" Maximum="100"/>
+ <oxy:LinearAxis Position="Left" Title = "Out Ink" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="0" Maximum="100"/>
+ </oxy:Plot.Axes>
+ </oxy:Plot>
+ </Border>
+ </Grid>
+ <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0 20 10 0" HorizontalAlignment="Right">
+ <Button Background="{StaticResource TransparentBackgroundBrush200}" BorderBrush="{StaticResource TransparentBackgroundBrush200}" Padding="6" MinWidth="130" Command="{Binding ApplyCalibrationDataCommand}" ToolTip="Apply the calibration data to the current RML calibration tables.">
+ <TextBlock FontSize="14" Foreground="{StaticResource MainWindow.Foreground}">APPLY TO RML</TextBlock>
+ </Button>
+ <Button Margin="20 0 0 0" Background="{StaticResource TransparentBackgroundBrush200}" BorderBrush="{StaticResource TransparentBackgroundBrush200}" Padding="6" ToolTip="Export to excel" MinWidth="130" Command="{Binding ExportGraphCommand}">
+ <TextBlock FontSize="14" Foreground="{StaticResource MainWindow.Foreground}">EXPORT TO FILE</TextBlock>
+ </Button>
+ <Button Margin="20 0 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Right" Background="{StaticResource TransparentBackgroundBrush200}" MinWidth="180" BorderBrush="{StaticResource TransparentBackgroundBrush200}" Command="{Binding CreateLinearizationGraphCommand}" >
+ <TextBlock FontSize="14" Foreground="{StaticResource MainWindow.Foreground}">CREATE LINEARIZATION GRAPH</TextBlock>
+ </Button>
+ </StackPanel>
+ </Grid>
+
+ </Grid>
+ </DockPanel>
+ </Grid>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml.cs
new file mode 100644
index 000000000..c29bb68fb
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorCalibrationView.xaml.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Tango.MachineStudio.RML.ViewModels;
+
+namespace Tango.MachineStudio.RML.Views
+{
+ /// <summary>
+ /// Interaction logic for ColorCalibrationView.xaml
+ /// </summary>
+ public partial class ColorCalibrationView : UserControl
+ {
+ public ColorCalibrationView()
+ {
+ InitializeComponent();
+ this.Loaded += ColorCalibrationView_Loaded;
+ }
+
+ private void ColorCalibrationView_Loaded(object sender, RoutedEventArgs e)
+ {
+ if(DataContext is ColorCalibrationViewVM)
+ {
+ ColorCalibrationViewVM vm = (ColorCalibrationViewVM)DataContext;
+ vm.PlotControl = CalibrationPlot;
+ vm.LinearizationPlotControl = LinearizationPlot;
+ vm.LABLinearizationPlotControl = LABLinearizationPlot;
+ vm.Loading();
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlDeleteDialogView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlDeleteDialogView.xaml
new file mode 100644
index 000000000..7745848c1
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlDeleteDialogView.xaml
@@ -0,0 +1,82 @@
+<UserControl x:Class="Tango.MachineStudio.RML.Views.RmlDeleteDialogView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views"
+ mc:Ignorable="d"
+ d:DesignHeight="400" d:DesignWidth="700" Height="600" Width="900" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:RmlDeleteDialogViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource Dialog.Foreground}">
+
+ <UserControl.Resources>
+ <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" />
+ </UserControl.Resources>
+
+ <Grid Margin="10">
+ <DockPanel>
+ <Grid DockPanel.Dock="Top">
+ <StackPanel Orientation="Horizontal">
+ <Grid>
+ <materialDesign:PackIcon Kind="Alert" Foreground="{StaticResource OrangeBrush}" Width="42" Height="42" />
+ </Grid>
+ <TextBlock Margin="20 0 0 0" VerticalAlignment="Center" FontSize="22">
+ <Run>DELETE</Run>
+ <Run></Run>
+ <Run Text="{Binding Rml.Name}"></Run>
+ </TextBlock>
+ </StackPanel>
+ </Grid>
+
+ <Grid DockPanel.Dock="Bottom">
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom">
+ <Button Command="{Binding CloseCommand}" Width="140" Height="40" Margin="0 0 10 0">
+ CANCEL
+ </Button>
+ <Button Command="{Binding OKCommand}" IsDefault="True" Width="140" Height="40">
+ DELETE
+ </Button>
+ </StackPanel>
+ </Grid>
+
+ <Grid>
+ <DockPanel Margin="0 10 0 0">
+ <TextBlock DockPanel.Dock="Top" Margin="5">
+ <Run>The following jobs must be removed or change thread type before the selected thread can be deleted.</Run>
+ </TextBlock>
+ <DataGrid Margin="0 10 0 10" SelectionUnit="FullRow" SelectionMode="Single" ItemsSource="{Binding JobsActions}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="False">
+ <DataGrid.Columns>
+ <DataGridTextColumn Header="MACHINE" Width="Auto" Binding="{Binding Machine.SerialNumber}" IsReadOnly="True" />
+ <DataGridTextColumn Header="JOB" Width="200" Binding="{Binding Job.Name}" IsReadOnly="True" />
+ <DataGridComboBoxColumn Header="ACTION" Width="100" SelectedItemBinding="{Binding Action}">
+ <DataGridComboBoxColumn.ElementStyle>
+ <Style TargetType="{x:Type ComboBox}">
+ <Setter Property="ItemsSource" Value="{Binding Path=DataContext.Actions, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
+ </Style>
+ </DataGridComboBoxColumn.ElementStyle>
+ <DataGridComboBoxColumn.EditingElementStyle>
+ <Style TargetType="{x:Type ComboBox}">
+ <Setter Property="ItemsSource" Value="{Binding Path=DataContext.Actions, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
+ </Style>
+ </DataGridComboBoxColumn.EditingElementStyle>
+ </DataGridComboBoxColumn>
+ <DataGridComboBoxColumn Header="TARGET RML" SelectedItemBinding="{Binding TargetRml}" Width="1*" DisplayMemberPath="Name">
+ <DataGridComboBoxColumn.ElementStyle>
+ <Style TargetType="{x:Type ComboBox}">
+ <Setter Property="ItemsSource" Value="{Binding Path=DataContext.Rmls, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
+ </Style>
+ </DataGridComboBoxColumn.ElementStyle>
+ <DataGridComboBoxColumn.EditingElementStyle>
+ <Style TargetType="{x:Type ComboBox}">
+ <Setter Property="ItemsSource" Value="{Binding Path=DataContext.Rmls, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
+ </Style>
+ </DataGridComboBoxColumn.EditingElementStyle>
+ </DataGridComboBoxColumn>
+ </DataGrid.Columns>
+ </DataGrid>
+ </DockPanel>
+ </Grid>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlDeleteDialogView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlDeleteDialogView.xaml.cs
new file mode 100644
index 000000000..96254c03a
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlDeleteDialogView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.MachineStudio.RML.Views
+{
+ /// <summary>
+ /// Interaction logic for RmlDeleteDialogView.xaml
+ /// </summary>
+ public partial class RmlDeleteDialogView : UserControl
+ {
+ public RmlDeleteDialogView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml
index f425f2003..b6c91f066 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml
@@ -30,7 +30,7 @@
<Button Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" Command="{Binding BackToRmlsCommand}">
<materialDesign:PackIcon Kind="ArrowLeft" Width="50" Height="50" Foreground="{StaticResource DarkGrayBrush200}" ToolTip="Back to RML list" />
</Button>
- <TextBlock Text="{Binding ActiveRML.Name}" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="34"></TextBlock>
+ <TextBlock MaxWidth="350" Text="{Binding ActiveRML.Name}" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="30" TextWrapping="Wrap"></TextBlock>
</StackPanel>
<Button HorizontalAlignment="Right" Width="170" Height="45" Margin="0 0 20 0" VerticalAlignment="Center" Command="{Binding SaveCommand}">
@@ -214,7 +214,9 @@
</UniformGrid>
<TextBlock Margin="0 40 0 0" Text="Color Conversion Version:" HorizontalAlignment="Center"></TextBlock>
- <mahapps:NumericUpDown Minimum="1" Maximum="3" Value="{Binding ActiveRML.ColorConversionVersion}" HorizontalContentAlignment="Center" Background="Transparent" BorderBrush="{StaticResource DimGrayBrush}" HasDecimals="False" Margin="0 5 0 0" />
+ <mahapps:NumericUpDown Minimum="1" Maximum="4" Value="{Binding ActiveRML.ColorConversionVersion}" HorizontalContentAlignment="Center" Background="Transparent" BorderBrush="{StaticResource DimGrayBrush}" HasDecimals="False" Margin="0 5 0 0" />
+
+ <CheckBox ToolTip="Use the color conversion engine to generate gradients" IsChecked="{Binding ActiveRML.UseColorLibGradients}" HorizontalAlignment="Center" Margin="0 40 0 0">Enable Gradient Generation</CheckBox>
</StackPanel>
</StackPanel>
</Grid>
@@ -226,6 +228,9 @@
<TabItem Header="SPOOLS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20">
<local:SpoolsView/>
</TabItem>
+ <TabItem Header="COLOR CALIBRATION" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20">
+ <local:ColorCalibrationView DataContext="{Binding ColorCalibrationVM}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
+ </TabItem>
</TabControl>
</Grid>
<Grid Grid.Row="1">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml
index 288f00a3d..b1a1f4aa5 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml
@@ -18,10 +18,14 @@
<converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter>
</UserControl.Resources>
- <Grid>
+ <Grid IsEnabled="{Binding IsFree}">
<DockPanel Margin="100 100 100 50" MaxWidth="1200">
<Grid DockPanel.Dock="Top">
<Image Source="../Images/threads.png" Width="300" Margin="10" />
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 10 30">
+ <materialDesign:PackIcon Kind="Magnify" Width="26" Height="26"/>
+ <TextBox Width="300" materialDesign:HintAssist.Hint="Search by name" Text="{Binding RMLFilter,UpdateSourceTrigger=PropertyChanged,Delay=500}"></TextBox>
+ </StackPanel>
</Grid>
<Grid DockPanel.Dock="Bottom">
<StackPanel>
@@ -74,7 +78,7 @@
</StackPanel>
</Grid>
<Grid>
- <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}">
+ <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>