aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy@twine-s.com>2020-12-30 15:11:34 +0000
committerRoy Ben Shabat <Roy@twine-s.com>2020-12-30 15:11:34 +0000
commitd33c19b3ac6803de4b5c8d475832efef131c1a45 (patch)
treeea725abc39def99a755b041c13cba1fe0d594ddc /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML
parent1bdcaa9f51303bbff682507f31fb3b4414692ca4 (diff)
downloadTango-d33c19b3ac6803de4b5c8d475832efef131c1a45.tar.gz
Tango-d33c19b3ac6803de4b5c8d475832efef131c1a45.zip
Revert "Hope it is fine"
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.csproj49
-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.cs16
-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.cs420
-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/HeadCleaningParametersView.xaml59
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml4
-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.xaml47
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml8
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml85
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml121
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml.cs28
23 files changed, 1948 insertions, 114 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 2ff9ab0a3..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,12 +125,24 @@
<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>
<Compile Include="Views\RmlView.xaml.cs">
<DependentUpon>RmlView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\HeadCleaningParametersView.xaml.cs">
+ <DependentUpon>HeadCleaningParametersView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Views\ThreadParametersView.xaml.cs">
+ <DependentUpon>ThreadParametersView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Views\SpoolsView.xaml.cs">
+ <DependentUpon>SpoolsView.xaml</DependentUpon>
+ </Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -142,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>
@@ -203,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>
@@ -215,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>
@@ -223,6 +260,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\HeadCleaningParametersView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Include="Views\ThreadParametersView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Include="Views\SpoolsView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\threads.png" />
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 b68239b4b..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,6 +310,19 @@ namespace Tango.MachineStudio.RML.ViewModels
}
}
+ private double GetTotalMaximumLiquidNlPerCMLimit()
+ {
+ try
+ {
+ var tables = RML.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList();
+ return tables.Max(x => x.MaxInkUptake);
+ }
+ catch
+ {
+ return BrushStop.MAX_INK_UPTAKE;
+ }
+ }
+
private void OnLiquidVolumeChanged()
{
try
@@ -316,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) > 200)
+ 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 ee21b9ac3..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
@@ -21,12 +21,19 @@ using Tango.MachineStudio.RML.Views;
using Tango.PMR.ColorLab;
using System.Data.Entity;
using Tango.Core.ExtensionMethods;
+using Tango.MachineStudio.Common.Authentication;
+using Tango.BL.ActionLogs;
+using Tango.BL.DTO;
+using Tango.BL.Enumerations;
namespace Tango.MachineStudio.RML.ViewModels
{
public class MainViewVM : StudioViewModel<IMainView>
{
private INotificationProvider _notification;
+ private IAuthenticationProvider _authentication;
+ private IActionLogManager _actionLogManager;
+ private RmlDTO _rmlBeforeSave;
private ObservablesContext _rmls_context;
private ObservablesContext _active_context;
@@ -38,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
{
@@ -80,6 +101,13 @@ namespace Tango.MachineStudio.RML.ViewModels
set { _fiberSynths = value; RaisePropertyChangedAuto(); }
}
+ private ObservableCollection<SpoolType> _spoolTypes;
+ public ObservableCollection<SpoolType> SpoolTypes
+ {
+ get { return _spoolTypes; }
+ set { _spoolTypes = value; RaisePropertyChangedAuto(); }
+ }
+
private Rml _selectedRML;
public Rml SelectedRML
{
@@ -143,6 +171,30 @@ namespace Tango.MachineStudio.RML.ViewModels
set { _colorConversionViewVM = value; RaisePropertyChangedAuto(); }
}
+ private RmlsSpool _selectedSpool;
+ public RmlsSpool SelectedSpool
+ {
+ get { return _selectedSpool; }
+ 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.
/// </summary>
@@ -185,9 +237,21 @@ namespace Tango.MachineStudio.RML.ViewModels
public RelayCommand ImportRMLFileCommand { get; set; }
- public MainViewVM(INotificationProvider notificationProvider)
+ /// <summary>
+ /// Gets or sets the add spool command.
+ /// </summary>
+ public RelayCommand AddSpoolCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the remove spool command.
+ /// </summary>
+ public RelayCommand RemoveSpoolCommand { get; set; }
+
+ public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager)
{
_notification = notificationProvider;
+ _authentication = authentication;
+ _actionLogManager = actionLogManager;
ManageRmlCommand = new RelayCommand(() => LoadActiveRML(SelectedRML.Guid), () => SelectedRML != null);
RemoveRmlCommand = new RelayCommand(RemoveSelectedRml, () => SelectedRML != null);
CloneRmlCommand = new RelayCommand(CloneSelectedRml, () => SelectedRML != null);
@@ -206,6 +270,9 @@ namespace Tango.MachineStudio.RML.ViewModels
ExportRMLFileCommand = new RelayCommand(ExportRmlFile, () => SelectedRML != null && IsFree);
ImportRMLFileCommand = new RelayCommand(ImportRmlFile, () => IsFree);
+
+ AddSpoolCommand = new RelayCommand(AddNewSpool);
+ RemoveSpoolCommand = new RelayCommand(RemoveSpool, () => SelectedSpool != null);
}
public override void OnApplicationReady()
@@ -215,130 +282,177 @@ 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)
{
using (_notification.PushTaskItem("Loading RML..."))
{
- IsFree = false;
-
- if (_active_context != null)
+ try
{
- _active_context.Dispose();
- }
-
- _active_context = ObservablesContext.CreateDefault();
+ IsFree = false;
- CCTS = _active_context.Ccts
- .Select(x => new CctModel()
+ if (_active_context != null)
{
- Guid = x.Guid,
- FileName = x.FileName,
+ _active_context.Dispose();
+ }
- }).ToObservableCollection();
+ _active_context = ObservablesContext.CreateDefault();
- CCTS.Where(x => String.IsNullOrWhiteSpace(x.FileName)).ToList().ForEach(x => x.FileName = x.Guid);
+ CCTS = _active_context.Ccts
+ .Select(x => new CctModel()
+ {
+ Guid = x.Guid,
+ FileName = x.FileName,
- LoadRmlProperties();
+ }).ToObservableCollection();
- ActiveRML = await new RmlBuilder(_active_context)
- .Set(guid)
- .WithActiveParametersGroup()
- .WithLiquidFactors()
- .WithCCT()
- .BuildAsync();
+ CCTS.Where(x => String.IsNullOrWhiteSpace(x.FileName)).ToList().ForEach(x => x.FileName = x.Guid);
- if (ActiveRML.Cct != null)
- {
- SelectedCCT = CCTS.SingleOrDefault(x => x.Guid == ActiveRML.Cct.Guid);
- }
+ LoadRmlProperties();
- if (ActiveRML.ProcessParametersTablesGroups.ToList().Count == 0)
- {
- if (!_notification.ShowQuestion("Could not find any process group for the selected RML. Would you like to create one?"))
+ ActiveRML = await new RmlBuilder(_active_context)
+ .Set(guid)
+ .WithActiveParametersGroup()
+ .WithLiquidFactors()
+ .WithCCT()
+ .WithSpools()
+ .BuildAsync();
+
+ if (ActiveRML.Cct != null)
{
- _notification.ShowError("Cannot load an RML with no process group.");
- IsFree = true;
- return;
+ SelectedCCT = CCTS.SingleOrDefault(x => x.Guid == ActiveRML.Cct.Guid);
}
- else
+
+ if (ActiveRML.ProcessParametersTablesGroups.ToList().Count == 0)
{
- ProcessParametersTablesGroup group = new ProcessParametersTablesGroup();
- group.Name = "Active Group";
- group.Active = true;
- group.ProcessParametersTables.Add(new ProcessParametersTable()
+ if (!_notification.ShowQuestion("Could not find any process group for the selected RML. Would you like to create one?"))
+ {
+ _notification.ShowError("Cannot load an RML with no process group.");
+ IsFree = true;
+ return;
+ }
+ else
{
- Name = "Process Table 1",
- });
+ ProcessParametersTablesGroup group = new ProcessParametersTablesGroup();
+ group.Name = "Active Group";
+ group.Active = true;
+ group.ProcessParametersTables.Add(new ProcessParametersTable()
+ {
+ Name = "Process Table 1",
+ });
- group.Rml = ActiveRML;
+ group.Rml = ActiveRML;
- _active_context.ProcessParametersTablesGroups.Add(group);
- _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[0]);
- await _active_context.SaveChangesAsync();
- LoadActiveRML(ActiveRML.Guid);
- return;
+ _active_context.ProcessParametersTablesGroups.Add(group);
+ _active_context.ProcessParametersTables.Add(group.ProcessParametersTables[0]);
+ await _active_context.SaveChangesAsync();
+ LoadActiveRML(ActiveRML.Guid);
+ return;
+ }
}
- }
- ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault();
- ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables);
- ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending));
+ ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault();
+ ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables);
+ ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending));
- CalibrationDataViewVM = new CalibrationDataViewVM(_notification);
- LiquidTypesRmls = ActiveRML.LiquidTypesRmls;
+ CalibrationDataViewVM = new CalibrationDataViewVM(_notification);
+ LiquidTypesRmls = ActiveRML.LiquidTypesRmls;
- foreach (var liquidTypeRml in LiquidTypesRmls)
- {
- CalibrationDataVM catVM = new CalibrationDataVM(liquidTypeRml.LiquidType);
-
- if (liquidTypeRml.DefaultCatData != null)
+ foreach (var liquidTypeRml in LiquidTypesRmls)
{
- catVM.CalibrationPoints = liquidTypeRml.GetCalibrationData().CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection();
+ CalibrationDataVM catVM = new CalibrationDataVM(liquidTypeRml.LiquidType);
+
+ if (liquidTypeRml.DefaultCatData != null)
+ {
+ catVM.CalibrationPoints = liquidTypeRml.GetCalibrationData().CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection();
+ }
+
+ CalibrationDataViewVM.LiquidsCalibrationData.Add(catVM);
}
- CalibrationDataViewVM.LiquidsCalibrationData.Add(catVM);
- }
+ ColorConversionViewVM = new ColorConversionViewVM(_notification)
+ {
+ RML = ActiveRML,
+ CCT = SelectedCCT,
+ LiquidsCalibrationData = CalibrationDataViewVM.LiquidsCalibrationData,
+ LiquidTypesRmls = LiquidTypesRmls,
+ };
- ColorConversionViewVM = new ColorConversionViewVM(_notification)
- {
- RML = ActiveRML,
- CCT = SelectedCCT,
- LiquidsCalibrationData = CalibrationDataViewVM.LiquidsCalibrationData,
- LiquidTypesRmls = LiquidTypesRmls,
- };
+ ColorCalibrationVM = new ColorCalibrationViewVM(_notification)
+ {
+ RML = ActiveRML,
+ LiquidTypes = LiquidTypesRmls.Where(x => x.LiquidType.HasPigment).ToList().Select(y => y.LiquidType).ToList(),
+ };
- View.NavigateTo(RmlNavigationView.RmlView);
+ _rmlBeforeSave = RmlDTO.FromObservable(ActiveRML);
- InvalidateRelayCommands();
+ View.NavigateTo(RmlNavigationView.RmlView);
- IsFree = true;
+ InvalidateRelayCommands();
+
+ IsFree = true;
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log($"Error loading RML '{ActiveRML.Name}'...");
+ _notification.ShowError($"Error loading the selected thread.\n{ex.FlattenMessage()}");
+ }
+ finally
+ {
+ IsFree = true;
+ }
}
}
@@ -371,6 +485,7 @@ namespace Tango.MachineStudio.RML.ViewModels
LinearMassDensityUnits = _active_context.LinearMassDensityUnits.ToObservableCollection();
FiberShapes = _active_context.FiberShapes.ToObservableCollection();
FiberSynths = _active_context.FiberSynths.ToObservableCollection();
+ SpoolTypes = _active_context.SpoolTypes.ToObservableCollection();
}
private async void AddNewRml()
@@ -400,8 +515,10 @@ namespace Tango.MachineStudio.RML.ViewModels
Rml rml = new Rml();
rml.Name = name;
+ 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();
@@ -423,6 +540,9 @@ namespace Tango.MachineStudio.RML.ViewModels
_active_context.ProcessParametersTables.Add(group.ProcessParametersTables[0]);
_active_context.Rmls.Add(rml);
await _active_context.SaveChangesAsync();
+
+ _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlCreated, _authentication.CurrentUser, rml.Name, rml, "Rml created using Machine Studio.");
+
LoadActiveRML(rml.Guid);
IsFree = true;
@@ -432,25 +552,64 @@ namespace Tango.MachineStudio.RML.ViewModels
private async void RemoveSelectedRml()
{
- if (_notification.ShowQuestion("Removing the selected RML will result in the loss of all related process parameters and default calibration data. Are you sure you want to delete the selected RML?"))
+ 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)
+ {
+ 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;
}
}
@@ -468,15 +627,18 @@ namespace Tango.MachineStudio.RML.ViewModels
using (var context = ObservablesContext.CreateDefault())
{
- var rml = await new RmlBuilder(context).Set(SelectedRML.Guid).WithActiveParametersGroup().WithLiquidFactors().BuildAsync();
+ var rml = await new RmlBuilder(context).Set(SelectedRML.Guid).WithActiveParametersGroup().WithLiquidFactors().WithSpools().BuildAsync();
Rml cloned = new Rml();
- rml.MapPrimitivesWithStrings(cloned);
+ rml.MapPropertiesTo(cloned, MappingFlags.NoReferenceTypes);
cloned.Code = Rmls.Max(x => x.Code) + 1;
cloned.Guid = Guid.NewGuid().ToString();
cloned.ID = 0;
cloned.Name = name;
+ cloned.DisplayName = name;
+ cloned.RmlQualificationLevel = RmlQualifications.Provisional;
+ cloned.QualificationDate = DateTime.UtcNow;
ProcessParametersTablesGroup group = new ProcessParametersTablesGroup();
group.Name = rml.GetActiveProcessGroup().Name;
@@ -502,8 +664,19 @@ namespace Tango.MachineStudio.RML.ViewModels
cloned.LiquidTypesRmls.Add(l);
}
+ foreach (var spool in rml.RmlsSpools)
+ {
+ RmlsSpool s = new RmlsSpool();
+ spool.MapPropertiesTo(s, MappingFlags.ValueTypesOnly);
+ s.RmlGuid = cloned.Guid;
+ s.SpoolTypeGuid = spool.SpoolTypeGuid;
+ cloned.RmlsSpools.Add(s);
+ }
+
context.Rmls.Add(cloned);
await context.SaveChangesAsync();
+
+ _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlCreated, _authentication.CurrentUser, cloned.Name, cloned, "RML cloned from Machine Studio.");
}
LoadRmls();
@@ -558,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?"))
@@ -648,6 +826,11 @@ namespace Tango.MachineStudio.RML.ViewModels
ActiveRML.LastUpdated = DateTime.UtcNow;
+ if (_rmlBeforeSave.QualificationLevel != ActiveRML.QualificationLevel)
+ {
+ ActiveRML.QualificationDate = DateTime.UtcNow;
+ }
+
if (SelectedCCT != null)
{
if (SelectedCCT.IsNew)
@@ -665,18 +848,26 @@ namespace Tango.MachineStudio.RML.ViewModels
}
}
+ var rmlAfter = RmlDTO.FromObservable(ActiveRML);
+
await _active_context.SaveChangesAsync();
+
+ _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlSaved, _authentication.CurrentUser, _rmlBeforeSave.Name, _rmlBeforeSave, rmlAfter, "RML saved using Machine Studio.");
+
+ _rmlBeforeSave = rmlAfter;
+
+ LoadActiveRML(ActiveRML.Guid);
}
}
catch (Exception ex)
{
LogManager.Log(ex, $"Error saving RML {ActiveRML.Name}");
- _notification.ShowError($"An error occurred while trying to save the current RML.\n{ex.Message}");
+ _notification.ShowError($"An error occurred while trying to save the current RML.\n{ex.FlattenMessage()}");
+ }
+ finally
+ {
+ IsFree = true;
}
-
- LoadActiveRML(ActiveRML.Guid);
-
- IsFree = true;
}
private void BackToRmls()
@@ -692,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;
@@ -804,6 +1001,8 @@ namespace Tango.MachineStudio.RML.ViewModels
var rmlFile = await Rml.FromRmlFile(db, json);
db.Rmls.Add(rmlFile);
+
+ _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlImported, _authentication.CurrentUser, rmlFile.Name, rmlFile, "RML imported from Machine Studio.");
}
await db.SaveChangesAsync();
@@ -860,5 +1059,26 @@ namespace Tango.MachineStudio.RML.ViewModels
}
#endregion
+
+ #region Spools
+
+ private void AddNewSpool()
+ {
+ _active_context.RmlsSpools.Add(new RmlsSpool()
+ {
+ Rml = ActiveRML,
+ });
+ }
+
+ private void RemoveSpool()
+ {
+ if (SelectedSpool != null)
+ {
+ _active_context.RmlsSpools.Remove(SelectedSpool);
+ ActiveRML.RmlsSpools.Remove(SelectedSpool);
+ }
+ }
+
+ #endregion
}
}
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/HeadCleaningParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml
new file mode 100644
index 000000000..aec12aa63
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml
@@ -0,0 +1,59 @@
+<UserControl x:Class="Tango.MachineStudio.RML.Views.HeadCleaningParametersView"
+ 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:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ mc:Ignorable="d"
+ d:DesignHeight="720" d:DesignWidth="1280" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+
+ <UserControl.Resources>
+ <converters:EmptyStringToNullConverter x:Key="EmptyStringToNullConverter" />
+ </UserControl.Resources>
+
+ <Grid>
+ <DockPanel>
+ <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="20 0" Padding="5" CornerRadius="5">
+ <Border.Effect>
+ <DropShadowEffect Opacity="0.4" />
+ </Border.Effect>
+ <Grid>
+ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16" Padding="2">HEAD CLEANING PARAMETERS</TextBlock>
+ </Grid>
+ </Border>
+
+ <Grid>
+ <StackPanel Orientation="Horizontal">
+ <DockPanel Grid.Column="1" Margin="25" HorizontalAlignment="Left" Width="400">
+ <materialDesign:Card>
+ <StackPanel>
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">CLEANER</TextBlock>
+ <controls:TableGrid RowHeight="25" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False">
+ <controls:TableGrid.Resources>
+ <Style TargetType="TextBlock">
+ <Setter Property="VerticalAlignment" Value="Center"></Setter>
+ <Setter Property="Margin" Value="0 3 0 0"></Setter>
+ </Style>
+ </controls:TableGrid.Resources>
+ <TextBlock Text="Cleaner Flow:" VerticalAlignment="Center"></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.CleanerFlow,Mode=TwoWay}" Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+
+ <TextBlock Text="Arc Head Cleaning Motor Speed:" VerticalAlignment="Center"></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.ArcHeadCleaningMotorSpeed,Mode=TwoWay}" Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+ </controls:TableGrid>
+ </DockPanel>
+ </StackPanel>
+ </materialDesign:Card>
+ </DockPanel>
+ </StackPanel>
+ </Grid>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.xaml.cs
new file mode 100644
index 000000000..8d036efa5
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/HeadCleaningParametersView.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 SpoolsView.xaml
+ /// </summary>
+ public partial class HeadCleaningParametersView : UserControl
+ {
+ public HeadCleaningParametersView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml
index ab5207722..e52ac4ece 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml
@@ -9,7 +9,7 @@
xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
- <Grid>
+ <Grid IsEnabled="{Binding IsFree}">
<controls:NavigationControl x:Name="navigationControl" TransitionType="Slide">
<local:RmlsView />
<local:RmlView/>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml
index b85fd2c12..03bf65522 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml
@@ -32,7 +32,7 @@
<DropShadowEffect Opacity="0.4" />
</Border.Effect>
<Grid>
- <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">ACTIVE PROCESS GROUP</TextBlock>
+ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">ACTIVE PROCESS GROUP</TextBlock>
<Button ToolTip="Add new table" Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" Width="30" HorizontalAlignment="Right" Padding="0" Command="{Binding AddProcessParametersTableCommand}">
<materialDesign:PackIcon Kind="Plus" Foreground="#0AC30A" Width="24" Height="24" />
</Button>
@@ -70,7 +70,7 @@
<DataTemplate>
<DockPanel>
<TextBlock IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}" FontSize="11"></TextBlock>
- <mahapps:NumericUpDown HorizontalAlignment="Right" Minimum="0" Margin="0 0 5 0" HideUpDownButtons="True" HorizontalContentAlignment="Right" Maximum="10000" StringFormat="0.0" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}"></mahapps:NumericUpDown>
+ <mahapps:NumericUpDown HorizontalAlignment="Right" Minimum="0" Margin="0 0 5 0" HideUpDownButtons="True" HorizontalContentAlignment="Right" Maximum="10000" StringFormat="{Binding StringFormat}" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}"></mahapps:NumericUpDown>
</DockPanel>
</DataTemplate>
</editors:ParameterizedEditor.DoubleTemplate>
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 50f6a6297..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
@@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:global="clr-namespace:Tango.MachineStudio.RML"
+ xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL"
xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
@@ -19,6 +20,7 @@
<UserControl.Resources>
<converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter>
+ <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter"/>
</UserControl.Resources>
<Grid Margin="20">
@@ -28,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}">
@@ -54,10 +56,25 @@
<Grid>
<DockPanel>
<TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">PROPERTIES</TextBlock>
- <controls:TableGrid RowHeight="35" Margin="20 0">
+ <controls:TableGrid RowHeight="35" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False">
+ <controls:TableGrid.Resources>
+ <Style TargetType="TextBlock">
+ <Setter Property="VerticalAlignment" Value="Center"></Setter>
+ <Setter Property="Margin" Value="0 3 0 0"></Setter>
+ </Style>
+ </controls:TableGrid.Resources>
<TextBlock Text="Name:" ></TextBlock>
<TextBox Text="{Binding ActiveRML.Name,UpdateSourceTrigger=PropertyChanged}"></TextBox>
+ <TextBlock Text="Display Name:" ></TextBlock>
+ <TextBox Text="{Binding ActiveRML.DisplayName,UpdateSourceTrigger=PropertyChanged}"></TextBox>
+
+ <TextBlock Text="Head Type:" ></TextBlock>
+ <ComboBox ItemsSource="{Binding Source={x:Type enumerations:HeadTypes},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding ActiveRML.RmlHeadType}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+
+ <TextBlock Text="Qualification Level:" ></TextBlock>
+ <ComboBox ItemsSource="{Binding Source={x:Type enumerations:RmlQualifications},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding ActiveRML.RmlQualificationLevel}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+
<TextBlock Text="Manufacturer:" ></TextBlock>
<TextBox Text="{Binding ActiveRML.Manufacturer}"></TextBox>
@@ -138,28 +155,34 @@
<Setter Property="Padding" Value="20,2"></Setter>
</Style>
</TabControl.Resources>
- <TabItem Header="PROCESS PARAMETERS" Margin="-100 0 0 0 ">
+ <TabItem Header="PROCESS PARAMETERS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20">
<local:ProcessParametersView x:Name="processParametersView" WidthLilquidFactors="{Binding ElementName=calibrationDataView,Path=ActualWidth}"/>
</TabItem>
- <TabItem Header="COLOR CONVERSION" Margin="-100 0 0 0 ">
+ <TabItem Header="THREAD PARAMETERS" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20">
+ <local:ThreadParametersView/>
+ </TabItem>
+ <TabItem Header="HEAD CLEANING" Margin="-100 0 0 0" mahapps:ControlsHelper.HeaderFontSize="20">
+ <local:HeadCleaningParametersView/>
+ </TabItem>
+ <TabItem Header="COLOR CONVERSION" Margin="-100 0 0 0 " mahapps:ControlsHelper.HeaderFontSize="20">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="260"></ColumnDefinition>
</Grid.ColumnDefinitions>
<DockPanel>
- <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="20 0" Padding="5" CornerRadius="5">
+ <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="20 0" Padding="7" CornerRadius="5">
<Border.Effect>
<DropShadowEffect Opacity="0.4" />
</Border.Effect>
<Grid>
- <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">COLOR CONVERSION</TextBlock>
+ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">COLOR CONVERSION</TextBlock>
</Grid>
</Border>
<local:ColorConversionView x:Name="colorConversionView" Margin="0 0 0 0" Grid.Column="0" DataContext="{Binding ColorConversionViewVM}"/>
</DockPanel>
<DockPanel Grid.Column="1">
- <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="16 0" Padding="5" CornerRadius="5">
+ <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="16 0" Padding="7" CornerRadius="5">
<Border.Effect>
<DropShadowEffect Opacity="0.4" />
</Border.Effect>
@@ -191,7 +214,9 @@
</UniformGrid>
<TextBlock Margin="0 40 0 0" Text="Color Conversion Version:" HorizontalAlignment="Center"></TextBlock>
- <mahapps:NumericUpDown Minimum="1" Maximum="2" 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>
@@ -200,6 +225,12 @@
</DockPanel>
</Grid>
</TabItem>
+ <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"/>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml
new file mode 100644
index 000000000..6eae05c76
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml
@@ -0,0 +1,85 @@
+<UserControl x:Class="Tango.MachineStudio.RML.Views.SpoolsView"
+ 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:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ mc:Ignorable="d"
+ d:DesignHeight="720" d:DesignWidth="1280" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+
+ <UserControl.Resources>
+ <converters:EmptyStringToNullConverter x:Key="EmptyStringToNullConverter" />
+ </UserControl.Resources>
+
+ <Grid>
+ <DockPanel>
+ <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="20 0" Padding="5" CornerRadius="5">
+ <Border.Effect>
+ <DropShadowEffect Opacity="0.4" />
+ </Border.Effect>
+ <Grid>
+ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16" Padding="2">SPOOLS</TextBlock>
+ </Grid>
+ </Border>
+
+ <Grid>
+ <DockPanel Grid.Column="1" Margin="25">
+ <Grid DockPanel.Dock="Bottom">
+ <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 0 0 0">
+ <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="{StaticResource RedBrush300}" BorderBrush="{StaticResource RedBrush300}" Command="{Binding RemoveSpoolCommand}">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="Delete" Width="20" Height="20" />
+ <TextBlock Margin="5 0 0 0" FontSize="16">DELETE</TextBlock>
+ </StackPanel>
+ </Button>
+ <Button Margin="0 0 0 0" MinWidth="160" Height="50" Background="{StaticResource GreenBrush300}" BorderBrush="{StaticResource GreenBrush300}" Command="{Binding AddSpoolCommand}">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="Plus" Width="20" Height="20" />
+ <TextBlock Margin="5 0 0 0" FontSize="16">NEW SPOOL</TextBlock>
+ </StackPanel>
+ </Button>
+ </StackPanel>
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+
+ </StackPanel>
+ </Grid>
+ <Grid>
+ <DataGrid Margin="0 0 0 10" SelectionUnit="FullRow" BorderBrush="{StaticResource borderBrush }" BorderThickness="1" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding ActiveRML.RmlsSpools}" SelectedItem="{Binding SelectedSpool}">
+ <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.Columns>
+ <DataGridComboBoxColumn Header="SPOOL TYPE" SelectedItemBinding="{Binding SpoolType}" DisplayMemberPath="Name" Width="Auto">
+ <DataGridComboBoxColumn.ElementStyle>
+ <Style TargetType="ComboBox">
+ <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid},Path=DataContext.SpoolTypes}"/>
+ </Style>
+ </DataGridComboBoxColumn.ElementStyle>
+ <DataGridComboBoxColumn.EditingElementStyle>
+ <Style TargetType="ComboBox">
+ <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid},Path=DataContext.SpoolTypes}"/>
+ </Style>
+ </DataGridComboBoxColumn.EditingElementStyle>
+ </DataGridComboBoxColumn>
+ <DataGridTextColumn Header="ROTATIONS PER PASSAGE" Binding="{Binding RotationsPerPassage,Converter={StaticResource EmptyStringToNullConverter}}" Width="Auto" />
+ <DataGridTextColumn Header="MAX LENGTH" Binding="{Binding Length,Converter={StaticResource EmptyStringToNullConverter}}" Width="Auto" />
+ <DataGridTextColumn Header="BACKING RATE" Binding="{Binding BackingRate,Converter={StaticResource EmptyStringToNullConverter}}" Width="Auto" />
+ <DataGridTextColumn Header="BOTTOM BACKING RATE" Binding="{Binding BottomBackingRate,Converter={StaticResource EmptyStringToNullConverter}}" Width="Auto" />
+ </DataGrid.Columns>
+ </DataGrid>
+ </Grid>
+ </DockPanel>
+ </Grid>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.xaml.cs
new file mode 100644
index 000000000..6e363681c
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/SpoolsView.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 SpoolsView.xaml
+ /// </summary>
+ public partial class SpoolsView : UserControl
+ {
+ public SpoolsView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml
new file mode 100644
index 000000000..c083e9b02
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml
@@ -0,0 +1,121 @@
+<UserControl x:Class="Tango.MachineStudio.RML.Views.ThreadParametersView"
+ 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:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ mc:Ignorable="d"
+ d:DesignHeight="720" d:DesignWidth="1280" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+
+ <UserControl.Resources>
+ <converters:EmptyStringToNullConverter x:Key="EmptyStringToNullConverter" />
+ </UserControl.Resources>
+
+ <Grid>
+ <DockPanel>
+ <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="20 0" Padding="5" CornerRadius="5">
+ <Border.Effect>
+ <DropShadowEffect Opacity="0.4" />
+ </Border.Effect>
+ <Grid>
+ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16" Padding="2">THREAD PARAMETERS</TextBlock>
+ </Grid>
+ </Border>
+
+ <Grid>
+ <StackPanel Orientation="Horizontal">
+ <DockPanel Grid.Column="1" Margin="25" HorizontalAlignment="Left" Width="400">
+ <materialDesign:Card>
+ <StackPanel>
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">FEEDER</TextBlock>
+ <controls:TableGrid RowHeight="25" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False">
+ <controls:TableGrid.Resources>
+ <Style TargetType="TextBlock">
+ <Setter Property="VerticalAlignment" Value="Center"></Setter>
+ <Setter Property="Margin" Value="0 3 0 0"></Setter>
+ </Style>
+ </controls:TableGrid.Resources>
+ <TextBlock Text="Feeder P:" ></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.FeederP,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+
+ <TextBlock Text="Feeder I:" ></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.FeederI,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+
+ <TextBlock Text="Feeder D:" ></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.FeederD,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+ </controls:TableGrid>
+ </DockPanel>
+
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">PULLER</TextBlock>
+ <controls:TableGrid RowHeight="25" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False">
+ <controls:TableGrid.Resources>
+ <Style TargetType="TextBlock">
+ <Setter Property="VerticalAlignment" Value="Center"></Setter>
+ <Setter Property="Margin" Value="0 3 0 0"></Setter>
+ </Style>
+ </controls:TableGrid.Resources>
+ <TextBlock Text="Puller P:" ></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.PullerP,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+
+ <TextBlock Text="Puller I:" ></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.PullerI,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+
+ <TextBlock Text="Puller D:" ></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.PullerD,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+ </controls:TableGrid>
+ </DockPanel>
+
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">WINDER</TextBlock>
+ <controls:TableGrid RowHeight="25" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False">
+ <controls:TableGrid.Resources>
+ <Style TargetType="TextBlock">
+ <Setter Property="VerticalAlignment" Value="Center"></Setter>
+ <Setter Property="Margin" Value="0 3 0 0"></Setter>
+ </Style>
+ </controls:TableGrid.Resources>
+ <TextBlock Text="Winder P:" ></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.WinderP,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+
+ <TextBlock Text="Winder I:" ></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.WinderI,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+
+ <TextBlock Text="Winder D:" ></TextBlock>
+ <mahapps:NumericUpDown Value="{Binding ActiveRML.WinderD,Mode=TwoWay}" Minimum="-100000" Maximum="1000000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left"></mahapps:NumericUpDown>
+ </controls:TableGrid>
+ </DockPanel>
+ </StackPanel>
+ </materialDesign:Card>
+ </DockPanel>
+
+ <DockPanel Grid.Column="1" Margin="25" HorizontalAlignment="Left" Width="400">
+ <materialDesign:Card>
+ <StackPanel>
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top" Margin="20 10 0 10" FontSize="16">ROCKERS</TextBlock>
+ <controls:TableGrid RowHeight="25" Margin="20 0" MakeFirstColumnVerticalAlignmentBottom="False">
+ <controls:TableGrid.Resources>
+ <Style TargetType="TextBlock">
+ <Setter Property="VerticalAlignment" Value="Center"></Setter>
+ </Style>
+ </controls:TableGrid.Resources>
+ <TextBlock Text="Bypass Rockers:" ></TextBlock>
+ <ToggleButton IsChecked="{Binding ActiveRML.BypassRockers,Mode=TwoWay}" HorizontalAlignment="Right" ></ToggleButton>
+ </controls:TableGrid>
+ </DockPanel>
+ </StackPanel>
+ </materialDesign:Card>
+ </DockPanel>
+ </StackPanel>
+ </Grid>
+ </DockPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.xaml.cs
new file mode 100644
index 000000000..aa63e48fb
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ThreadParametersView.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 SpoolsView.xaml
+ /// </summary>
+ public partial class ThreadParametersView : UserControl
+ {
+ public ThreadParametersView()
+ {
+ InitializeComponent();
+ }
+ }
+}