diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-11-13 05:12:21 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-11-13 05:12:21 +0200 |
| commit | 331266b13685e16520ae5baa8a7aff50789c31df (patch) | |
| tree | e41c95c155aecccd43cac6498e4bd70a3e227f5a /Software/Visual_Studio/PPC/Modules | |
| parent | 46978af63f2f683eefb0cadb87c1ce7540b0038d (diff) | |
| download | Tango-331266b13685e16520ae5baa8a7aff50789c31df.tar.gz Tango-331266b13685e16520ae5baa8a7aff50789c31df.zip | |
Inks Extension Support.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
14 files changed, 604 insertions, 517 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml index c60fed143..240abc688 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml @@ -372,7 +372,7 @@ <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" CornerRadius="12" BorderThickness="0" Padding="10" MinHeight="100" Margin="0 10 0 0"> <StackPanel Orientation="Vertical"> <StackPanel Orientation="Horizontal" Height="60" > - <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoButtonFontSize}" Margin="20 0 0 0" >Name: </TextBlock> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoButtonFontSize}" Margin="20 0 0 0" >Name:</TextBlock> <touch:TouchTextBox Width="220" Height="40" FontSize="{StaticResource TangoButtonFontSize}" Margin=" 20 0 10 0" Text="{Binding MyColorName}" FocusSelectionMode="SelectAll"></touch:TouchTextBox> </StackPanel> <Grid Margin="14 10 14 10" > @@ -475,7 +475,7 @@ <!--<TextBlock HorizontalAlignment="Center" Visibility="Collapsed" >HSB</TextBlock>--> <DockPanel HorizontalAlignment="Stretch"> <TextBlock HorizontalAlignment="Center" >LAB</TextBlock> - + </DockPanel> <TextBlock HorizontalAlignment="Center" >RGB</TextBlock> <TextBlock HorizontalAlignment="Center" >CMYK</TextBlock> @@ -493,7 +493,7 @@ </touch:TouchNavigationLinks.Style> </touch:TouchNavigationLinks> - + <Grid Grid.Row="2" x:Name="ColorsGrid" Margin="0,0,0.4,0"> @@ -613,9 +613,35 @@ <ContentControl Name="segmentCMYKContent" Grid.Row="1" ContentTemplate="{StaticResource brushColorPanel}" Content="{Binding}" IsTabStop="False"/> <Grid x:Name="CMYKgrid" Grid.Row="2" Margin="80 0 93 0" Style="{StaticResource DisableOnSaveMyColorsGrid}"> - <touch:TouchColorPickerCMYKControl x:Name="CMYKPicker" ThumbHeight="30" ThumbHeightInside="28" - IsTabStop="False" + <DockPanel> + <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding SelectedBrushStop.LiquidVolumes}" IsTabStop="False" MinWidth="200"> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type models:LiquidVolumeModel}"> + <touch:TouchColorPickerControl Margin=" 0 10 0 0" MinWidth="200" MinValue="0" IsTabStop="False" + ColorPickerText="{Binding IdsPack.LiquidType.Name}" + AutoThumbColor="True" + ThumbHeightInside="28" + ThumbHeight="30" ThumbColor="{StaticResource TangoPrimaryBackgroundColor}" + PreviewTouchDown="LABPicker_PreviewTouchDown" + PreviewMouseDown="LABPicker_OnPreviewMouseDown" + ColorValue="{Binding Volume,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay,StringFormat=0.##}" + MaxValue="{Binding MaxVolume}"> + + <touch:TouchColorPickerControl.PickerBrush> + <LinearGradientBrush ColorInterpolationMode="SRgbLinearInterpolation"> + <GradientStop Color="White" Offset="0.0"></GradientStop> + <GradientStop Color="{Binding IdsPack.LiquidType.LiquidTypeColor}" Offset="1.0"></GradientStop> + </LinearGradientBrush> + </touch:TouchColorPickerControl.PickerBrush> + </touch:TouchColorPickerControl> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <!--<touch:TouchColorPickerCMYKControl DockPanel.Dock="Top" x:Name="CMYKPicker" ThumbHeight="30" ThumbHeightInside="28" + IsTabStop="False" + ThumbColor="{StaticResource TangoPrimaryBackgroundColor}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0 0 0 0" MinWidth="200" @@ -627,7 +653,8 @@ MaxMagentaValue="{Binding MaxMagentaValue, UpdateSourceTrigger=PropertyChanged}" MaxYellowValue="{Binding MaxYellowValue, UpdateSourceTrigger=PropertyChanged}" MaxKeyValue="{Binding MaxBlackValue, UpdateSourceTrigger=PropertyChanged}" - /> + />--> + </DockPanel> </Grid> <ContentControl Grid.Row="1" Grid.RowSpan="2" ContentTemplate="{StaticResource saveMyColorsDlg}" Content="{Binding}" IsTabStop="False"/> <ContentControl Grid.Row="3" ContentTemplate="{StaticResource bottomPanel}" Content="{Binding}" IsTabStop="False"/> @@ -653,7 +680,7 @@ </touch:TouchImageButton> <ContentControl Name="myCatalogsColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}" IsTabStop="False"/> <DockPanel Grid.Row="1" Margin="0 0 20 0"> - <Grid DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="0 0 0 20"> + <Grid DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="0 0 0 20"> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*"/> <ColumnDefinition Width="Auto"/> @@ -724,7 +751,7 @@ <DockPanel VerticalAlignment="Top"> <touch:TouchButton DockPanel.Dock="Right" Height="48" Command="{Binding DataContext.EditColorsLibrariesCommand, ElementName=colorSelectionView}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 0 30 10" Background="Transparent" ShadowDepth="0" ShadowColor="Transparent"> <StackPanel Height="48" Width="160" Orientation="Horizontal" > - <touch:TouchIcon Margin="0 9 0 0" Foreground="{StaticResource TangoBlackInkBrush}" Height="25" Icon="PencilAltSolid" /> + <touch:TouchIcon Margin="0 9 0 0" Foreground="{StaticResource TangoBlackInkBrush}" Height="25" Icon="PencilAltSolid" /> <TextBlock Text="{Binding EditColorButtonName, Mode=TwoWay, TargetNullValue=EDIT}" Height="30" Margin="25 12 0 0" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" VerticalAlignment="Bottom" Foreground="{StaticResource TangoBlackInkBrush}" ></TextBlock> </StackPanel> </touch:TouchButton> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index cc8ddc84e..4ba8a6ebf 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -17,6 +17,7 @@ using Tango.Core.Commands; using Tango.Core.DI; using Tango.Core.Threading; using Tango.PPC.Common; +using Tango.PPC.Common.Connection; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Jobs.ColorCorrectionTool; @@ -63,6 +64,9 @@ namespace Tango.PPC.Jobs.Dialogs [TangoInject] public INotificationProvider NotificationProvider { get; set; } + [TangoInject] + public IMachineProvider MachineProvider { get; set; } + #region Properties private bool _isEditMode; @@ -217,38 +221,6 @@ namespace Tango.PPC.Jobs.Dialogs } } - public double MaxCyanValue - { - get - { - return GetMaxCMYKValueOrDefault(LiquidTypes.Cyan); - } - } - - public double MaxMagentaValue - { - get - { - return GetMaxCMYKValueOrDefault(LiquidTypes.Magenta); - } - } - - public double MaxYellowValue - { - get - { - return GetMaxCMYKValueOrDefault(LiquidTypes.Yellow); - } - } - - public double MaxBlackValue - { - get - { - return GetMaxCMYKValueOrDefault(LiquidTypes.Black); - } - } - public DialogObject DialogEditObject { get; set; } private List<ColorCatalog> _catalogs; @@ -649,6 +621,7 @@ namespace Tango.PPC.Jobs.Dialogs InitColorTab(settings.DefaultTabColorSpace); SelectedCatalog = Catalogs.FirstOrDefault(); } + SelectedBrushStop.ColorCatalogsItemChanged -= OnColorSelectionItemChanged; SelectedBrushStop.ColorCatalogsItemChanged += OnColorSelectionItemChanged; SelectedBrushStop.PreventPropertyUpdate = true; @@ -787,6 +760,7 @@ namespace Tango.PPC.Jobs.Dialogs && SelectedBrushStop.SegmentModel.Job.Rml != null && SelectedBrushStop.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Count > 0) { + var liquidTypesRml = SelectedBrushStop.SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == type); var processParametersTable = SelectedBrushStop.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Single().ProcessParametersTables.OrderBy(y=>y.TableIndex).LastOrDefault(); @@ -803,10 +777,7 @@ namespace Tango.PPC.Jobs.Dialogs private void UpdateVolumesMaxValues() { - RaisePropertyChanged(nameof(MaxCyanValue)); - RaisePropertyChanged(nameof(MaxMagentaValue)); - RaisePropertyChanged(nameof(MaxYellowValue)); - RaisePropertyChanged(nameof(MaxBlackValue)); + SelectedBrushStop.LiquidVolumes.RaiseMaxVolume(); } private void OnLiquidVolumesOutOfRangeChanged(object sender, EventArgs e) @@ -1017,10 +988,10 @@ namespace Tango.PPC.Jobs.Dialogs newcolor.Red = SelectedBrushStop.Red; newcolor.Green = SelectedBrushStop.Green; newcolor.Blue = SelectedBrushStop.Blue; - newcolor.Cyan = SelectedBrushStop.Cyan; - newcolor.Magenta = SelectedBrushStop.Magenta; - newcolor.Yellow = SelectedBrushStop.Yellow; - newcolor.Black = SelectedBrushStop.Black; + newcolor.Cyan = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume; + newcolor.Magenta = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume; + newcolor.Yellow = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume; + newcolor.Black = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume; newcolor.L = SelectedBrushStop.L; newcolor.A = SelectedBrushStop.A; newcolor.B = SelectedBrushStop.B; @@ -1341,10 +1312,12 @@ namespace Tango.PPC.Jobs.Dialogs if(VectorFineTuningDialogVM.SelectedLog != null ) { _selectedBrushStop.PreventPropertyUpdate = true; - _selectedBrushStop.Cyan = VectorFineTuningDialogVM.SelectedLog.C; - _selectedBrushStop.Magenta = VectorFineTuningDialogVM.SelectedLog.M; - _selectedBrushStop.Yellow = VectorFineTuningDialogVM.SelectedLog.Y; - _selectedBrushStop.Black = VectorFineTuningDialogVM.SelectedLog.K; + + _selectedBrushStop.LiquidVolumes.ResetVolume(); + _selectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = VectorFineTuningDialogVM.SelectedLog.C; + _selectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = VectorFineTuningDialogVM.SelectedLog.M; + _selectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = VectorFineTuningDialogVM.SelectedLog.Y; + _selectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = VectorFineTuningDialogVM.SelectedLog.K; _selectedBrushStop.L = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionL; _selectedBrushStop.A = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionA; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs index e6094d0d7..183ce0185 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs @@ -808,10 +808,11 @@ namespace Tango.PPC.Jobs.Dialogs TargetA = BrushStopModel.ColorCatalogsItem.A; TargetB = BrushStopModel.ColorCatalogsItem.B; BrushStopModel.PreventPropertyUpdate = true; - BrushStopModel.Cyan = brushstop.ColorCatalogsItem.Cyan; - BrushStopModel.Magenta = brushstop.ColorCatalogsItem.Magenta; - BrushStopModel.Yellow = brushstop.ColorCatalogsItem.Yellow; - BrushStopModel.Black = brushstop.ColorCatalogsItem.Black; + BrushStopModel.LiquidVolumes.ResetVolume(); + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = brushstop.ColorCatalogsItem.Cyan; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = brushstop.ColorCatalogsItem.Magenta; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = brushstop.ColorCatalogsItem.Yellow; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = brushstop.ColorCatalogsItem.Black; BrushStopModel.PreventPropertyUpdate = false; IsOnlyManual = false; } @@ -834,10 +835,11 @@ namespace Tango.PPC.Jobs.Dialogs TargetB = brushstop.B; TargetA = brushstop.A; BrushStopModel.ConvertColorToVolume(); - if (BrushStopModel.Black > 0 && BrushStopModel.Black < 0.5) + var blackVolume = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black); + if (blackVolume.Volume > 0 && blackVolume.Volume < 0.5) { BrushStopModel.PreventPropertyUpdate = true; - BrushStopModel.Black = 0; + blackVolume.Volume = 0; BrushStopModel.PreventPropertyUpdate = false; } BrushStopModel.ColorSpace = ColorSpaces.LAB; @@ -846,10 +848,10 @@ namespace Tango.PPC.Jobs.Dialogs _sessionID = BrushStopModel.Guid + $"{TargetL}{TargetA}{TargetB}"; - Cyan = BrushStopModel.Cyan; - Magenta = BrushStopModel.Magenta; - Yellow = BrushStopModel.Yellow; - Black = BrushStopModel.Black; + Cyan = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume; + Magenta = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume; + Yellow = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume; + Black = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume; MeasuredL = MeasuredB = MeasuredA = null; TestColor = null; @@ -1146,11 +1148,11 @@ namespace Tango.PPC.Jobs.Dialogs // SaveTest(GetExcelDataItems(SelectedLog, true)); BrushStopModel.PreventPropertyUpdate = true; - BrushStopModel.Cyan = SelectedLog.C; - BrushStopModel.Magenta = SelectedLog.M; - BrushStopModel.Yellow = SelectedLog.Y; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = SelectedLog.C; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = SelectedLog.M; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = SelectedLog.Y; BrushStopModel.PreventPropertyUpdate = false; - BrushStopModel.Black = SelectedLog.K; + BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = SelectedLog.K; BrushStopModel.PreventPropertyUpdate = true; BrushStopModel.L = SelectedLog.SuggestionL; @@ -1509,10 +1511,7 @@ namespace Tango.PPC.Jobs.Dialogs stop.A = BrushStopModel.A; stop.B = BrushStopModel.B; - stop.SetVolume(LiquidTypes.Cyan, BrushStopModel.Cyan); - stop.SetVolume(LiquidTypes.Magenta, BrushStopModel.Magenta); - stop.SetVolume(LiquidTypes.Yellow, BrushStopModel.Yellow); - stop.SetVolume(LiquidTypes.Black, BrushStopModel.Black); + BrushStopModel.LiquidVolumes.SetVolumesOnBrushStop(stop); segment.BrushStops.Add(stop); @@ -1685,10 +1684,10 @@ namespace Tango.PPC.Jobs.Dialogs private void UpdateOnEndJob() { ActiveLogModel.IsTested = true; - Cyan = BrushStopModel.Cyan; - Magenta = BrushStopModel.Magenta; - Yellow = BrushStopModel.Yellow; - Black = BrushStopModel.Black; + Cyan = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = Cyan; + Magenta = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = Magenta; + Yellow = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = Yellow; + Black = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = Black; if (ActiveLogModel != null && TrialsLogitems.Count <= 10) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index 5c0d9145a..7f8c7d6b5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -46,125 +46,6 @@ namespace Tango.PPC.Jobs.Models [JsonIgnore] public bool PreventPropertyUpdate { get; set; } - protected Double _cyan; - - /// <summary> - /// Gets or sets the BrushStopModel cyan. - /// </summary> - public Double Cyan - { - get - { - return _cyan; - } - - set - { - if (_cyan != value) - { - _cyan = value; - RaisePropertyChangedAuto(); - OnVolumeChanged(); - } - } - } - - protected Double _magenta; - - /// <summary> - /// Gets or sets the BrushStopModel magenta. - /// </summary> - - public Double Magenta - { - get - { - return _magenta; - } - - set - { - if (_magenta != value) - { - _magenta = value; - RaisePropertyChangedAuto(); - OnVolumeChanged(); - } - } - } - - protected Double _yellow; - - /// <summary> - /// Gets or sets the BrushStopModel yellow. - /// </summary> - - public Double Yellow - { - get - { - return _yellow; - } - - set - { - if (_yellow != value) - { - _yellow = value; - RaisePropertyChangedAuto(); - OnVolumeChanged(); - } - } - } - - protected Double _black; - - /// <summary> - /// Gets or sets the BrushStopModel black. - /// </summary> - public Double Black - { - get - { - return _black; - } - - set - { - if (_black != value) - { - _black = value; - RaisePropertyChangedAuto(); - OnVolumeChanged(); - } - } - } - - protected Double _violet; - - /// <summary> - /// Gets or sets the BrushStopModel violet. - /// </summary> - public Double Violet - { - get - { - return _violet; - } - - set - { - if (Violet != value) - { - _violet = value; - RaisePropertyChangedAuto(); - OnVolumeChanged(); - } - } - } - - - protected Int32 _red; /// <summary> @@ -660,7 +541,7 @@ namespace Tango.PPC.Jobs.Models { if (RequiredMaxLiquidTest && (ColorSpace == ColorSpaces.Volume || ColorSpace == ColorSpaces.CMYK)) { - var sum = GetColorNLPerCm(Cyan, LiquidTypes.Cyan) + GetColorNLPerCm(Magenta, LiquidTypes.Magenta) + GetColorNLPerCm(Yellow, LiquidTypes.Yellow) + GetColorNLPerCm(Black, LiquidTypes.Black) + GetColorNLPerCm(Violet, LiquidTypes.Violet); + var sum = LiquidVolumes.GetMaxNanoliterPerCM(); var maxLiq = GetTotalMaximumLiquidNlPerCMLimit(); LiquidVolumesOutOfRange = sum > GetTotalMaximumLiquidNlPerCMLimit(); @@ -692,41 +573,17 @@ namespace Tango.PPC.Jobs.Models { if (ColorSpace == ColorSpaces.Volume || ColorSpace == ColorSpaces.CMYK) { - var minCyan = GetMinLimitLiquid(LiquidTypes.Cyan); - if (Cyan > 0 && Cyan < minCyan) + foreach (var liquidVolume in LiquidVolumes) { - LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{Cyan} Cyan should be > {minCyan.ToString("N3")}"; - return LiquidVolumeBelowMinLimit; - } - var minMagenta = GetMinLimitLiquid(LiquidTypes.Magenta); - if (Magenta > 0 && Magenta < minMagenta) - { - LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{Magenta} Magenta should be > {minMagenta.ToString("N3")}"; - return LiquidVolumeBelowMinLimit; - } - var minYellow = GetMinLimitLiquid(LiquidTypes.Yellow); - if (Yellow > 0 && Yellow < minYellow) - { - LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{Yellow} Yellow should be > {minYellow.ToString("N3")}"; - return LiquidVolumeBelowMinLimit; - } - var minBlack = GetMinLimitLiquid(LiquidTypes.Black); - if (Black > 0 && Black < minBlack) - { - LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{Black} Black should be > {minBlack.ToString("N3")}"; - return LiquidVolumeBelowMinLimit; - } - var minViolet = GetMinLimitLiquid(LiquidTypes.Violet); - if (Violet > 0 && Violet < minViolet) - { - LiquidVolumeBelowMinLimit = true; - LiquidVolumeBelowMinLimitmessage = $"{Violet} Violet should be > {minViolet.ToString("N3")}"; - return LiquidVolumeBelowMinLimit; + var min = liquidVolume.GetMinLimit(); + if (liquidVolume.Volume > 0 && liquidVolume.Volume < min) + { + LiquidVolumeBelowMinLimit = true; + LiquidVolumeBelowMinLimitmessage = $"{liquidVolume.IdsPack.LiquidType.Name} Cyan should be > {min.ToString("N3")}"; + return LiquidVolumeBelowMinLimit; + } } + LiquidVolumeBelowMinLimit = false; LiquidVolumeBelowMinLimitmessage = ""; return false; @@ -772,19 +629,19 @@ namespace Tango.PPC.Jobs.Models public Double ABeforeChange { get; set; } [JsonIgnore] public Double BBeforeChange { get; set; } + [JsonIgnore] - public Double CyanBeforeChange { get; set; } - [JsonIgnore] - public Double MagentaBeforeChange { get; set; } - [JsonIgnore] - public Double YellowBeforeChange { get; set; } - [JsonIgnore] - public Double BlackBeforeChange { get; set; } - [JsonIgnore] - public Double VioletBeforeChange { get; set; } + public BrushStop BrushStop { get; set; } public bool FineTuningChanged { get; set; } + private LiquidVolumesCollection _liquidVolums; + public LiquidVolumesCollection LiquidVolumes + { + get { return _liquidVolums; } + set { _liquidVolums = value; RaisePropertyChangedAuto(); } + } + #endregion #region constructors @@ -794,13 +651,18 @@ namespace Tango.PPC.Jobs.Models Guid = System.Guid.NewGuid().ToString(); TangoIOC.Default.Inject(this); + + LiquidVolumes = new LiquidVolumesCollection(); } public BrushStopModel(SegmentModel segmentModel) : this() { - InitDefaultValues(); SegmentModel = segmentModel; + InitLiquidVolumes(); + + InitDefaultValues(); + Color = Colors.White; var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); ColorSpace = settings.DefaultTabColorSpace == null ? ColorSpaces.Volume : (ColorSpaces)settings.DefaultTabColorSpace; @@ -815,9 +677,13 @@ namespace Tango.PPC.Jobs.Models public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel, int version) : this() { + SegmentModel = segmentModel; + BrushStop = brushStop; + + InitLiquidVolumes(); + InitDefaultValues(); Guid = brushStop.Guid; - SegmentModel = segmentModel; OffsetPercent = brushStop.OffsetPercent; Color = brushStop.Color; BestMatchColor = brushStop.Color; @@ -829,33 +695,9 @@ namespace Tango.PPC.Jobs.Models _stopindex = brushStop.StopIndex; PreventPropertyUpdate = true; - if (version < 2)//loaded from MS - { - if (brushStop.ColorSpace.Space == ColorSpaces.CMYK) - { - Cyan = brushStop.Cyan * 100; - Magenta = brushStop.Magenta * 100; - Yellow = brushStop.Yellow * 100; - Black = brushStop.Black * 100; - Violet = brushStop.Violet * 100; - } - else - { - Cyan = brushStop.GetVolume(LiquidTypes.Cyan); - Magenta = brushStop.GetVolume(LiquidTypes.Magenta); - Yellow = brushStop.GetVolume(LiquidTypes.Yellow); - Black = brushStop.GetVolume(LiquidTypes.Black); - Violet = brushStop.GetVolume(LiquidTypes.Violet); - } - } - else - { - Cyan = brushStop.Cyan; - Magenta = brushStop.Magenta; - Yellow = brushStop.Yellow; - Black = brushStop.Black; - Violet = brushStop.Violet; - } + + LiquidVolumes.SetVolumesFromBrushStop(brushStop); + Red = brushStop.Red; Green = brushStop.Green; Blue = brushStop.Blue; @@ -869,6 +711,25 @@ namespace Tango.PPC.Jobs.Models LiquidVolumesOutOfRange = false; } + public void InitLiquidVolumes() + { + LiquidVolumes.Clear(); + + var supportedIdsPacks = SegmentModel.Job.Machine.Configuration.GetSupportedIdsPacks(SegmentModel.Job.Rml).Where(x => x.LiquidType.HasPigment && x.LiquidType.AvailableForStandardUser).OrderBy(x => x.LiquidType.PreferredIndex).ToList(); + + foreach (var idsPack in supportedIdsPacks) + { + var liquidVolume = new LiquidVolumeModel(this, idsPack); + liquidVolume.VolumeChanged += (x, e) => OnVolumeChanged(); + LiquidVolumes.Add(liquidVolume); + } + + if (BrushStop != null) + { + LiquidVolumes.SetVolumesFromBrushStopSilent(BrushStop); + } + } + private void InitDefaultValues() { _hue = 0; @@ -880,7 +741,7 @@ namespace Tango.PPC.Jobs.Models _bestMatchL = 100; _bestMatchA = _bestMatchB = 0; _red = _green = _blue = 255; - _cyan = _magenta = _yellow = _black = _violet = 0; + LiquidVolumes.ResetVolumeSilent(); StopIndex = 1; Position = PositionStatus.FirstColor; IsOutOfGamut = false; @@ -925,11 +786,8 @@ namespace Tango.PPC.Jobs.Models BestMatchA = newBrushStop.BestMatchA; BestMatchB = newBrushStop.BestMatchB; - Cyan = newBrushStop.Cyan; - Magenta = newBrushStop.Magenta; - Yellow = newBrushStop.Yellow; - Black = newBrushStop.Black; - Violet = newBrushStop.Violet; + LiquidVolumes.SetVolumesFromBrushStop(newBrushStop); + ColorCatalogsItem = newBrushStop.ColorCatalogsItem; PreventPropertyUpdate = false; @@ -954,11 +812,10 @@ namespace Tango.PPC.Jobs.Models if (s.ColorSpace.Space == ColorSpaces.Volume) { - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Cyan.ToInt32()).PackIndex, Cyan); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Magenta.ToInt32()).PackIndex, Magenta); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Yellow.ToInt32()).PackIndex, Yellow); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Black.ToInt32()).PackIndex, Black); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Violet.ToInt32()).PackIndex, Violet); + foreach (var liquidVolume in LiquidVolumes) + { + s.SetVolume(liquidVolume.IdsPack.PackIndex, liquidVolume.Volume); + } } else if (s.ColorSpace.Space == ColorSpaces.LAB) { @@ -1023,11 +880,7 @@ namespace Tango.PPC.Jobs.Models cloned.BestMatchL = BestMatchL; cloned.BestMatchA = BestMatchA; cloned.BestMatchB = BestMatchB; - cloned.Cyan = Cyan; - cloned.Magenta = Magenta; - cloned.Yellow = Yellow; - cloned.Black = Black; - cloned.Violet = Violet; + cloned.LiquidVolumes.SetVolumesFromBrushStop(this); cloned.Hue = Hue; cloned.Saturation = Saturation; cloned.Brightness = Brightness; @@ -1072,11 +925,13 @@ namespace Tango.PPC.Jobs.Models PreventPropertyUpdate = true; - Cyan = favoriteColor.Cyan; - Magenta = favoriteColor.Magenta; - Yellow = favoriteColor.Yellow; - Black = favoriteColor.Black; - Violet = favoriteColor.Violet; + + LiquidVolumes.ResetVolume(); + LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = favoriteColor.Cyan; + LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = favoriteColor.Magenta; + LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = favoriteColor.Yellow; + LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = favoriteColor.Black; + Red = favoriteColor.Red; Green = favoriteColor.Green; @@ -1116,11 +971,7 @@ namespace Tango.PPC.Jobs.Models s.ColorCatalog = ColorCatalog; s.ColorCatalogsItem = ColorCatalogsItem; - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Cyan.ToInt32()).PackIndex, Cyan); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Magenta.ToInt32()).PackIndex, Magenta); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Yellow.ToInt32()).PackIndex, Yellow); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Black.ToInt32()).PackIndex, Black); - s.SetVolume(configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Code == LiquidTypes.Violet.ToInt32()).PackIndex, Violet); + LiquidVolumes.SetVolumesOnBrushStop(s); s.L = this.L; s.A = this.A; @@ -1147,12 +998,8 @@ namespace Tango.PPC.Jobs.Models else if (ColorSpace == ColorSpaces.Volume) { PreventPropertyUpdate = true; - Cyan = CyanBeforeChange; - Magenta = MagentaBeforeChange; - Yellow = YellowBeforeChange; - Violet = VioletBeforeChange; + LiquidVolumes.Undo(); PreventPropertyUpdate = false; - Black = BlackBeforeChange; } } @@ -1167,11 +1014,7 @@ namespace Tango.PPC.Jobs.Models } else if (ColorSpace == ColorSpaces.Volume) { - CyanBeforeChange = Cyan; - MagentaBeforeChange = Magenta; - YellowBeforeChange = Yellow; - BlackBeforeChange = Black; - VioletBeforeChange = Violet; + LiquidVolumes.SaveState(); } } @@ -1495,16 +1338,12 @@ namespace Tango.PPC.Jobs.Models { if (ColorCatalogsItem != null) { - _cyan = ColorCatalogsItem.Cyan; - _magenta = ColorCatalogsItem.Magenta; - _yellow = ColorCatalogsItem.Yellow; - _black = ColorCatalogsItem.Black; - _violet = 0; - RaisePropertyChanged(nameof(Cyan)); - RaisePropertyChanged(nameof(Yellow)); - RaisePropertyChanged(nameof(Magenta)); - RaisePropertyChanged(nameof(Black)); - RaisePropertyChanged(nameof(Violet)); + LiquidVolumes.ResetVolumeSilent(); + LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).SetVolumeSilent(ColorCatalogsItem.Cyan); + LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).SetVolumeSilent(ColorCatalogsItem.Magenta); + LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).SetVolumeSilent(ColorCatalogsItem.Yellow); + LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).SetVolumeSilent(ColorCatalogsItem.Black); + LiquidVolumes.RaiseVolume(); IsOutOfGamut = false; // RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); // RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); @@ -1531,11 +1370,11 @@ namespace Tango.PPC.Jobs.Models IsBusy = true; var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false); - _cyan = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume); - _yellow = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow).Volume); - _magenta = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta).Volume); - _black = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black).Volume); - _violet = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Violet).Volume); + foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) + { + LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType).SetVolumeSilent(outputLiquid.Volume); + } + IsOutOfGamut = false; //if ( LastChangedColorSpace != ColorSpaces.RGB) //{ @@ -1545,11 +1384,7 @@ namespace Tango.PPC.Jobs.Models // InitColor(); // BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); //} - RaisePropertyChanged(nameof(Cyan)); - RaisePropertyChanged(nameof(Yellow)); - RaisePropertyChanged(nameof(Magenta)); - RaisePropertyChanged(nameof(Black)); - RaisePropertyChanged(nameof(Violet)); + LiquidVolumes.RaiseVolume(); RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); RaisePropertyChanged(nameof(IsLiquidVolumeBelowMinLimit)); } @@ -1604,15 +1439,21 @@ namespace Tango.PPC.Jobs.Models IsBusy = true; var output = _converter.Convert(stop, SegmentModel.Job.Machine.Configuration, SegmentModel.Job.Rml, false, false, false, ConversionType.FineTuning); - _cyan = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume); - _yellow = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow).Volume); - _magenta = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta).Volume); - _black = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black).Volume); - _violet = (output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Violet).Volume); - if (_black > 0 && _black < 0.5)//bug 7959 0.001 < K% < 0.5 ==> reset the K to 0. + var b = output.SingleCoordinates.OutputLiquids.FirstOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Black); + + if (b != null) { - _black = 0; + if (b.Volume > 0 && b.Volume < 0.5)//bug 7959 0.001 < K% < 0.5 ==> reset the K to 0. + { + b.Volume = 0; + } } + + foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) + { + LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType).SetVolumeSilent(outputLiquid.Volume); + } + IsOutOfGamut = output.OutOfGamut; if (IsOutOfGamut) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumeModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumeModel.cs new file mode 100644 index 000000000..d36a8f297 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumeModel.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Dispensing; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core; + +namespace Tango.PPC.Jobs.Models +{ + public class LiquidVolumeModel : ExtendedObject + { + public event EventHandler<LiquidVolumeModel> VolumeChanged; + + public BrushStopModel BrushStopModel { get; set; } + + private double _volume; + public double Volume + { + get { return _volume; } + set + { + if (_volume != value) + { + _volume = value; + RaisePropertyChangedAuto(); + VolumeChanged?.Invoke(this, this); + } + } + } + + public void SetVolumeSilent(double volume) + { + _volume = volume; + } + + private IdsPack _idsPack; + public IdsPack IdsPack + { + get { return _idsPack; } + set { _idsPack = value; RaisePropertyChangedAuto(); } + } + + public double MaxVolume + { + get { return GetMaxCMYKValueOrDefault(); } + } + + public double VolumeBeforeChange { get; set; } + + public void RaiseMaxVolume() + { + RaisePropertyChanged(nameof(MaxVolume)); + } + + public void SaveState() + { + VolumeBeforeChange = Volume; + } + + public void RaiseVolume() + { + RaisePropertyChanged(nameof(Volume)); + } + + public LiquidVolumeModel(BrushStopModel brushStopModel, IdsPack idsPack) + { + BrushStopModel = brushStopModel; + IdsPack = idsPack; + } + + public void Undo() + { + Volume = VolumeBeforeChange; + VolumeBeforeChange = Volume; + } + + private double GetMaxCMYKValueOrDefault() + { + if (BrushStopModel != null && BrushStopModel.SegmentModel != null + && BrushStopModel.SegmentModel.Job != null + && BrushStopModel.SegmentModel.Job.Rml != null + && BrushStopModel.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Count > 0) + { + + var liquidTypesRml = BrushStopModel.SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == IdsPack.LiquidType.Type); + var processParametersTable = BrushStopModel.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Single().ProcessParametersTables.OrderBy(y => y.TableIndex).LastOrDefault(); + + if (liquidTypesRml != null && processParametersTable != null && liquidTypesRml.MaxNlPerCm != 0) + { + return (processParametersTable.MaxInkUptake / (liquidTypesRml.MaxNlPerCm) * 100); + } + + } + return 100; + } + + public double GetColorNLPerCm() + { + StandardColorDispensingCalc calc = new StandardColorDispensingCalc(); + + Rml rml = BrushStopModel.SegmentModel.Job.Rml; + LiquidTypesRml liquidType = rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == IdsPack.LiquidType.Type); + if (liquidType != null) + { + double maxNlPerCm = liquidType.MaxNlPerCm; + return calc.CalculateNanoliterPerCentimeter(Volume, maxNlPerCm); + } + return 0.0; + } + + public double GetMinLimit() + { + try + { + var tables = BrushStopModel.SegmentModel.Job.Rml.GetActiveProcessGroup().ProcessParametersTables.OrderBy(x => x.TableIndex).ToList(); + + LiquidTypesRml liquidType = BrushStopModel.SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == IdsPack.LiquidType.Type); + + if (tables.Count > 0 && liquidType != null && liquidType.MaxNlPerCm != 0) + { + var vmax = Math.Max(BrushStopModel.SegmentModel.Job.Rml.VMax / 10d, 0); + + if (IdsPack.LiquidType.Type == LiquidTypes.Black) + { + vmax = Math.Max(BrushStopModel.SegmentModel.Job.Rml.VMax, 0); + } + + return (vmax * tables[0].MinInkUptake) / liquidType.MaxNlPerCm; + } + else + { + return 0; + } + } + catch + { + return 0; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumesCollection.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumesCollection.cs new file mode 100644 index 000000000..704fc36b0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/LiquidVolumesCollection.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.BL.Enumerations; + +namespace Tango.PPC.Jobs.Models +{ + public class LiquidVolumesCollection : ObservableCollection<LiquidVolumeModel> + { + + public void RaiseMaxVolume() + { + this.ToList().ForEach(x => x.RaiseMaxVolume()); + } + + public void RaiseVolume() + { + this.ToList().ForEach(x => x.RaiseVolume()); + } + + public void ResetVolume() + { + this.ToList().ForEach(x => x.Volume = 0); + } + + public void ResetVolumeSilent() + { + this.ToList().ForEach(x => x.SetVolumeSilent(0)); + } + + public LiquidVolumeModel GetLiquidVolume(LiquidTypes type) + { + return this.FirstOrDefault(x => x.IdsPack.LiquidType.Type == type); + } + + public LiquidVolumeModel GetLiquidVolume(PMR.ColorLab.LiquidType type) + { + return this.FirstOrDefault(x => x.IdsPack.LiquidType.Type == (LiquidTypes)type); + } + + public void Undo() + { + this.ToList().ForEach(x => x.Undo()); + } + + public void SaveState() + { + this.ToList().ForEach(x => x.SaveState()); + } + + public double GetMaxNanoliterPerCM() + { + return this.Sum(x => x.GetColorNLPerCm()); + } + + public void SetVolumesFromBrushStop(BrushStop stop) + { + foreach (var model in this) + { + model.Volume = 0; + try + { + var stopVolume = stop.GetVolume(model.IdsPack.PackIndex); + model.Volume = stopVolume; + } + catch + { + Debug.WriteLine($"No volume found for {model.IdsPack.LiquidType.Name} at index {model.IdsPack.PackIndex}"); + } + } + } + + public void SetVolumesFromBrushStopSilent(BrushStop stop) + { + foreach (var model in this) + { + model.SetVolumeSilent(0); + try + { + var stopVolume = stop.GetVolume(model.IdsPack.PackIndex); + model.SetVolumeSilent(stopVolume); + } + catch + { + Debug.WriteLine($"No volume found for {model.IdsPack.LiquidType.Name} at index {model.IdsPack.PackIndex}"); + } + } + } + + public void SetVolumesFromBrushStop(BrushStopModel brushStop) + { + foreach (var model in this) + { + model.Volume = 0; + var b = brushStop.LiquidVolumes.GetLiquidVolume(model.IdsPack.LiquidType.Type); + if (b != null) + { + model.Volume = b.Volume; + } + } + } + + public void SetVolumesOnBrushStop(BrushStop brushStop) + { + foreach (var model in this) + { + try + { + brushStop.SetVolume(model.IdsPack.PackIndex, model.Volume); + } + catch + { + Debug.WriteLine($"Could not set brush stop volume for {model.IdsPack.LiquidType.Name} at index {model.IdsPack.PackIndex}"); + } + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs index fb4932a2e..bfc7d2234 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs @@ -28,7 +28,7 @@ namespace Tango.PPC.Jobs.Models #region Properties public string GUID { get; set; } - + protected String _name; /// <summary> /// Gets or sets the SegmentModel name. @@ -85,7 +85,7 @@ namespace Tango.PPC.Jobs.Models return SegmentsGroupModel != null; } } - + public void LengthBeforeChange(double value) { _lastLength = Length; @@ -104,7 +104,7 @@ namespace Tango.PPC.Jobs.Models get { return _weight; } set { - if(_weight != value) + if (_weight != value) { _weight = value; OnWeightChanged(); @@ -139,8 +139,11 @@ namespace Tango.PPC.Jobs.Models public bool IsInterSegment { get { return _isInterSegment; } - set { _isInterSegment = value; - RaisePropertyChangedAuto(); } + set + { + _isInterSegment = value; + RaisePropertyChangedAuto(); + } } protected Boolean _enableintersegment; @@ -153,7 +156,7 @@ namespace Tango.PPC.Jobs.Models { _enableintersegment = value; RaisePropertyChangedAuto(); - + } RaisePropertyChanged(nameof(LengthWithInterSegment)); RaisePropertyChanged(nameof(InterSegmentLength)); @@ -200,7 +203,7 @@ namespace Tango.PPC.Jobs.Models /// Gets or sets the segmentbase brush stops. /// </summary> - public SynchronizedObservableCollection<BrushStopModel> BrushStops + public SynchronizedObservableCollection<BrushStopModel> BrushStops { get { @@ -247,11 +250,12 @@ namespace Tango.PPC.Jobs.Models [JsonIgnore] public bool IsOffsetChanged { get; set; } - + public double LeftOffset { - get { return FirstBrushStop != null? FirstBrushStop.OffsetPercent : 0; } - set { + get { return FirstBrushStop != null ? FirstBrushStop.OffsetPercent : 0; } + set + { if (FirstBrushStop != null && FirstBrushStop.OffsetPercent != value) { FirstBrushStop.OffsetPercent = value; @@ -270,13 +274,14 @@ namespace Tango.PPC.Jobs.Models public double LeftOffsetChangeComleted { get { return _leftOffsetChangeComleted; } - set { - if(_leftOffsetChangeComleted != value) + set + { + if (_leftOffsetChangeComleted != value) { _leftOffsetChangeComleted = value; RaisePropertyChangedAuto(); UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeOffsetCommand(this, LeftOffsetStartChanging, _leftOffsetChangeComleted, OffsetType.Left)); - + } } } @@ -297,12 +302,13 @@ namespace Tango.PPC.Jobs.Models public double MiddleOffset { get { return (MiddleBrushStop != null) ? MiddleBrushStop.OffsetPercent : 50; } - set { - + set + { + if (MiddleBrushStop != null && MiddleBrushStop.OffsetPercent != value) { MiddleBrushStop.OffsetPercent = value; - RaisePropertyChangedAuto(); + RaisePropertyChangedAuto(); IsOffsetChanged = true; RaisePropertyChanged(nameof(SegmentBrush)); RaisePropertyChanged(nameof(MiddleOffsetLabel)); @@ -324,7 +330,7 @@ namespace Tango.PPC.Jobs.Models _middleOffsetChangeComleted = value; RaisePropertyChangedAuto(); UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeOffsetCommand(this, MiddleOffsetStartChanging, _middleOffsetChangeComleted, OffsetType.Middle)); - + } } } @@ -344,9 +350,10 @@ namespace Tango.PPC.Jobs.Models public double RightOffset { - get { return SecondBrushStop != null ? SecondBrushStop.OffsetPercent: 100; } - set { - + get { return SecondBrushStop != null ? SecondBrushStop.OffsetPercent : 100; } + set + { + if (SecondBrushStop != null && SecondBrushStop.OffsetPercent != value) { SecondBrushStop.OffsetPercent = value; @@ -371,7 +378,7 @@ namespace Tango.PPC.Jobs.Models _rightOffsetChangeComleted = value; RaisePropertyChangedAuto(); UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeOffsetCommand(this, RightOffsetStartChanging, _rightOffsetChangeComleted, OffsetType.Right)); - + } } } @@ -393,8 +400,8 @@ namespace Tango.PPC.Jobs.Models { get { - double length = Math.Round( LeftOffset * Length / 100, 1); - return String.Format($"{Math.Round(LeftOffset,0)}%({length}m)" ); + double length = Math.Round(LeftOffset * Length / 100, 1); + return String.Format($"{Math.Round(LeftOffset, 0)}%({length}m)"); } } @@ -403,7 +410,7 @@ namespace Tango.PPC.Jobs.Models { get { - double length = Math.Round((100-RightOffset) * Length / 100, 1); + double length = Math.Round((100 - RightOffset) * Length / 100, 1); return String.Format($"{Math.Round(RightOffset, 0)}%({length}m)"); } } @@ -461,12 +468,12 @@ namespace Tango.PPC.Jobs.Models { get { - if(BrushStops.Count > 0) + if (BrushStops.Count > 0) { var brushStop = BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.FirstColor).FirstOrDefault(); return brushStop; } - + return null; } @@ -494,7 +501,7 @@ namespace Tango.PPC.Jobs.Models { bool hasError = (FirstBrushStop != null && FirstBrushStop.IsOutOfGamut) || (SecondBrushStop != null && SecondBrushStop.IsOutOfGamut); - + return hasError; } } @@ -504,7 +511,9 @@ namespace Tango.PPC.Jobs.Models public bool IsSelected { get { return _isSelected; } - set { _isSelected = value; + set + { + _isSelected = value; RaisePropertyChangedAuto(); } } @@ -585,9 +594,9 @@ namespace Tango.PPC.Jobs.Models foreach (var stop in BrushStops.ToList().OrderBy(x => x.StopIndex).ToList()) { //TODO test if displayed is valid stop.IsValid - + Color color = stop.BestMatchColor; - stops.Add(new GradientStop( color, stop.OffsetPercent / 100d)); + stops.Add(new GradientStop(color, stop.OffsetPercent / 100d)); } LinearGradientBrush brush = new LinearGradientBrush(); @@ -605,7 +614,7 @@ namespace Tango.PPC.Jobs.Models { //TODO test if displayed is valid stop.IsValid Color color = BrushStops[i].BestMatchColor; - _brush.GradientStops[i].Color = color; + _brush.GradientStops[i].Color = color; _brush.GradientStops[i].Offset = BrushStops[i].OffsetPercent / 100d; } @@ -632,7 +641,7 @@ namespace Tango.PPC.Jobs.Models cloned.EnableInterSegment = EnableInterSegment; cloned.BrushStops = BrushStops.Select(x => x.Clone()).ToSynchronizedObservableCollection(); cloned.BrushStops.ToList().ForEach(x => x.SegmentModel = cloned); - + cloned.SegmentIndex = SegmentIndex + 1; cloned.SegmentsGroupModel = SegmentsGroupModel; return cloned; @@ -651,7 +660,7 @@ namespace Tango.PPC.Jobs.Models Length = length, Name = "Inter Segment", BrushStops = new SynchronizedObservableCollection<BrushStopModel>() - + }; } /// <summary> @@ -672,7 +681,7 @@ namespace Tango.PPC.Jobs.Models colorbrushStop.StopIndex = 2; colorbrushStop.OffsetPercent = 0; BrushStops.Add(colorbrushStop); - + BrushStopModel middleBrushStop = firstBrush.Clone(); middleBrushStop.StopIndex = 3; middleBrushStop.Position = BrushStopModel.PositionStatus.Middle; @@ -703,23 +712,23 @@ namespace Tango.PPC.Jobs.Models BrushStops.Add(lastSecondBrushStop); } - public void SetNewColor(BrushStopModel target, BrushStopModel source ) + public void SetNewColor(BrushStopModel target, BrushStopModel source) { target.SetNewColor(source); target.IsOutOfGamut = source.IsOutOfGamut; if (target.Position == BrushStopModel.PositionStatus.FirstColor) { BrushStopModel first = BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.First).FirstOrDefault(); - if(first != null) + if (first != null) { first.SetNewColor(source); first.IsOutOfGamut = source.IsOutOfGamut; - } + } } - else if(target.Position == BrushStopModel.PositionStatus.SecondColor) + else if (target.Position == BrushStopModel.PositionStatus.SecondColor) { BrushStopModel last = BrushStops.Where(x => x.Position == BrushStopModel.PositionStatus.Last).FirstOrDefault(); - if(last != null) + if (last != null) { last.SetNewColor(source); last.IsOutOfGamut = source.IsOutOfGamut; @@ -728,7 +737,7 @@ namespace Tango.PPC.Jobs.Models UpdateMiddleColorBrush(); RaiseSegmentBrushChanged(); } - + public void UpdateMiddleColorBrush() { if (MiddleBrushStop != null && SecondBrushStop != null && FirstBrushStop != null) @@ -737,13 +746,13 @@ namespace Tango.PPC.Jobs.Models MiddleBrushStop.BestMatchColor = BrushStopModel.GetRelativeRGB(FirstBrushStop.BestMatchColor, SecondBrushStop.BestMatchColor, 0, 1, 0.5); } } - + public void RemoveSecondColorOfGradient() { if (BrushStops.Count < 5) - return ; - BrushStops.RemoveAt(4); - BrushStops.RemoveAt(3); + return; + BrushStops.RemoveAt(4); + BrushStops.RemoveAt(3); } public void ArrangeBrushStopsIndexes() @@ -764,7 +773,7 @@ namespace Tango.PPC.Jobs.Models else if (BrushStops.Count > 1) BrushStops.ToList().ForEach(x => x.Position = (BrushStopModel.PositionStatus)x.StopIndex); } - + public void SwapBrushStops() { if (BrushStops.Count > 1) @@ -776,7 +785,7 @@ namespace Tango.PPC.Jobs.Models var left_temp = BrushStops[index]; var right_stopIndex = BrushStops[lastIndex].StopIndex; var right_offsetPercent = BrushStops[lastIndex].OffsetPercent; - + BrushStops[index] = BrushStops[lastIndex]; BrushStops[index].StopIndex = left_temp.StopIndex; BrushStops[index].OffsetPercent = left_temp.OffsetPercent; @@ -834,7 +843,7 @@ namespace Tango.PPC.Jobs.Models if (Job != null && Job.Rml != null) { var gramPerlength = Job.Rml.GetGramPer1000mLength; - var weight = (Length * gramPerlength)/( 1000 );//(kg) + var weight = (Length * gramPerlength) / (1000);//(kg) _weight = weight; RaisePropertyChanged(nameof(Weight)); //if (_lastLength != length) @@ -858,7 +867,7 @@ namespace Tango.PPC.Jobs.Models if (Job != null && Job.Rml != null) { var gramPerlength = Job.Rml.GetGramPer1000mLength; - var length = (Weight * 1000 )/ gramPerlength;//(m) weight in gr + var length = (Weight * 1000) / gramPerlength;//(m) weight in gr _length = length; RaisePropertyChanged(nameof(Length)); @@ -867,7 +876,7 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(LeftOffsetLabel)); RaisePropertyChanged(nameof(MiddleOffsetLabel)); RaisePropertyChanged(nameof(RightOffsetLabel)); - + } } @@ -876,62 +885,68 @@ namespace Tango.PPC.Jobs.Models /// </summary> /// <param name="brushstops"></param> protected void OnBrushStopsChanged(SynchronizedObservableCollection<BrushStopModel> brushstops) + { + if (brushstops != null) { - if (brushstops != null) - { - brushstops.CollectionChanged -= BrushStops_CollectionChanged; - brushstops.CollectionChanged += BrushStops_CollectionChanged; + brushstops.CollectionChanged -= BrushStops_CollectionChanged; + brushstops.CollectionChanged += BrushStops_CollectionChanged; - foreach (var stop in brushstops.ToList()) - { - stop.RaiseOffsetChanged(); - } - - RaiseSegmentBrushChanged(); + foreach (var stop in brushstops.ToList()) + { + stop.RaiseOffsetChanged(); } - } - private void AddGap() - { - EnableInterSegment = true; + RaiseSegmentBrushChanged(); } + } - private void DeleteGap() - { - EnableInterSegment = false; - } + private void AddGap() + { + EnableInterSegment = true; + } - public void UpdateBrushStops() - { - foreach (var stop in BrushStops.Where(x => x.ColorSpace == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace == BL.Enumerations.ColorSpaces.LAB).ToList()) - { - try - { - stop.OnBrushStopFieldValueChanged(); - stop.InitColorsFromBestmatch(); - //TODO ASK ROY!!!!!! - //output.ApplyOnBrushStopVolumesOnly(stop); - } - catch (Exception ex) - { - LogManager.Log(ex, $"Error updating stop volumes after changing thread on segment {stop.SegmentModel.SegmentIndex}, stop {stop.StopIndex}."); - } - } - } + private void DeleteGap() + { + EnableInterSegment = false; + } - public void UpdateWeightOnRMLChange( bool isWeightView) + public void UpdateBrushStops() + { + foreach (var stop in BrushStops.Where(x => x.ColorSpace == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace == BL.Enumerations.ColorSpaces.LAB).ToList()) { - if(isWeightView) + try { - OnWeightChanged(); + stop.OnBrushStopFieldValueChanged(); + stop.InitColorsFromBestmatch(); + //TODO ASK ROY!!!!!! + //output.ApplyOnBrushStopVolumesOnly(stop); } - else + catch (Exception ex) { - OnLengthChanged(Length); + LogManager.Log(ex, $"Error updating stop volumes after changing thread on segment {stop.SegmentModel.SegmentIndex}, stop {stop.StopIndex}."); } } + foreach (var stop in BrushStops.Where(x => x.ColorSpace == ColorSpaces.Volume)) + { + stop.InitLiquidVolumes(); + } - #endregion } + + public void UpdateWeightOnRMLChange(bool isWeightView) + { + if (isWeightView) + { + OnWeightChanged(); + } + else + { + OnLengthChanged(Length); + } + } + + + #endregion } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj index 405f87b28..ca80b27a0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj @@ -322,6 +322,8 @@ <Compile Include="Models\FavoriteColor.cs" /> <Compile Include="Models\ISegmentModel.cs" /> <Compile Include="Models\JobModel.cs" /> + <Compile Include="Models\LiquidVolumeModel.cs" /> + <Compile Include="Models\LiquidVolumesCollection.cs" /> <Compile Include="Models\SegmentModel.cs" /> <Compile Include="Models\SegmentsGroupModel.cs" /> <Compile Include="Models\TestColor.cs" /> @@ -762,7 +764,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs index b879831b9..a5b68b368 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs @@ -205,6 +205,8 @@ namespace Tango.PPC.Jobs.ViewModels protected void OnUpdateCurrentBrush() { + CurrentBrushStop.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters); + RaisePropertyChanged(nameof(CyanOutput)); RaisePropertyChanged(nameof(LightCyanOutput)); RaisePropertyChanged(nameof(MagentaOutput)); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index 970bbcd04..499d2c08c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -1672,10 +1672,6 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.L = stop.L; dbStop.A = stop.A; dbStop.B = stop.B; - dbStop.Cyan = stop.Cyan; - dbStop.Magenta = stop.Magenta; - dbStop.Yellow = stop.Yellow; - dbStop.Black = stop.Black; dbStop.BestMatchR = stop.BestMatchColor.R; dbStop.BestMatchG = stop.BestMatchColor.G; dbStop.BestMatchB = stop.BestMatchColor.B; @@ -1684,10 +1680,7 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.StopIndex = stop.StopIndex; dbStop.IsOutOfGamut = stop.IsOutOfGamut; - dbStop.SetVolume(LiquidTypes.Cyan, stop.Cyan); - dbStop.SetVolume(LiquidTypes.Magenta, stop.Magenta); - dbStop.SetVolume(LiquidTypes.Yellow, stop.Yellow); - dbStop.SetVolume(LiquidTypes.Black, stop.Black); + stop.LiquidVolumes.SetVolumesOnBrushStop(dbStop); dbStop.ColorCatalog = stop.ColorCatalog; dbStop.ColorCatalogsItem = stop.ColorCatalogsItem; @@ -1728,10 +1721,6 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.L = stop.L; dbStop.A = stop.A; dbStop.B = stop.B; - dbStop.Cyan = stop.Cyan; - dbStop.Magenta = stop.Magenta; - dbStop.Yellow = stop.Yellow; - dbStop.Black = stop.Black; dbStop.BestMatchR = stop.BestMatchColor.R; dbStop.BestMatchG = stop.BestMatchColor.G; dbStop.BestMatchB = stop.BestMatchColor.B; @@ -1740,10 +1729,7 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.StopIndex = stop.StopIndex; dbStop.IsOutOfGamut = stop.IsOutOfGamut; - dbStop.SetVolume(LiquidTypes.Cyan, stop.Cyan); - dbStop.SetVolume(LiquidTypes.Magenta, stop.Magenta); - dbStop.SetVolume(LiquidTypes.Yellow, stop.Yellow); - dbStop.SetVolume(LiquidTypes.Black, stop.Black); + stop.LiquidVolumes.SetVolumesOnBrushStop(dbStop); dbStop.ColorCatalog = stop.ColorCatalog; dbStop.ColorCatalogsItem = stop.ColorCatalogsItem; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml index adf8c22d5..980c38082 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml @@ -141,33 +141,24 @@ </UniformGrid> </DataTemplate> - <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> - <UniformGrid Rows="1" Columns="4" Height="30" > - <StackPanel Orientation="Horizontal"> - <TextBlock Text="C" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Cyan, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="0 0 0 0"> - <TextBlock Text="M" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Magenta, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> - <TextBlock Text="Y" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Yellow, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> - <TextBlock Text="K" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Black, StringFormat=0.##}"></TextBlock> - </Border> - </StackPanel> - </UniformGrid> + <DataTemplate x:Key="CMYK_Template" DataType="{x:Type model:BrushStopModel}"> + <ItemsControl ItemsSource="{Binding LiquidVolumes}" Height="30"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="0 0 15 0"> + <TextBlock Text="{Binding IdsPack.LiquidType.ShortName}" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> + <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Volume, StringFormat=0.##}" ></TextBlock> + </Border> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </DataTemplate> <DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml index 89b69a316..c80abe0e0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml @@ -23,32 +23,23 @@ </Style> <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> - <UniformGrid Rows="1" Columns="4" Height="Auto" MinWidth="180" HorizontalAlignment="Left"> - <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left"> - <Border Width="50" Height="50" Background="Cyan" CornerRadius="16" HorizontalAlignment="Left" > - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Cyan, StringFormat=0.##}" VerticalAlignment="Center"></TextBlock> - </Border> - <TextBlock Margin="0 10 0 0" Text="C" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - </StackPanel> - <StackPanel Orientation="Vertical" Margin="0 0 0 0" Width="50"> - <Border Width="50" Height="50" Background="Magenta" CornerRadius="16" HorizontalAlignment="Left"> - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Magenta, StringFormat=0.##}" VerticalAlignment="Center" ></TextBlock> - </Border> - <TextBlock Margin="0 10 0 0" Text="M" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - </StackPanel> - <StackPanel Orientation="Vertical" Margin="10 0 0 0" Width="50"> - <Border Width="50" Height="50" Background="Yellow" CornerRadius="16" HorizontalAlignment="Left"> - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Yellow, StringFormat=0.##}" VerticalAlignment="Center" ></TextBlock> - </Border> - <TextBlock Margin="0 10 0 0" Text="Y" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - </StackPanel> - <StackPanel Orientation="Vertical" Margin="10 0 0 0" Width="50"> - <Border Width="50" Height="50" Background="Black" CornerRadius="16" HorizontalAlignment="Left"> - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Black, StringFormat=0.##}" VerticalAlignment="Center" Foreground="{StaticResource TangoLightForegroundBrush}"></TextBlock> - </Border> - <TextBlock Margin="0 10 0 0" Text="K" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> - </StackPanel> - </UniformGrid> + <ItemsControl ItemsSource="{Binding LiquidVolumesOrderedPigmentedForStandardUser}" MinWidth="180" HorizontalAlignment="Left"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Margin="0 0 10 0" Orientation="Vertical" Width="50" HorizontalAlignment="Left"> + <Border Width="50" Height="50" Background="{Binding IdsPack.LiquidType.LiquidTypeBrush}" CornerRadius="16" HorizontalAlignment="Left" > + <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Volume, StringFormat=0.##}" VerticalAlignment="Center"></TextBlock> + </Border> + <TextBlock Margin="0 10 0 0" Text="{Binding IdsPack.LiquidType.ShortName}" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </DataTemplate> <DataTemplate x:Key="RGB_Template" DataType="{x:Type entities:BrushStop}"> @@ -338,13 +329,13 @@ <Border Width="50" Height="50" Background="Transparent" CornerRadius="16" HorizontalAlignment="Left" BorderBrush="{StaticResource TangoDisabledForegroundBrush}" BorderThickness="1"> <TextBlock Margin="0 " Style="{StaticResource SliderGreyTextStyle}" Text="-" ></TextBlock> </Border> - <TextBlock Margin="0 10 0 0 " Text="a" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> + <TextBlock Margin="0 10 0 0 " Text="A" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> </StackPanel> <StackPanel Orientation="Vertical" Width="50"> <Border Width="50" Height="50" Background="Transparent" CornerRadius="16" HorizontalAlignment="Left" BorderBrush="{StaticResource TangoDisabledForegroundBrush}" BorderThickness="1"> <TextBlock Margin="0 " Style="{StaticResource SliderGreyTextStyle}" Text="-" ></TextBlock> </Border> - <TextBlock Margin="0 10 0 0 " Text="b" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> + <TextBlock Margin="0 10 0 0 " Text="B" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> </StackPanel> </UniformGrid> <Grid Visibility="{Binding IsDyeingProcess,Converter={StaticResource BooleanToVisibilityConverter}}"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml index 038c4af0f..02ff30d24 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml @@ -137,33 +137,24 @@ </UniformGrid> </DataTemplate> - <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> - <UniformGrid Rows="1" Columns="4" Height="30" > - <StackPanel Orientation="Horizontal"> - <TextBlock Text="C" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Cyan, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="0 0 0 0"> - <TextBlock Text="M" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Magenta, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> - <TextBlock Text="Y" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Yellow, StringFormat=0.##}" ></TextBlock> - </Border> - </StackPanel> - <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> - <TextBlock Text="K" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> - <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> - <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Black, StringFormat=0.##}"></TextBlock> - </Border> - </StackPanel> - </UniformGrid> + <DataTemplate x:Key="CMYK_Template" DataType="{x:Type model:BrushStopModel}"> + <ItemsControl ItemsSource="{Binding LiquidVolumes}" Height="30"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="0 0 10 0"> + <TextBlock Text="{Binding IdsPack.LiquidType.ShortName}" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="5 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="48"> + <TextBlock Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Volume, StringFormat=0.##}" ></TextBlock> + </Border> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </DataTemplate> <DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs index 3b10b7bdf..da9afc2c7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Converters/LiquidTypeToBrushConverter.cs @@ -55,6 +55,8 @@ namespace Tango.PPC.Maintenance.Converters return Application.Current.Resources["TangoLightMagentaInkBrush"] as Brush; case BL.Enumerations.LiquidTypes.LightYellow: return Application.Current.Resources["TangoLightYellowInkBrush"] as Brush; + case BL.Enumerations.LiquidTypes.Violet: + return Application.Current.Resources["TangoVioletInkBrush"] as Brush; } |
