diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2019-09-16 11:40:14 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2019-09-16 11:40:14 +0300 |
| commit | b34d8641f72e7b92958ea17d10ff15c29d37c464 (patch) | |
| tree | 38f4740dd012b044d8c2737b21b8e1de58a836fb /Software/Visual_Studio/MachineStudio/Modules | |
| parent | 1da774f550b3d26479087aa8da35220fc9e168d5 (diff) | |
| download | Tango-b34d8641f72e7b92958ea17d10ff15c29d37c464.tar.gz Tango-b34d8641f72e7b92958ea17d10ff15c29d37c464.zip | |
Dropping Machine Studio ColorLab Module. Move to RML module.
Related Work Items: #1168
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
19 files changed, 2133 insertions, 220 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/arrow-long-down.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/arrow-long-down.png Binary files differnew file mode 100644 index 000000000..e3a862399 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/arrow-long-down.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/arrow-long-left.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/arrow-long-left.png Binary files differnew file mode 100644 index 000000000..5845204d2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/arrow-long-left.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/arrow-long-right.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/arrow-long-right.png Binary files differnew file mode 100644 index 000000000..6c089d44e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/arrow-long-right.png 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 fc05f3c16..6741a1dff 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 @@ -90,13 +90,28 @@ </Compile> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\AddLiquidFactorViewVM.cs" /> + <Compile Include="ViewModels\CalibrationDataPointVM.cs" /> + <Compile Include="ViewModels\CalibrationDataViewVM.cs" /> + <Compile Include="ViewModels\CalibrationDataVM.cs" /> + <Compile Include="ViewModels\ColorConversionViewVM.cs" /> + <Compile Include="ViewModels\LiquidVolumeVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModels\RgbVM.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\ColorConversionView.xaml.cs"> + <DependentUpon>ColorConversionView.xaml</DependentUpon> + </Compile> <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> + <Compile Include="Views\ProcessParametersView.xaml.cs"> + <DependentUpon>ProcessParametersView.xaml</DependentUpon> + </Compile> <Compile Include="Views\RmlsView.xaml.cs"> <DependentUpon>RmlsView.xaml</DependentUpon> </Compile> @@ -115,10 +130,22 @@ </None> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\..\SideChains\ColorMine\ColorMine.csproj"> + <Project>{37e4ceab-b54b-451f-b535-04cf7da9c459}</Project> + <Name>ColorMine</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> <Name>Tango.BL</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.BrushPicker\Tango.BrushPicker.csproj"> + <Project>{40085232-aced-4cbe-945b-90ba8153c151}</Project> + <Name>Tango.BrushPicker</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.ColorConversion\Tango.ColorConversion.csproj"> + <Project>{b4fe6485-4161-4b36-bc08-67e0b53d01b7}</Project> + <Name>Tango.ColorConversion</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> @@ -135,6 +162,10 @@ <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> <Name>Tango.DragAndDrop</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Hive\Tango.Hive.csproj"> + <Project>{942134ac-6ea2-4500-8f22-0f739b70a05f}</Project> + <Name>Tango.Hive</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> @@ -155,10 +186,6 @@ <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> </ProjectReference> - <ProjectReference Include="..\Tango.MachineStudio.ColorLab\Tango.MachineStudio.ColorLab.csproj"> - <Project>{4d183aca-552b-4135-ae81-7c5a8e5fc3b1}</Project> - <Name>Tango.MachineStudio.ColorLab</Name> - </ProjectReference> </ItemGroup> <ItemGroup> <Resource Include="Images\rml-module.jpg" /> @@ -168,10 +195,22 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\CalibrationDataView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\ColorConversionView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\MainView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\ProcessParametersView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\RmlsView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -190,6 +229,13 @@ <ItemGroup> <Resource Include="Images\data-table.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\arrow-long-down.png" /> + <Resource Include="Images\arrow-long-left.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\arrow-long-right.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataPointVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataPointVM.cs new file mode 100644 index 000000000..4ad06c7ed --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataPointVM.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.PMR.ColorLab; +using Tango.SharedUI; + +namespace Tango.MachineStudio.RML.ViewModels +{ + public class CalibrationDataPointVM : ExtendedObject + { + private double _x; + + public double X + { + get { return _x; } + set { _x = value; RaisePropertyChangedAuto(); } + } + + private double _y; + + public double Y + { + get { return _y; } + set { _y = value; RaisePropertyChangedAuto(); } + } + + private int _index; + + public int Index + { + get { return _index; } + set { _index = value; RaisePropertyChangedAuto(); } + } + + + public CalibrationDataPointVM() + { + + } + + public CalibrationDataPointVM(double x, double y) + { + X = x; + Y = y; + } + + public CalibrationDataPointVM(CalibrationPoint calibrationPoint) : this(calibrationPoint.X, calibrationPoint.Y) + { + + } + + public CalibrationPoint ToPMR() + { + return new CalibrationPoint() + { + X = X, + Y = Y, + }; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataVM.cs new file mode 100644 index 000000000..403494a8e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataVM.cs @@ -0,0 +1,83 @@ +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.SharedUI; + +namespace Tango.MachineStudio.RML.ViewModels +{ + public class CalibrationDataVM : ExtendedObject + { + private LiquidType _liquidType; + + public LiquidType LiquidType + { + get { return _liquidType; } + set { _liquidType = value; RaisePropertyChangedAuto(); } + } + + private IdsPack _idsPack; + + public IdsPack IdsPack + { + get { return _idsPack; } + set { _idsPack = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<CalibrationDataPointVM> _calibrationPoints; + + public ObservableCollection<CalibrationDataPointVM> CalibrationPoints + { + get { return _calibrationPoints; } + set { _calibrationPoints = value; RaisePropertyChangedAuto(); OnCalibrationPointsChanged(); } + } + + private void OnCalibrationPointsChanged() + { + if (CalibrationPoints != null) + { + CalibrationPoints.CollectionChanged -= CalibrationPoints_CollectionChanged; + CalibrationPoints.CollectionChanged += CalibrationPoints_CollectionChanged; + + SetIndices(); + } + } + + private void CalibrationPoints_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + { + SetIndices(); + } + + private void SetIndices() + { + if (CalibrationPoints != null) + { + int index = 1; + foreach (var p in CalibrationPoints) + { + p.Index = index++; + } + } + } + + private CalibrationDataVM() + { + CalibrationPoints = new ObservableCollection<CalibrationDataPointVM>(); + } + + public CalibrationDataVM(IdsPack pack) : this() + { + IdsPack = pack; + LiquidType = pack.LiquidType; + } + + public CalibrationDataVM(LiquidType liquidType) : this() + { + LiquidType = liquidType; + } + } +} 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 new file mode 100644 index 000000000..b34ef83bc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/CalibrationDataViewVM.cs @@ -0,0 +1,110 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Calibration; +using Tango.Core.Commands; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Notifications; +using Tango.SharedUI; + +namespace Tango.MachineStudio.RML.ViewModels +{ + public class CalibrationDataViewVM : ViewModel + { + private INotificationProvider _notification; + + private ObservableCollection<CalibrationDataVM> _liquidsCalibrationData; + /// <summary> + /// Gets or sets the liquids calibration data. + /// </summary> + public ObservableCollection<CalibrationDataVM> LiquidsCalibrationData + { + get { return _liquidsCalibrationData; } + set { _liquidsCalibrationData = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Gets or sets the import excel command. + /// </summary> + public RelayCommand<CalibrationDataVM> ImportExcelCommand { get; set; } + + /// <summary> + /// Gets or sets the export excel command. + /// </summary> + public RelayCommand<CalibrationDataVM> ExportExcelCommand { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="CalibrationDataViewVM"/> class. + /// </summary> + public CalibrationDataViewVM(INotificationProvider notificationProvider) + { + _notification = notificationProvider; + + LiquidsCalibrationData = new ObservableCollection<CalibrationDataVM>(); + + ImportExcelCommand = new RelayCommand<CalibrationDataVM>(ImportExcel); + ExportExcelCommand = new RelayCommand<CalibrationDataVM>(ExportExcel); + } + + /// <summary> + /// Initializes a new instance of the <see cref="CalibrationDataViewVM"/> class. + /// </summary> + /// <param name="liquidsCalibrationData">The liquids calibration data.</param> + public CalibrationDataViewVM(INotificationProvider notificationProvider, ObservableCollection<CalibrationDataVM> liquidsCalibrationData) : this(notificationProvider) + { + LiquidsCalibrationData = liquidsCalibrationData; + } + + private void ImportExcel(CalibrationDataVM vm) + { + OpenFileDialog dlg = new OpenFileDialog(); + + try + { + dlg.Title = $"Import excel calibration file for {vm.LiquidType.Name}"; + dlg.Filter = "Excel Files|*.xlsx"; + if (dlg.ShowDialog().Value) + { + vm.CalibrationPoints.Clear(); + var points = CalibrationHelper.ImportCalibrationDataFromExcel(dlg.FileName); + + foreach (var p in points) + { + vm.CalibrationPoints.Add(new CalibrationDataPointVM(p)); + } + } + } + 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."); + } + } + + private void ExportExcel(CalibrationDataVM vm) + { + SaveFileDialog dlg = new SaveFileDialog(); + try + { + dlg.Title = $"Export excel calibration file for {vm.LiquidType.Name}"; + dlg.Filter = "Excel Files|*.xlsx"; + dlg.DefaultExt = ".xlsx"; + dlg.FileName = $"CData_{vm.LiquidType.Name}_v{vm.LiquidType.Version}.xlsx"; + if (dlg.ShowDialog().Value) + { + var points = vm.CalibrationPoints.Select(x => x.ToPMR()).ToList(); + 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."); + } + } + } +} 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 new file mode 100644 index 000000000..2624c9b7d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs @@ -0,0 +1,396 @@ +using Google.Protobuf; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Data.Entity; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using Tango.BL; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.ColorConversion; +using Tango.MachineStudio.Common; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.RML.Models; +using Tango.PMR.ColorLab; +using Tango.SharedUI; + +namespace Tango.MachineStudio.RML.ViewModels +{ + public class ColorConversionViewVM: ViewModel + { + #region properties + + private INotificationProvider _notification; + private bool _prevent_inverse_conversion; + + private bool _isVolumesOutOfRange; + /// <summary> + /// Gets or sets a value indicating whether the liquid volumes are out of range. + /// </summary> + public bool IsVolumesOutOfRange + { + get { return _isVolumesOutOfRange; } + set + { + if (_isVolumesOutOfRange != value) + { + _isVolumesOutOfRange = value; + RaisePropertyChangedAuto(); + } + } + } + + private bool _isOutOfGamut; + /// <summary> + /// Gets or sets a value indicating whether the source color is out of gamut. + /// </summary> + public bool IsOutOfGamut + { + get { return _isOutOfGamut; } + set { _isOutOfGamut = value; RaisePropertyChangedAuto(); } + } + + private Rml _rml; + public Rml RML + { + get { return _rml; } + set { _rml = value; RaisePropertyChangedAuto(); } + } + + private List<ColorConversionSuggestion> _hiveSuggestions; + /// <summary> + /// Gets or sets the hive suggestions. + /// </summary> + public List<ColorConversionSuggestion> HiveSuggestions + { + get { return _hiveSuggestions; } + set { _hiveSuggestions = value; RaisePropertyChangedAuto(); } + } + + private ColorConversionSuggestion _selectedSuggestion; + /// <summary> + /// Gets or sets the selected suggestion. + /// </summary> + public ColorConversionSuggestion SelectedSuggestion + { + get { return _selectedSuggestion; } + set { _selectedSuggestion = value; RaisePropertyChangedAuto(); OnSelectedSuggestionChanged(); } + } + + private ObservableCollection<LiquidTypesRml> _liquidTypesRmls; + /// <summary> + /// Gets or sets the liquid types RMLS. + /// </summary> + public ObservableCollection<LiquidTypesRml> LiquidTypesRmls + { + get { return _liquidTypesRmls; } + set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); OnLiquidTypesRmlsChanged(); } + } + + private void OnLiquidTypesRmlsChanged() + { + if (LiquidTypesRmls != null) + { + LiquidTypesRmls.CollectionChanged += LiquidTypesRmls_CollectionChanged; + InvalidateLiquidVolumes(); + } + } + + private void LiquidTypesRmls_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + { + InvalidateLiquidVolumes(); + } + + private void InvalidateLiquidVolumes() + { + LiquidVolumes = LiquidTypesRmls.Where(x => x.LiquidType.HasPigment).Select(x => new LiquidVolumeVM() + { + Color = x.LiquidType.Color, + Name = x.LiquidType.Name, + LiquidType = x.LiquidType, + }).ToObservableCollection(); + } + + private ObservableCollection<LiquidVolumeVM> _liquidVolumes; + /// <summary> + /// Gets or sets the liquid volumes. + /// </summary> + public ObservableCollection<LiquidVolumeVM> LiquidVolumes + { + get { return _liquidVolumes; } + set { _liquidVolumes = value; RaisePropertyChangedAuto(); OnLiquidsVolumesChanged(); } + } + + private ObservableCollection<CalibrationDataVM> _liquidsCalibrationData; + /// <summary> + /// Gets or sets the liquids calibration data. + /// </summary> + public ObservableCollection<CalibrationDataVM> LiquidsCalibrationData + { + get { return _liquidsCalibrationData; } + set { _liquidsCalibrationData = value; RaisePropertyChangedAuto(); } + } + + private CctModel _cct; + public CctModel CCT + { + get { return _cct; } + set + { + _cct = value; + RaisePropertyChangedAuto(); + InvalidateRelayCommands(); + } + } + + private RgbVM _sourceColor; + /// <summary> + /// Gets or sets the color of the source. + /// </summary> + public RgbVM SourceColor + { + get { return _sourceColor; } + set { _sourceColor = value; RaisePropertyChangedAuto(); } + } + + private RgbVM _targetColor; + /// <summary> + /// Gets or sets the color of the target. + /// </summary> + /// <value> + /// The color of the target. + /// </value> + public RgbVM TargetColor + { + get { return _targetColor; } + set { _targetColor = value; RaisePropertyChangedAuto(); } + } + + #endregion + + public ColorConversionViewVM(INotificationProvider notification) + { + _notification = notification; + + // CCT = new Cct(); + + SourceColor = new RgbVM(); + SourceColor.ColorChanged += SourceColor_ColorChanged; + } + + private void OnLiquidsVolumesChanged() + { + LiquidVolumes.EnableCrossThreadOperations(); + LiquidVolumes.ToList().ForEach(x => x.VolumeChanged += (s, e) => OnLiquidVolumeChanged()); + } + + private void SourceColor_ColorChanged(object sender, Color e) + { + GetHiveSuggestions(); + } + + private void GetHiveSuggestions() + { + Task.Factory.StartNew(() => + { + try + { + if (RML == null || LiquidsCalibrationData == null || CCT == null || CCT.Data == null) return; + + ConversionInput input = new ConversionInput(); + input.ColorSpace = SourceColor.IsLab ? PMR.ColorLab.ColorSpace.Lab : PMR.ColorLab.ColorSpace.Rgb; + //input.DeltaChroma = DeltaChroma; + //input.DeltaL = DeltaL; + input.ForwardData = ByteString.CopyFrom(CCT.Data); + + input.InputCoordinates = new InputCoordinates(); + input.InputCoordinates.Red = (int)SourceColor.Red; + input.InputCoordinates.Green = (int)SourceColor.Green; + input.InputCoordinates.Blue = (int)SourceColor.Blue; + + input.InputCoordinates.L = SourceColor.L; + input.InputCoordinates.A = SourceColor.A; + input.InputCoordinates.B = SourceColor.B; + + input.ThreadL = RML.WhitePointL; + input.ThreadA = RML.WhitePointA; + input.ThreadB = RML.WhitePointB; + + //Validate calibration data + foreach (var vm in LiquidsCalibrationData.Where(x => x.LiquidType.HasPigment)) + { + if (vm.CalibrationPoints.Count == 0) + { + InvokeUI(() => + { + _notification.ShowError($"No calibration data for liquid '{vm.LiquidType.Name}'. Could not convert source color."); + }); + return; + } + else if (!(vm.CalibrationPoints.First().X == 0 && vm.CalibrationPoints.First().Y == 0 && vm.CalibrationPoints.Last().X == 100 && vm.CalibrationPoints.Last().Y == 100)) + { + InvokeUI(() => + { + _notification.ShowError($"Invalid calibration data for liquid '{vm.LiquidType.Name}'. Could not convert source color."); + }); + return; + } + } + + foreach (var vm in LiquidsCalibrationData) + { + InputLiquid inputLiquid = new InputLiquid(); + + + CalibrationData calData = new CalibrationData(); + calData.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code; + calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); + + inputLiquid.CalibrationData = calData; + + inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code; + inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.LiquidType.Code).MaxNlPerCm; + + input.InputCoordinates.InputLiquids.Add(inputLiquid); + } + + foreach (var process in RML.GetActiveProcessGroup().ProcessParametersTables) + { + input.ProcessRanges.Add(new ProcessRange() + { + MinInkUptake = process.MinInkUptake, + MaxInkUptake = process.MaxInkUptake, + }); + } + + IColorConverter converter = new DefaultColorConverter(); + + var output = converter.Convert(input); + + IsOutOfGamut = output.OutOfGamut; + + HiveSuggestions = output.CreateHiveSuggestions(); + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to convert from source color to Volume."); + + InvokeUI(() => + { + _notification.ShowError($"An error occurred while trying to convert from source color to Volume.\n" + ex.Message); + }); + } + }); + } + + private void OnSelectedSuggestionChanged() + { + if (SelectedSuggestion != null) + { + _prevent_inverse_conversion = true; + + var coords = SelectedSuggestion.Coordinates; + + foreach (var liquid in coords.OutputLiquids) + { + var liquidVolume = LiquidVolumes.SingleOrDefault(x => x.LiquidType.Code == liquid.LiquidType.ToInt32()); + + if (liquidVolume != null) + { + liquidVolume.Volume = liquid.Volume; + } + } + + _prevent_inverse_conversion = false; + + OnLiquidVolumeChanged(); + } + } + + private void OnLiquidVolumeChanged() + { + try + { + 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) + { + IsVolumesOutOfRange = true; + return; + } + else + { + IsVolumesOutOfRange = false; + } + + ConversionInput input = new ConversionInput(); + input.ColorSpace = PMR.ColorLab.ColorSpace.Volume; + input.ForwardData = ByteString.CopyFrom(CCT.Data); + + input.InputCoordinates = new InputCoordinates(); + input.ThreadL = RML.WhitePointL; + input.ThreadA = RML.WhitePointA; + input.ThreadB = RML.WhitePointB; + + foreach (var vm in LiquidsCalibrationData.Where(x => x.LiquidType.HasPigment)) + { + InputLiquid inputLiquid = new InputLiquid(); + + CalibrationData calData = new CalibrationData(); + calData.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code; + calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); + + inputLiquid.CalibrationData = calData; + + inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code; + inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.LiquidType.Code).MaxNlPerCm; + inputLiquid.Volume = LiquidVolumes.SingleOrDefault(x => x.LiquidType == vm.LiquidType).Volume; + + input.InputCoordinates.InputLiquids.Add(inputLiquid); + } + + foreach (var process in RML.ProcessParametersTablesGroups.Single().ProcessParametersTables) + { + input.ProcessRanges.Add(new ProcessRange() + { + MinInkUptake = process.MinInkUptake, + MaxInkUptake = process.MaxInkUptake, + }); + } + + IColorConverter converter = new DefaultColorConverter(); + + var output = converter.Convert(input); + + if (SourceColor.IsLab) + { + TargetColor = new RgbVM() + { + IsLab = true, + L = output.SingleCoordinates.L, + A = output.SingleCoordinates.A, + B = output.SingleCoordinates.B, + }; + } + else + { + TargetColor = new RgbVM() + { + Red = output.SingleCoordinates.Red, + Green = output.SingleCoordinates.Green, + Blue = output.SingleCoordinates.Blue, + }; + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error in inversed color conversion!"); + _notification.ShowError("An error occurred while trying to convert from Volume to RGB.\n" + ex.Message); + } + } + } +} 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 new file mode 100644 index 000000000..7399d62af --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/LiquidVolumeVM.cs @@ -0,0 +1,51 @@ +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 LiquidVolumeVM : ExtendedObject + { + public event EventHandler<double> VolumeChanged; + + private String _name; + + public String Name + { + get { return _name; } + set { _name = value; RaisePropertyChangedAuto(); } + } + + private double _volume; + + public double Volume + { + get { return _volume; } + set + { + _volume = value; RaisePropertyChangedAuto(); + VolumeChanged?.Invoke(this, _volume); + } + } + + private int _color; + + public int Color + { + get { return _color; } + set { _color = value; RaisePropertyChangedAuto(); } + } + + private LiquidType _liquidType; + public LiquidType LiquidType + { + get { return _liquidType; } + set { _liquidType = value; RaisePropertyChangedAuto(); } + } + } +} 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 aa84fb137..361608ef6 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 @@ -13,13 +13,13 @@ using Tango.BL.Builders; using Tango.BL.Calibration; using Tango.BL.Entities; using Tango.Core.Commands; -using Tango.MachineStudio.ColorLab.ViewModels; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.RML.Contracts; using Tango.MachineStudio.RML.Models; using Tango.MachineStudio.RML.Views; using Tango.PMR.ColorLab; +using System.Data.Entity; namespace Tango.MachineStudio.RML.ViewModels { @@ -132,7 +132,14 @@ namespace Tango.MachineStudio.RML.ViewModels public CctModel SelectedCCT { get { return _selectedCCT; } - set { _selectedCCT = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + set { _selectedCCT = value; RaisePropertyChangedAuto(); OnSelectedCCTChanged(); InvalidateRelayCommands(); } + } + + private ColorConversionViewVM _colorConversionViewVM; + public ColorConversionViewVM ColorConversionViewVM + { + get { return _colorConversionViewVM; } + set { _colorConversionViewVM = value; RaisePropertyChangedAuto(); } } /// <summary> @@ -287,6 +294,13 @@ namespace Tango.MachineStudio.RML.ViewModels CalibrationDataViewVM.LiquidsCalibrationData.Add(catVM); } + ColorConversionViewVM = new ColorConversionViewVM(_notification) + { + RML = ActiveRML, + CCT = SelectedCCT, + LiquidsCalibrationData = CalibrationDataViewVM.LiquidsCalibrationData, + LiquidTypesRmls = LiquidTypesRmls, + }; View.NavigateTo(RmlNavigationView.RmlView); @@ -296,6 +310,27 @@ namespace Tango.MachineStudio.RML.ViewModels } } + private async void OnSelectedCCTChanged() + { + if (SelectedCCT != null && !SelectedCCT.IsNew) + { + using (_notification.PushTaskItem("Loading CCT data...")) + { + IsFree = false; + + var cct = await _active_context.Ccts.SingleOrDefaultAsync(x => x.Guid == SelectedCCT.Guid); + + if (cct != null) + { + SelectedCCT.Data = cct.Data; + ColorConversionViewVM.CCT = SelectedCCT; + } + + IsFree = true; + } + } + } + private void LoadRmlProperties() { Materials = _active_context.MediaMaterials.ToObservableCollection(); @@ -566,6 +601,8 @@ namespace Tango.MachineStudio.RML.ViewModels CCTS.Insert(0, cctModel); SelectedCCT = cctModel; + + ColorConversionViewVM.CCT = SelectedCCT; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RgbVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RgbVM.cs new file mode 100644 index 000000000..e64592aae --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RgbVM.cs @@ -0,0 +1,148 @@ +using ColorMine.ColorSpaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Windows.Threading; +using Tango.Core; +using Tango.SharedUI; + +namespace Tango.MachineStudio.RML.ViewModels +{ + public class RgbVM : ExtendedObject + { + private DispatcherTimer _color_change_timer; + + public event EventHandler<Color> ColorChanged; + + public RgbVM() + { + _color_change_timer = new DispatcherTimer(); + _color_change_timer.Interval = TimeSpan.FromMilliseconds(30); + _color_change_timer.Tick += _color_change_timer_Tick; + _color_change_timer.Stop(); + + Color = Colors.DimGray; + } + + private void _color_change_timer_Tick(object sender, EventArgs e) + { + _color_change_timer.Stop(); + ColorChanged?.Invoke(this, Color); + } + + private double _red; + public double Red + { + get { return _red; } + set { _red = value; SynchronizeColor(); RaisePropertyChangedAuto(); } + } + + private double _green; + public double Green + { + get { return _green; } + set { _green = value; SynchronizeColor(); RaisePropertyChangedAuto(); } + } + + private double _blue; + public double Blue + { + get { return _blue; } + set { _blue = value; SynchronizeColor(); RaisePropertyChangedAuto(); } + } + + private double _l; + public double L + { + get { return _l; } + set { _l = value; SynchronizeColor(); RaisePropertyChangedAuto(); } + } + + private double _a; + public double A + { + get { return _a; } + set { _a = value; SynchronizeColor(); RaisePropertyChangedAuto(); } + } + + private double _b; + public double B + { + get { return _b; } + set { _b = value; SynchronizeColor(); RaisePropertyChangedAuto(); } + } + + private Color _color; + public Color Color + { + get { return _color; } + set { _color = value; RaisePropertyChanged(nameof(Color)); SynchronizeComponents(); } + } + + private bool _isLab; + public bool IsLab + { + get { return _isLab; } + set { _isLab = value; RaisePropertyChangedAuto(); } + } + + + private void SynchronizeColor() + { + _color_change_timer.Stop(); + + if (!IsLab) + { + Rgb rgb = new Rgb(Red, Green, Blue); + Lab lab = rgb.To<Lab>(); + _l = lab.L; + _a = lab.A; + _b = lab.B; + } + else + { + Lab lab = new Lab(L, A, B); + Rgb rgb = lab.To<Rgb>(); + _red = rgb.R; + _green = rgb.G; + _blue = rgb.B; + } + + _color = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + RaisePropertyChanged(nameof(Color)); + + _color_change_timer.Start(); + } + + private void SynchronizeComponents() + { + _color_change_timer.Stop(); + + _red = Color.R; + _green = Color.G; + _blue = Color.B; + + if (IsLab) + { + Rgb rgb = new Rgb(Red, Green, Blue); + Lab lab = rgb.To<Lab>(); + _l = lab.L; + _a = lab.A; + _b = lab.B; + } + + RaisePropertyChanged(nameof(Red)); + RaisePropertyChanged(nameof(Green)); + RaisePropertyChanged(nameof(Blue)); + RaisePropertyChanged(nameof(L)); + RaisePropertyChanged(nameof(A)); + RaisePropertyChanged(nameof(B)); + RaisePropertyChanged(nameof(Color)); + + _color_change_timer.Start(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml new file mode 100644 index 000000000..54e96017c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml @@ -0,0 +1,72 @@ +<UserControl x:Class="Tango.MachineStudio.RML.Views.CalibrationDataView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + 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="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:CalibrationDataViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + <converters:ColorComponentToOpacityConverter x:Key="ColorComponentToOpacityConverter" /> + <converters:ColorToComponentsConverter x:Key="ColorToComponentsConverter" /> + </UserControl.Resources> + + <Grid> + <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding LiquidsCalibrationData}" IsEnabled="{Binding IsFree}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Rows="1" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + + <ItemsControl.ItemTemplate> + <DataTemplate> + <DockPanel Width="240"> + + <StackPanel DockPanel.Dock="Top"> + + <StackPanel DockPanel.Dock="Right" VerticalAlignment="Bottom" HorizontalAlignment="Right" Orientation="Horizontal" Margin="0 0 5 0"> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Import from excel" Width="30" Command="{Binding RelativeSource={RelativeSource AncestorType=local:CalibrationDataView},Path=DataContext.ImportExcelCommand}" CommandParameter="{Binding}"> + <materialDesign:PackIcon Kind="Download" Foreground="{StaticResource BlackForegroundBrush}" /> + </Button> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Export to excel" Width="30" Command="{Binding RelativeSource={RelativeSource AncestorType=local:CalibrationDataView},Path=DataContext.ExportExcelCommand}" CommandParameter="{Binding}"> + <materialDesign:PackIcon Kind="Upload" Foreground="{StaticResource BlackForegroundBrush}" /> + </Button> + </StackPanel> + <Border Padding="2" Margin="5" CornerRadius="3"> + <Border.Background> + <SolidColorBrush Opacity="0.4" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </Border.Background> + <TextBlock Text="{Binding LiquidType.Name}" HorizontalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}"></TextBlock> + </Border> + </StackPanel> + + <Grid Margin="0 0 0 5"> + <DataGrid Background="{StaticResource TransparentBackgroundBrush400}" AlternatingRowBackground="{StaticResource Transparent200}" BorderThickness="1" BorderBrush="{StaticResource DarkGrayBrush}" Margin="5 0" ItemsSource="{Binding CalibrationPoints}" CanUserResizeColumns="False" CanUserReorderColumns="False" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="True" CanUserSortColumns="False"> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> + <Setter Property="FlowDirection" Value="RightToLeft"></Setter> + <Setter Property="Foreground" Value="{StaticResource BlackForegroundBrush}"></Setter> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTextColumn Header="#" Binding="{Binding Index}" Width="Auto" IsReadOnly="True" Foreground="{StaticResource DimGrayBrush}" FontSize="11" /> + <mahapps:DataGridNumericUpDownColumn Header="X" Binding="{Binding X}" Minimum="0" Maximum="10000" HideUpDownButtons="True" Width="1*"/> + <mahapps:DataGridNumericUpDownColumn Header="Y" Binding="{Binding Y}" Minimum="0" Maximum="10000" HideUpDownButtons="True" Width="1*" /> + </DataGrid.Columns> + </DataGrid> + </Grid> + </DockPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.xaml.cs new file mode 100644 index 000000000..e23e343a4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/CalibrationDataView.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 CalibrationDataView.xaml + /// </summary> + public partial class CalibrationDataView : UserControl + { + public CalibrationDataView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorConversionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorConversionView.xaml new file mode 100644 index 000000000..ed27c1760 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorConversionView.xaml @@ -0,0 +1,772 @@ +<UserControl x:Class="Tango.MachineStudio.RML.Views.ColorConversionView" + 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:local="clr-namespace:Tango.MachineStudio.RML.Views" + xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:global="clr-namespace:Tango.MachineStudio.RML" + 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" + xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:hive="clr-namespace:Tango.Hive;assembly=Tango.Hive" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:brushPicker="clr-namespace:Tango.BrushPicker;assembly=Tango.BrushPicker" + xmlns:colorConversion="clr-namespace:Tango.ColorConversion;assembly=Tango.ColorConversion" + 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}"> + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + <converters:ColorComponentToOpacityConverter x:Key="ColorComponentToOpacityConverter" /> + <converters:ColorToComponentsConverter x:Key="ColorToComponentsConverter" /> + <converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter" /> + <converters:ObjectToObjectTypeConverter x:Key="ObjectToObjectTypeConverter" /> + <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + <converters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> + </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 HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">COLOR CONVERSION</TextBlock> + </Grid> + </Border> + <Grid DockPanel.Dock="Top" x:Name="ColorCalibrationGrid" Margin="80,20,20,20"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="250" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="1*" /> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="20" /> + <RowDefinition/> + <RowDefinition Height="30" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Grid.Resources> + <Style TargetType="TextBlock" > + <Setter Property="Foreground" Value="{StaticResource JobFieldForeground}"/> + </Style> + </Grid.Resources> + + <Grid Grid.Row="1"> + + <StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="-60 35 0 0"> + <RadioButton IsChecked="{Binding SourceColor.IsLab,Converter={StaticResource BooleanInverseConverter}}">RGB</RadioButton> + <RadioButton Margin="0 10 0 0" IsChecked="{Binding SourceColor.IsLab}">LAB</RadioButton> + </StackPanel> + + <StackPanel VerticalAlignment="Center"> + <StackPanel Height="20"> + <StackPanel Orientation="Horizontal" Margin="0 0 0 5" Visibility="{Binding IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter}}"> + <materialDesign:PackIcon Kind="Alert" Foreground="{StaticResource RedBrush100}" /> + <TextBlock Margin="5 0 0 0" Foreground="{StaticResource RedBrush100}">Color is out of gamut</TextBlock> + </StackPanel> + </StackPanel> + <Border BorderThickness="1" BorderBrush="#545454" Margin="0" Padding="2 2 2 0"> + <brushPicker:BrushPicker x:Name="picker" Color="{Binding SourceColor.Color,Mode=TwoWay}" Background="Transparent" BorderThickness="0" Height="150" BrushTypeVisibility="Collapsed"></brushPicker:BrushPicker> + </Border> + + <Grid> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="R" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="0" Maximum="255" Width="30" Value="{Binding SourceColor.Red}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding SourceColor.Red,Mode=TwoWay}"></Slider> + </DockPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="G" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="0" Maximum="255" Width="30" Value="{Binding SourceColor.Green}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding SourceColor.Green,Mode=TwoWay}"></Slider> + </DockPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="B" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="0" Maximum="255" Width="30" Value="{Binding SourceColor.Blue}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding SourceColor.Blue,Mode=TwoWay}"></Slider> + </DockPanel> + </StackPanel> + </Setter.Value> + </Setter> + + <Style.Triggers> + <DataTrigger Binding="{Binding SourceColor.IsLab}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="L" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0.00" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="0" Maximum="100" Width="30" Value="{Binding SourceColor.L}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Minimum="0" Maximum="100" Value="{Binding SourceColor.L,Mode=TwoWay}"></Slider> + </DockPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="A" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0.00" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="-128" Maximum="128" Width="30" Value="{Binding SourceColor.A}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Minimum="-128" Maximum="128" Value="{Binding SourceColor.A,Mode=TwoWay}"></Slider> + </DockPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="B" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0.00" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="-128" Maximum="128" Width="30" Value="{Binding SourceColor.B}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Minimum="-128" Maximum="128" Value="{Binding SourceColor.B,Mode=TwoWay}"></Slider> + </DockPanel> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </Grid> + </StackPanel> + </Grid> + + <TextBlock FontStyle="Italic" HorizontalAlignment="Center">SOURCE / INVERSE</TextBlock> + <TextBlock FontStyle="Italic" HorizontalAlignment="Center" Grid.Column="2" Margin="0 0 0 0">SUGGESTIONS</TextBlock> + <TextBlock FontStyle="Italic" HorizontalAlignment="Center" Grid.Column="4" Margin="-80 0 0 0">LIQUID VOLUMES</TextBlock> + + <Image Source="../Images/arrow-long-right.png" Grid.Column="1" Grid.Row="1" Width="120" Stretch="Fill" Height="30" Opacity="0.8" Margin="20 0 20 0"></Image> + + <hive:HexList Width="220" Height="270" UseHexItemHasContainer="True" Grid.Column="2" Grid.Row="1" RowCount="6" ColumnCount="5" ItemsSource="{Binding HiveSuggestions}" SelectedItem="{Binding SelectedSuggestion,Mode=TwoWay}"> + <hive:HexList.ItemContainerStyle> + <Style TargetType="hive:HexItem" BasedOn="{StaticResource {x:Type hive:HexItem}}"> + <Setter Property="Background" Value="{Binding Brush}"></Setter> + <Setter Property="Grid.Column" Value="0"></Setter> + <Setter Property="Grid.Row" Value="0"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=DataContext,Converter={StaticResource ObjectToObjectTypeConverter}}" Value="{x:Type colorConversion:ColorConversionSuggestion}"> + <Setter Property="Grid.Column" Value="{Binding Column}"></Setter> + <Setter Property="Grid.Row" Value="{Binding Row}"></Setter> + <Setter Property="Background" Value="{Binding Brush}"></Setter> + </DataTrigger> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="BorderThickness" Value="2"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </hive:HexList.ItemContainerStyle> + + <hive:HexList.ItemTemplate> + <DataTemplate> + <TextBlock Foreground="{StaticResource WhiteTextBrush}"> + <Run Text="{Binding Row}"></Run><Run>,</Run> + <Run Text="{Binding Column}"/> + </TextBlock> + </DataTemplate> + </hive:HexList.ItemTemplate> + </hive:HexList> + + <TextBlock FontSize="40" Foreground="{StaticResource RedBrush100}" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="2" Grid.Row="1" Text="NO INPUT"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HiveSuggestions.Count}" Value="0"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + + <Image Source="../Images/arrow-long-right.png" Grid.Column="3" Grid.Row="1" Width="120" Stretch="Fill" Height="30" Opacity="0.8" Margin="20 0 20 0"></Image> + + <Grid Grid.Column="4" Grid.Row="1" IsHitTestVisible="False"> + <StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 -20 0 0"> + <StackPanel Orientation="Horizontal" Height="60"> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">R</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"> + <Rectangle.Fill> + <SolidColorBrush Color="Red" Opacity="{Binding SelectedSuggestion.Coordinates.Red,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.Red}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">G</TextBlock> + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"> + <Rectangle.Fill> + <SolidColorBrush Color="Green" Opacity="{Binding SelectedSuggestion.Coordinates.Green,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.Green}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">B</TextBlock> + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"> + <Rectangle.Fill> + <SolidColorBrush Color="Blue" Opacity="{Binding SelectedSuggestion.Coordinates.Blue,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.Blue}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + </StackPanel> + <StackPanel Orientation="Horizontal" Height="40" Margin="0 5 0 0"> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">L</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"/> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.L,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">A</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"/> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.A,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">B</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"/> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.B,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + </StackPanel> + </StackPanel> + + <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center" MinWidth="420" > + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding Name}" FontSize="10" Margin="0 0 0 5"></TextBlock> + <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0"> + <ContentControl.Foreground> + <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </ContentControl.Foreground> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.00" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <!--<mahapps:NumericUpDown.Resources> + <StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource> + </mahapps:NumericUpDown.Resources>--> + </mahapps:NumericUpDown> + </ContentControl> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <Image Source="../Images/arrow-long-down.png" Grid.Column="1" Grid.Row="1" Margin="0 0 10 -170" Height="70" Width="40" Opacity="0.8" Stretch="Fill" HorizontalAlignment="Right" ></Image> + + <TextBlock FontSize="14" FontWeight="SemiBold" FontStyle="Italic" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0 0 0 15"> + <Run>GAMUT REGION:</Run> + <Run Text="{Binding SelectedSuggestion.ProcessParametersTableIndex,Mode=OneWay}"></Run> + </TextBlock> + </Grid> + + + <StackPanel Grid.Column="4" Grid.Row="3"> + <StackPanel Height="25" Margin="25 0 0 0"> + <StackPanel Orientation="Horizontal" Margin="0 0 0 0" Visibility="{Binding IsVolumesOutOfRange,Converter={StaticResource BooleanToVisibilityConverter}}"> + <materialDesign:PackIcon Kind="Alert" Foreground="{StaticResource RedBrush100}" /> + <TextBlock Margin="5 0 0 0" Foreground="{StaticResource RedBrush100}">Liquid volumes exceeds the maximum range</TextBlock> + </StackPanel> + </StackPanel> + + <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center" MinWidth="420" IsEnabled="{Binding IsFree}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding Name}" FontSize="10" Margin="0 0 0 5"></TextBlock> + <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0"> + <ContentControl.Foreground> + <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </ContentControl.Foreground> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.00" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + <!--<mahapps:NumericUpDown.Resources> + <StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource> + </mahapps:NumericUpDown.Resources>--> + </mahapps:NumericUpDown> + </ContentControl> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + + + <Image Source="../Images/arrow-long-Left.png" Grid.Column="2" Grid.Row="3" Width="140" Stretch="Fill" Height="30" Opacity="0.8"></Image> + + <Border BorderBrush="{StaticResource borderBrush}" Grid.Row="3"> + <Grid> + <DockPanel Width="80" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">COMPOSITE</TextBlock> + <Grid> + <Ellipse Height="70" Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"> + <Ellipse.Fill> + <SolidColorBrush Color="{Binding TargetColor.Color}"></SolidColorBrush> + </Ellipse.Fill> + </Ellipse> + <materialDesign:PackIcon Visibility="{Binding IsVolumesOutOfRange,Converter={StaticResource BooleanToVisibilityConverter}}" Kind="Alert" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" Width="24" Height="24" /> + </Grid> + </DockPanel> + + <StackPanel HorizontalAlignment="Right"> + <StackPanel Orientation="Horizontal" Height="60"> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">R</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"> + <Rectangle.Fill> + <SolidColorBrush Color="Red" Opacity="{Binding TargetColor.Red,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding TargetColor.Red}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">G</TextBlock> + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"> + <Rectangle.Fill> + <SolidColorBrush Color="Green" Opacity="{Binding TargetColor.Green,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding TargetColor.Green}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">B</TextBlock> + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"> + <Rectangle.Fill> + <SolidColorBrush Color="Blue" Opacity="{Binding TargetColor.Blue,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding TargetColor.Blue}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + </StackPanel> + <StackPanel Orientation="Horizontal" Height="40" Margin="0 5 0 0"> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">L</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"/> + <TextBlock Text="{Binding TargetColor.L,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource BlackForegroundBrush}"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">A</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"/> + <TextBlock Text="{Binding TargetColor.A,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource BlackForegroundBrush}"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">B</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"/> + <TextBlock Text="{Binding TargetColor.B,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource BlackForegroundBrush}"></TextBlock> + </Grid> + </DockPanel> + </StackPanel> + </StackPanel> + </Grid> + </Border> + </Grid> + + <!--<Grid Margin="80,20,20,20" DockPanel.Dock="Top" x:Name="ColorCalibrationGrid"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="250" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="1*" /> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="20" /> + <RowDefinition /> + <RowDefinition Height="30" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Grid.Resources> + <Style TargetType="TextBlock" > + <Setter Property="Foreground" Value="{StaticResource JobFieldForeground}"/> + </Style> + </Grid.Resources> + + <Grid Grid.Row="1"> + + <StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="-70 15 0 0"> + <RadioButton IsChecked="{Binding SourceColor.IsLab,Converter={StaticResource BooleanInverseConverter}}">RGB</RadioButton> + <RadioButton Margin="0 10 0 0" IsChecked="{Binding SourceColor.IsLab}">LAB</RadioButton> + </StackPanel> + + <StackPanel VerticalAlignment="Center"> + <StackPanel Height="20"> + <StackPanel Orientation="Horizontal" Margin="0 0 0 5" Visibility="{Binding IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter}}"> + <materialDesign:PackIcon Kind="Alert" Foreground="{StaticResource RedBrush100}" /> + <TextBlock Margin="5 0 0 0" Foreground="{StaticResource RedBrush100}">Color is out of gamut</TextBlock> + </StackPanel> + </StackPanel> + <Border BorderThickness="1" BorderBrush="#545454" Margin="0" Padding="2 2 2 0"> + <brushPicker:BrushPicker x:Name="picker" Color="{Binding SourceColor.Color,Mode=TwoWay}" Background="Transparent" BorderThickness="0" Height="150" BrushTypeVisibility="Collapsed"></brushPicker:BrushPicker> + </Border> + + <Grid> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="R" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="0" Maximum="255" Width="30" Value="{Binding SourceColor.Red}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding SourceColor.Red,Mode=TwoWay}"></Slider> + </DockPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="G" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="0" Maximum="255" Width="30" Value="{Binding SourceColor.Green}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding SourceColor.Green,Mode=TwoWay}"></Slider> + </DockPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="B" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="0" Maximum="255" Width="30" Value="{Binding SourceColor.Blue}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding SourceColor.Blue,Mode=TwoWay}"></Slider> + </DockPanel> + </StackPanel> + </Setter.Value> + </Setter> + + <Style.Triggers> + <DataTrigger Binding="{Binding SourceColor.IsLab}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="L" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0.00" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="0" Maximum="100" Width="30" Value="{Binding SourceColor.L}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Minimum="0" Maximum="100" Value="{Binding SourceColor.L,Mode=TwoWay}"></Slider> + </DockPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="A" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0.00" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="-128" Maximum="128" Width="30" Value="{Binding SourceColor.A}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Minimum="-128" Maximum="128" Value="{Binding SourceColor.A,Mode=TwoWay}"></Slider> + </DockPanel> + <DockPanel Margin="0 10 0 0"> + <TextBlock DockPanel.Dock="Left" Text="B" VerticalAlignment="Center" /> + <mahapps:NumericUpDown DockPanel.Dock="Right" HideUpDownButtons="True" StringFormat="0.00" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Center" Minimum="-128" Maximum="128" Width="30" Value="{Binding SourceColor.B}"></mahapps:NumericUpDown> + <Slider Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Minimum="-128" Maximum="128" Value="{Binding SourceColor.B,Mode=TwoWay}"></Slider> + </DockPanel> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </Grid> + </StackPanel> + </Grid> + + <TextBlock FontStyle="Italic" HorizontalAlignment="Center" Grid.Column="0">SOURCE / INVERSE</TextBlock> + <TextBlock FontStyle="Italic" HorizontalAlignment="Center" Grid.Column="2" Margin="0 0 0 0">SUGGESTIONS</TextBlock> + <TextBlock FontStyle="Italic" HorizontalAlignment="Center" Grid.Column="4" Margin="-80 0 0 0">LIQUID VOLUMES</TextBlock> + + <Image Source="../Images/arrow-long-right.png" Grid.Column="1" Grid.Row="1" Width="100" Stretch="Fill" Height="30" Opacity="0.8" Margin="10 0 20 0"></Image> + + <hive:HexList Width="220" Height="270" UseHexItemHasContainer="True" Grid.Column="2" Grid.Row="1" RowCount="6" ColumnCount="5" ItemsSource="{Binding HiveSuggestions}" SelectedItem="{Binding SelectedSuggestion,Mode=TwoWay}"> + <hive:HexList.ItemContainerStyle> + <Style TargetType="hive:HexItem" BasedOn="{StaticResource {x:Type hive:HexItem}}"> + <Setter Property="Background" Value="{Binding Brush}"></Setter> + <Setter Property="Grid.Column" Value="0"></Setter> + <Setter Property="Grid.Row" Value="0"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=DataContext,Converter={StaticResource ObjectToObjectTypeConverter}}" Value="{x:Type colorConversion:ColorConversionSuggestion}"> + <Setter Property="Grid.Column" Value="{Binding Column}"></Setter> + <Setter Property="Grid.Row" Value="{Binding Row}"></Setter> + <Setter Property="Background" Value="{Binding Brush}"></Setter> + </DataTrigger> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="BorderThickness" Value="2"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </hive:HexList.ItemContainerStyle> + + <hive:HexList.ItemTemplate> + <DataTemplate> + <TextBlock Foreground="{StaticResource WhiteTextBrush}"> + <Run Text="{Binding Row}"></Run><Run>,</Run> + <Run Text="{Binding Column}"/> + </TextBlock> + </DataTemplate> + </hive:HexList.ItemTemplate> + </hive:HexList> + + <TextBlock FontSize="40" Foreground="{StaticResource RedBrush100}" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="2" Grid.Row="1" Text="NO INPUT"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HiveSuggestions.Count}" Value="0"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + + <Image Source="../Images/arrow-long-right.png" Grid.Column="3" Grid.Row="1" Width="100" Stretch="Fill" Height="30" Opacity="0.8" Margin="10 0 20 0"></Image> + + <Grid Grid.Column="4" Grid.Row="1" IsHitTestVisible="False"> + <StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 0 0 0"> + <StackPanel Orientation="Horizontal" Height="50"> + <DockPanel Width="40" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">R</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"> + <Rectangle.Fill> + <SolidColorBrush Color="Red" Opacity="{Binding SelectedSuggestion.Coordinates.Red,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.Red}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="40" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">G</TextBlock> + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"> + <Rectangle.Fill> + <SolidColorBrush Color="Green" Opacity="{Binding SelectedSuggestion.Coordinates.Green,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.Green}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="40" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">B</TextBlock> + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"> + <Rectangle.Fill> + <SolidColorBrush Color="Blue" Opacity="{Binding SelectedSuggestion.Coordinates.Blue,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.Blue}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + </StackPanel> + <StackPanel Orientation="Horizontal" Height="40" Margin="0 5 0 0"> + <DockPanel Width="40" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">L</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"/> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.L,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="40" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">A</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"/> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.A,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="40" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">B</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="#202020"/> + <TextBlock Text="{Binding SelectedSuggestion.Coordinates.B,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + </StackPanel> + </StackPanel> + + <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center" MinWidth="320" > + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding Name}" FontSize="10" Margin="0 0 0 5"></TextBlock> + <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0"> + <ContentControl.Foreground> + <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </ContentControl.Foreground> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.00" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + + </mahapps:NumericUpDown> + </ContentControl> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <Image Source="../Images/arrow-long-down.png" Grid.Column="1" Grid.Row="1" Margin="0 0 10 -170" Height="70" Width="40" Opacity="0.8" Stretch="Fill" HorizontalAlignment="Right" ></Image> + + <TextBlock FontSize="14" FontWeight="SemiBold" FontStyle="Italic" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0 0 0 15"> + <Run>GAMUT REGION:</Run> + <Run Text="{Binding SelectedSuggestion.ProcessParametersTableIndex,Mode=OneWay}"></Run> + </TextBlock> + </Grid> + + + <StackPanel Grid.Column="4" Grid.Row="3"> + <StackPanel Height="25" Margin="25 0 0 0"> + <StackPanel Orientation="Horizontal" Margin="0 0 0 0" Visibility="{Binding IsVolumesOutOfRange,Converter={StaticResource BooleanToVisibilityConverter}}"> + <materialDesign:PackIcon Kind="Alert" Foreground="{StaticResource RedBrush100}" /> + <TextBlock Margin="5 0 0 0" Foreground="{StaticResource RedBrush100}">Liquid volumes exceeds the maximum range</TextBlock> + </StackPanel> + </StackPanel> + + <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center" MinWidth="420" IsEnabled="{Binding IsFree}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding Name}" FontSize="10" Margin="0 0 0 5"></TextBlock> + <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0"> + <ContentControl.Foreground> + <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </ContentControl.Foreground> + <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.00" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center"> + + </mahapps:NumericUpDown> + </ContentControl> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + + + <Image Source="../Images/arrow-long-Left.png" Grid.Column="2" Grid.Row="3" Width="120" Stretch="Fill" Height="30" Opacity="0.8"></Image> + + <Border BorderBrush="{StaticResource borderBrush}" Grid.Row="3"> + <Grid> + <DockPanel Width="80" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">COMPOSITE</TextBlock> + <Grid> + <Ellipse Height="70" Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"> + <Ellipse.Fill> + <SolidColorBrush Color="{Binding TargetColor.Color}"></SolidColorBrush> + </Ellipse.Fill> + </Ellipse> + <materialDesign:PackIcon Visibility="{Binding IsVolumesOutOfRange,Converter={StaticResource BooleanToVisibilityConverter}}" Kind="Alert" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" Width="24" Height="24" /> + </Grid> + </DockPanel> + + <StackPanel HorizontalAlignment="Right"> + <StackPanel Orientation="Horizontal" Height="60"> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">R</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"> + <Rectangle.Fill> + <SolidColorBrush Color="Red" Opacity="{Binding TargetColor.Red,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding TargetColor.Red}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">G</TextBlock> + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"> + <Rectangle.Fill> + <SolidColorBrush Color="Green" Opacity="{Binding TargetColor.Green,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding TargetColor.Green}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">B</TextBlock> + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"> + <Rectangle.Fill> + <SolidColorBrush Color="Blue" Opacity="{Binding TargetColor.Blue,Converter={StaticResource ColorComponentToOpacityConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Text="{Binding TargetColor.Blue}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"></TextBlock> + </Grid> + </DockPanel> + </StackPanel> + <StackPanel Orientation="Horizontal" Height="40" Margin="0 5 0 0"> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">L</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"/> + <TextBlock Text="{Binding TargetColor.L,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource BlackForegroundBrush}"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left" Margin="0 0 5 0"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">A</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"/> + <TextBlock Text="{Binding TargetColor.A,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource BlackForegroundBrush}"></TextBlock> + </Grid> + </DockPanel> + <DockPanel Width="50" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">B</TextBlock> + + <Grid> + <Rectangle Margin="0 5 0 0" Stroke="{StaticResource DarkGrayBrush}"/> + <TextBlock Text="{Binding TargetColor.B,StringFormat='0.00'}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource BlackForegroundBrush}"></TextBlock> + </Grid> + </DockPanel> + </StackPanel> + </StackPanel> + </Grid> + </Border> + </Grid>--> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorConversionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorConversionView.xaml.cs new file mode 100644 index 000000000..8b6955269 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ColorConversionView.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 ColorConversionView.xaml + /// </summary> + public partial class ColorConversionView : UserControl + { + public ColorConversionView() + { + InitializeComponent(); + } + } +} 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 new file mode 100644 index 000000000..b85fd2c12 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml @@ -0,0 +1,155 @@ +<UserControl x:Class="Tango.MachineStudio.RML.Views.ProcessParametersView" + 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:global="clr-namespace:Tango.MachineStudio.RML" + 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" + xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" + xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + 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}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + </UserControl.Resources> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="416*"/> + <RowDefinition Height="120"/> + </Grid.RowDefinitions> + <Grid Grid.Row="0"> + <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 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> + </Grid> + </Border> + <Grid> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 20"> + <ItemsControl ItemsSource="{Binding ActiveProcessParametersTableView}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <DockPanel> + <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" VerticalAlignment="Bottom" ToolTip="Remove table" Width="30" Margin="10 0 0 10" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveProcessParametersTableCommand}" CommandParameter="{Binding}"> + <materialDesign:PackIcon Kind="Delete" Width="24" Height="24" Foreground="#FF7D7D" /> + </Button> + + <Grid Style="{StaticResource draggableDroppableGrid}" dragAndDrop:DragAndDropService.Drop="OnProcessTableDropped"> + <Border Padding="5" BorderThickness="1" Margin="20 5 0 5" BorderBrush="{StaticResource DarkGrayBrush}" Background="{StaticResource TransparentBackgroundBrush100}"> + <Grid> + <DockPanel Width="300"> + <TextBox materialDesign:HintAssist.Hint="Table Name" DockPanel.Dock="Top" Text="{Binding Name}"></TextBox> + + <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="5"> + <editors:ParameterizedEditor ParameterizedObject="{Binding}"> + <editors:ParameterizedEditor.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel IsItemsHost="True" /> + </ItemsPanelTemplate> + </editors:ParameterizedEditor.ItemsPanel> + <editors:ParameterizedEditor.DoubleTemplate> + <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> + </DockPanel> + </DataTemplate> + </editors:ParameterizedEditor.DoubleTemplate> + </editors:ParameterizedEditor> + </ScrollViewer> + </DockPanel> + </Grid> + </Border> + + <dragAndDrop:DragThumb Background="Transparent" Cursor="SizeAll" ToolTip="Drag and drop" Margin="0 3 -1 0" HorizontalAlignment="Right" VerticalAlignment="Top"> + <materialDesign:PackIcon HorizontalAlignment="Right" VerticalAlignment="Top" IsHitTestVisible="False" Kind="Drag" Width="32" Height="32" Background="Transparent" /> + </dragAndDrop:DragThumb> + </Grid> + </DockPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + + <dragAndDrop:DraggingSurface x:Name="draggingSurface" ClipToBounds="True" /> + </Grid> + </DockPanel> + </Grid> + <Grid Grid.Row="1"> + <DockPanel> + <Grid> + <Grid Margin="0 0 0 0"> + <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 HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">LIQUID FACTORS</TextBlock> + + <Button ToolTip="Add new liquid factor" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" VerticalAlignment="Bottom" Width="30" Padding="0" Command="{Binding AddLiquidFactorCommand}"> + <materialDesign:PackIcon Kind="Plus" Foreground="#0AC30A" Width="24" Height="24" /> + </Button> + </Grid> + </Border> + <ScrollViewer x:Name="liquidsFactorsScrollViewer" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden" Margin="15 0 20 0"> + <ItemsControl Width="{Binding WidthLilquidFactors, RelativeSource={RelativeSource AncestorType=UserControl}}" ItemsSource="{Binding LiquidTypesRmls}" Margin="0 10 0 0"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid IsItemsHost="True" Rows="1"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> + <Grid Margin="20 0 20 0" MaxWidth="230"> + + <Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Remove liquid factor" Width="30" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveLiquidFactorCommand}" CommandParameter="{Binding}"> + <materialDesign:PackIcon Kind="Delete" Foreground="#FF7D7D" /> + </Button> + + <StackPanel Margin="0 0 10 0"> + <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="{StaticResource MainWindow.Foreground}" Text="{Binding LiquidType.Name}"></TextBlock> + <Grid Width="58" Height="48" Margin="0 5 0 0"> + <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> + <shapes:Hexagon.Fill> + <LinearGradientBrush Opacity="0.7" > + <GradientStop Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Color="White" Offset="1"/> + </LinearGradientBrush> + </shapes:Hexagon.Fill> + </shapes:Hexagon> + + <TextBox Style="{x:Null}" Background="Transparent" Foreground="{StaticResource Hexagon.ForegroundBrush}" BorderThickness="0" Text="{Binding MaxNlPerCm}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontStyle="Italic"></TextBox> + </Grid> + </StackPanel> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </ScrollViewer> + </DockPanel> + </Grid> + </Grid> + </DockPanel> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs new file mode 100644 index 000000000..a6d03ca0e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/ProcessParametersView.xaml.cs @@ -0,0 +1,59 @@ +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; +using Tango.BL.Entities; +using Tango.DragAndDrop; + +namespace Tango.MachineStudio.RML.Views +{ + /// <summary> + /// Interaction logic for ProcessParametersView.xaml + /// </summary> + public partial class ProcessParametersView : UserControl + { + private MainViewVM _vm; + public DraggingSurface DraggingSurface + { + get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } + set { SetValue(DraggingSurfaceProperty, value); } + } + public static readonly DependencyProperty DraggingSurfaceProperty = + DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(ProcessParametersView), new PropertyMetadata(null)); + + public double WidthLilquidFactors + { + get { return (double )GetValue(WidthLilquidFactorsProperty); } + set { SetValue(WidthLilquidFactorsProperty, value); } + } + + // Using a DependencyProperty as the backing store for WidthLilquidFactors. This enables animation, styling, binding, etc... + public static readonly DependencyProperty WidthLilquidFactorsProperty = + DependencyProperty.Register("WidthLilquidFactors", typeof(double ), typeof(ProcessParametersView), new PropertyMetadata(null)); + + + public ProcessParametersView() + { + InitializeComponent(); + DraggingSurface = draggingSurface; + Loaded += (_, __) => { _vm = DataContext as MainViewVM; }; + } + private void OnProcessTableDropped(object sender, DropEventArgs e) + { + ProcessParametersTable dragged = e.Draggable.DataContext as ProcessParametersTable; + ProcessParametersTable dropped = e.Droppable.DataContext as ProcessParametersTable; + _vm.OnProcessParametersTableDropped(dragged, dropped); + } + } +} 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 fa51a6bf5..628b9e402 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 @@ -9,7 +9,6 @@ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" - xmlns:colorLabViews="clr-namespace:Tango.MachineStudio.ColorLab.Views;assembly=Tango.MachineStudio.ColorLab" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" @@ -126,215 +125,94 @@ <Grid Grid.Column="2"> <Grid.RowDefinitions> - <RowDefinition Height="416*"/> - <RowDefinition Height="490"/> + <RowDefinition Height="536*"/> + <RowDefinition Height="370"/> </Grid.RowDefinitions> + <Grid Grid.Row="0" IsEnabled="{Binding IsFree}"> + <TabControl Background="Transparent" Margin="0,-70,0,0" x:Name="processTabControl" Padding="0 25 0 0"> + <TabControl.Resources> + <Style TargetType="TabPanel"> + <Setter Property="HorizontalAlignment" Value="Center"/> + </Style> + <Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="Padding" Value="20,2"></Setter> + </Style> + </TabControl.Resources> + <TabItem Header="PROCESS PARAMETERS" Margin="-100 0 0 0 "> + <local:ProcessParametersView x:Name="processParametersView" WidthLilquidFactors="{Binding ElementName=calibrationDataView,Path=ActualWidth}"/> + </TabItem> + <TabItem Header="COLOR CONVERSION" Margin="-100 0 0 0 "> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"></ColumnDefinition> + <ColumnDefinition Width="260"></ColumnDefinition> + </Grid.ColumnDefinitions> + <local:ColorConversionView x:Name="colorConversionView" Margin="0 0 0 0" Grid.Column="0" DataContext="{Binding ColorConversionViewVM}"/> + <DockPanel Grid.Column="1"> + <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="16 0" Padding="5" CornerRadius="5"> + <Border.Effect> + <DropShadowEffect Opacity="0.4" /> + </Border.Effect> + <Grid> + <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">CCT</TextBlock> + </Grid> + </Border> + <Grid DockPanel.Dock="Top" Background="#35B5B5B5" Margin="20 0"> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <Grid> + <StackPanel Orientation="Vertical" HorizontalAlignment="Left"> + <Image Source="../Images/data-table.png" Height="80" Opacity="0.8" ></Image> + <StackPanel VerticalAlignment="Center" Width="200" Margin="5 20 5 10"> - <Grid> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*" /> - <ColumnDefinition Width="510" /> - </Grid.ColumnDefinitions> - + <ComboBox materialDesign:HintAssist.Hint="No CCT Defined" Margin="0 5 0 0" HorizontalContentAlignment="Center" ItemsSource="{Binding CCTS}" SelectedItem="{Binding SelectedCCT}" DisplayMemberPath="FileName" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> + <UniformGrid Columns="2" Margin="0 5 0 0" HorizontalAlignment="Right"> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Command="{Binding ImportForwardDataCommand}"> + <StackPanel Orientation="Horizontal" Margin="0 0 20 0"> + <materialDesign:PackIcon Kind="Upload" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0">IMPORT</TextBlock> + </StackPanel> + </Button> + <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Command="{Binding ExportForwardDataCommand}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Download" VerticalAlignment="Center" /> + <TextBlock Margin="5 0 0 0">EXPORT</TextBlock> + </StackPanel> + </Button> + </UniformGrid> + </StackPanel> + </StackPanel> + </Grid> + </StackPanel> + </Grid> + </DockPanel> + </Grid> + <!--<local:ColorConversionView x:Name="colorConversionView" />--> + </TabItem> + </TabControl> + </Grid> + <Grid Grid.Row="1"> + <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 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" /> + <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">CALIBRATION DATA</TextBlock> + <Button ToolTip="Create excel file template" FontSize="11" Foreground="{StaticResource DarkGrayBrush200}" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" VerticalAlignment="Bottom" Padding="0" Command="{Binding CreateCalibrationDataExcelTemplateCommand}" Margin="0 0 5 0"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="FileExcel" Foreground="{StaticResource DimGrayBrush}" Width="16" Height="26" /> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0">Create Empty Excel Template</TextBlock> + </StackPanel> </Button> </Grid> </Border> - <Grid> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 20"> - <ItemsControl ItemsSource="{Binding ActiveProcessParametersTableView}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" /> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> - <DockPanel> - <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" VerticalAlignment="Bottom" ToolTip="Remove table" Width="30" Margin="10 0 0 10" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveProcessParametersTableCommand}" CommandParameter="{Binding}"> - <materialDesign:PackIcon Kind="Delete" Width="24" Height="24" Foreground="#FF7D7D" /> - </Button> - <Grid Style="{StaticResource draggableDroppableGrid}" dragAndDrop:DragAndDropService.Drop="OnProcessTableDropped"> - <Border Padding="5" BorderThickness="1" Margin="20 5 0 5" BorderBrush="{StaticResource DarkGrayBrush}" Background="{StaticResource TransparentBackgroundBrush100}"> - <Grid> - <DockPanel Width="300"> - <TextBox materialDesign:HintAssist.Hint="Table Name" DockPanel.Dock="Top" Text="{Binding Name}"></TextBox> - - <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="5"> - <editors:ParameterizedEditor ParameterizedObject="{Binding}"> - <editors:ParameterizedEditor.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel IsItemsHost="True" /> - </ItemsPanelTemplate> - </editors:ParameterizedEditor.ItemsPanel> - <editors:ParameterizedEditor.DoubleTemplate> - <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> - </DockPanel> - </DataTemplate> - </editors:ParameterizedEditor.DoubleTemplate> - </editors:ParameterizedEditor> - </ScrollViewer> - </DockPanel> - </Grid> - </Border> - - <dragAndDrop:DragThumb Background="Transparent" Cursor="SizeAll" ToolTip="Drag and drop" Margin="0 3 -1 0" HorizontalAlignment="Right" VerticalAlignment="Top"> - <materialDesign:PackIcon HorizontalAlignment="Right" VerticalAlignment="Top" IsHitTestVisible="False" Kind="Drag" Width="32" Height="32" Background="Transparent" /> - </dragAndDrop:DragThumb> - </Grid> - </DockPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </StackPanel> - - <dragAndDrop:DraggingSurface x:Name="draggingSurface" ClipToBounds="True" /> - </Grid> - </DockPanel> - - <DockPanel Grid.Column="1"> - <Border DockPanel.Dock="Top" Background="{StaticResource TransparentBackgroundBrush200}" Margin="20 0" Padding="5" CornerRadius="5"> - <Border.Effect> - <DropShadowEffect Opacity="0.4" /> - </Border.Effect> - <Grid> - <TextBlock HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">COLOR CONVERSION TABLE (CCT)</TextBlock> - </Grid> - </Border> - <Grid DockPanel.Dock="Top" Background="#35B5B5B5" Margin="24 0"> - <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> - <Grid> - <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon Kind="ArrowLeftBoldHexagonOutline" VerticalAlignment="Center" Width="40" Height="40" /> - <Image Source="../Images/data-table.png" Height="80" Opacity="0.8"></Image> - <StackPanel VerticalAlignment="Center" Width="300" Margin="10 0 0 0"> - - <ComboBox materialDesign:HintAssist.Hint="No CCT Defined" Margin="0 5 0 0" HorizontalContentAlignment="Center" ItemsSource="{Binding CCTS}" SelectedItem="{Binding SelectedCCT}" DisplayMemberPath="FileName" Style="{StaticResource TransparentComboBoxStyle}"></ComboBox> - <UniformGrid Columns="2" Margin="0 5 0 0" HorizontalAlignment="Right"> - <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Command="{Binding ImportForwardDataCommand}"> - <StackPanel Orientation="Horizontal" Margin="0 0 20 0"> - <materialDesign:PackIcon Kind="Upload" VerticalAlignment="Center" /> - <TextBlock Margin="5 0 0 0">IMPORT</TextBlock> - </StackPanel> - </Button> - <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Command="{Binding ExportForwardDataCommand}"> - <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon Kind="Download" VerticalAlignment="Center" /> - <TextBlock Margin="5 0 0 0">EXPORT</TextBlock> - </StackPanel> - </Button> - </UniformGrid> - </StackPanel> - </StackPanel> - </Grid> - </StackPanel> - </Grid> + <ScrollViewer x:Name="calibrationDataScrollViewer" ScrollChanged="calibrationDataScrollViewer_ScrollChanged" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" Margin="15 0 20 0"> + <local:CalibrationDataView x:Name="calibrationDataView" Margin="0 10 0 0" DataContext="{Binding CalibrationDataViewVM}" /> + </ScrollViewer> </DockPanel> </Grid> - - </Grid> - - - <Grid Grid.Row="1"> - - <DockPanel> - - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="120"/> - <RowDefinition Height="1*"/> - </Grid.RowDefinitions> - <Grid Margin="0 0 0 0"> - <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 HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">LIQUID FACTORS</TextBlock> - - <Button ToolTip="Add new liquid factor" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" VerticalAlignment="Bottom" Width="30" Padding="0" Command="{Binding AddLiquidFactorCommand}"> - <materialDesign:PackIcon Kind="Plus" Foreground="#0AC30A" Width="24" Height="24" /> - </Button> - </Grid> - </Border> - - <ScrollViewer x:Name="liquidsFactorsScrollViewer" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden" Margin="15 0 20 0"> - <ItemsControl Width="{Binding ElementName=calibrationDataView,Path=ActualWidth}" ItemsSource="{Binding LiquidTypesRmls}" Margin="0 10 0 0"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <UniformGrid IsItemsHost="True" Rows="1"></UniformGrid> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> - <Grid Margin="20 0 20 0" MaxWidth="230"> - - <Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Remove liquid factor" Width="30" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveLiquidFactorCommand}" CommandParameter="{Binding}"> - <materialDesign:PackIcon Kind="Delete" Foreground="#FF7D7D" /> - </Button> - - <StackPanel Margin="0 0 10 0"> - <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="{StaticResource MainWindow.Foreground}" Text="{Binding LiquidType.Name}"></TextBlock> - <Grid Width="58" Height="48" Margin="0 5 0 0"> - <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> - <shapes:Hexagon.Fill> - <LinearGradientBrush Opacity="0.7" > - <GradientStop Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> - <GradientStop Color="White" Offset="1"/> - </LinearGradientBrush> - </shapes:Hexagon.Fill> - </shapes:Hexagon> - - <TextBox Style="{x:Null}" Background="Transparent" Foreground="{StaticResource Hexagon.ForegroundBrush}" BorderThickness="0" Text="{Binding MaxNlPerCm}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontStyle="Italic"></TextBox> - </Grid> - </StackPanel> - </Grid> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </ScrollViewer> - </DockPanel> - </Grid> - - <Grid Grid.Row="2"> - <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 HorizontalAlignment="Left" Margin="20 0 0 0" FontSize="16">CALIBRATION DATA</TextBlock> - <Button ToolTip="Create excel file template" FontSize="11" Foreground="{StaticResource DarkGrayBrush200}" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" VerticalAlignment="Bottom" Padding="0" Command="{Binding CreateCalibrationDataExcelTemplateCommand}" Margin="0 0 5 0"> - <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon Kind="FileExcel" Foreground="{StaticResource DimGrayBrush}" Width="16" Height="26" /> - <TextBlock VerticalAlignment="Center" Margin="5 0 0 0">Create Empty Excel Template</TextBlock> - </StackPanel> - </Button> - </Grid> - </Border> - - <ScrollViewer x:Name="calibrationDataScrollViewer" ScrollChanged="calibrationDataScrollViewer_ScrollChanged" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" Margin="15 0 20 0"> - <colorLabViews:CalibrationDataView x:Name="calibrationDataView" Margin="0 10 0 0" DataContext="{Binding CalibrationDataViewVM}" /> - </ScrollViewer> - </DockPanel> - </Grid> - </Grid> - </DockPanel> </Grid> </Grid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs index 2a5d317c6..aa4803bd0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs @@ -25,32 +25,18 @@ namespace Tango.MachineStudio.RML.Views { private MainViewVM _vm; - public DraggingSurface DraggingSurface - { - get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } - set { SetValue(DraggingSurfaceProperty, value); } - } - public static readonly DependencyProperty DraggingSurfaceProperty = - DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(RmlView), new PropertyMetadata(null)); - - public RmlView() { InitializeComponent(); - DraggingSurface = draggingSurface; Loaded += (_, __) => { _vm = DataContext as MainViewVM; }; } - private void OnProcessTableDropped(object sender, DropEventArgs e) - { - ProcessParametersTable dragged = e.Draggable.DataContext as ProcessParametersTable; - ProcessParametersTable dropped = e.Droppable.DataContext as ProcessParametersTable; - _vm.OnProcessParametersTableDropped(dragged, dropped); - } - private void calibrationDataScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) { - liquidsFactorsScrollViewer.ScrollToHorizontalOffset(e.HorizontalOffset); + if(processParametersView.IsVisible) + { + processParametersView.liquidsFactorsScrollViewer.ScrollToHorizontalOffset(e.HorizontalOffset); + } } } } |
