diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-05-18 19:49:41 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-05-18 19:49:41 +0300 |
| commit | 56e222adc848ccc223e6b1065d311ced5c82f34c (patch) | |
| tree | 3cdbb4a6d3c2eda30c22a4514779af2e965102f1 /Software/Visual_Studio/PPC | |
| parent | baa65cb88df619c3df68bdf91e0e0476ca614998 (diff) | |
| download | Tango-56e222adc848ccc223e6b1065d311ced5c82f34c.tar.gz Tango-56e222adc848ccc223e6b1065d311ced5c82f34c.zip | |
Vector Fine Tuning.
Diffstat (limited to 'Software/Visual_Studio/PPC')
21 files changed, 856 insertions, 391 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ColorCorrectionTool/TrialsLogEngine.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ColorCorrectionTool/TrialsLogEngine.cs index 678a1ed7d..97d6307fe 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ColorCorrectionTool/TrialsLogEngine.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ColorCorrectionTool/TrialsLogEngine.cs @@ -42,11 +42,9 @@ namespace Tango.PPC.Jobs.ColorCorrectionTool _collection.Update(test); } - public TestColor AddTest( double l, double a, double b) + public void AddTest(TestColor test) { - TestColor test = new TestColor() { L = l, A = a, B = b }; _collection.Insert(test); - return test; } public List<TestColor> GetAll() @@ -54,9 +52,9 @@ namespace Tango.PPC.Jobs.ColorCorrectionTool return _collection.FindAll().ToList(); } - public TestColor GetByID( Int32 id) + public TestColor GetByBrushStopGuid(String brushStopGuid) { - return _collection.FindOne( x=> x.ID == id); + return _collection.FindOne(x => x.BrushStopGuid == brushStopGuid); } ~TrialsLogEngine() @@ -75,7 +73,7 @@ namespace Tango.PPC.Jobs.ColorCorrectionTool public void Delete(TestColor test) { - _collection.Delete(test.ID); + _collection.Delete(test.BrushStopGuid); } } } 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 4cbe8e1be..c4d35c1b7 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 @@ -408,6 +408,8 @@ Margin="0 0 0 0" MinWidth="200" BorderBrush="{StaticResource TangoKeyboardKeyDarkTextBrush}" + PreviewTouchDown="LABPicker_PreviewTouchDown" + PreviewMouseDown="LABPicker_OnPreviewMouseDown" L="{Binding SelectedBrushStop.L, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" A="{Binding SelectedBrushStop.A, Mode=TwoWay}" B="{ Binding SelectedBrushStop.B, Mode=TwoWay}" /> </Grid> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml.cs index 4f18dc853..3400ca55c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml.cs @@ -12,7 +12,6 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -using Tango.PPC.Jobs.ViewModels; namespace Tango.PPC.Jobs.Dialogs { @@ -66,5 +65,27 @@ namespace Tango.PPC.Jobs.Dialogs { } + + private async void LABPicker_PreviewTouchDown(object sender, TouchEventArgs e) + { + if (_vm != null) + { + if (false == await _vm.NotifyAboutTrialsData()) + { + e.Handled = true; + } + } + } + + private async void LABPicker_OnPreviewMouseDown(object sender, MouseButtonEventArgs e) + { + if (_vm != null) + { + if (false == await _vm.NotifyAboutTrialsData()) + { + e.Handled = true; + } + } + } } } 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 9a6258e84..cd51334a5 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 @@ -16,6 +16,7 @@ using Tango.Core.Threading; using Tango.PPC.Common; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; +using Tango.PPC.Jobs.ColorCorrectionTool; using Tango.PPC.Jobs.Models; using Tango.PPC.Jobs.MyColors; using Tango.PPC.Jobs.NavigationObjects; @@ -501,6 +502,7 @@ namespace Tango.PPC.Jobs.Dialogs InitialBrushStop = DialogEditObject.BrushStopForEdit; SelectedBrushStop = InitialBrushStop.Clone(); + SelectedBrushStop.Guid = InitialBrushStop.Guid; SelectedBrushStop.ColorSpace = InitialBrushStop.ColorSpace; if (SelectedBrushStop.ColorSpace == ColorSpaces.Volume) @@ -937,7 +939,7 @@ namespace Tango.PPC.Jobs.Dialogs #region Vector Fine tuning private void OpenVectorFineTuning() { - VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B, SelectedBrushStop.Color, SelectedBrushStop.Cyan, SelectedBrushStop.Magenta, SelectedBrushStop.Yellow, SelectedBrushStop.Black); + VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B, SelectedBrushStop.Color); IsOpenVectorFineTuningDialog = true; @@ -950,7 +952,6 @@ namespace Tango.PPC.Jobs.Dialogs private void VectorFineTuningDialogCanceled() { VectorFineTuningDialogVM.Canceled -= VectorFineTuningDialogCanceled; - SelectedBrushStop.TestVFTID = VectorFineTuningDialogVM.BrushStopModel.TestVFTID; IsOpenVectorFineTuningDialog = false; } @@ -958,28 +959,31 @@ namespace Tango.PPC.Jobs.Dialogs { VectorFineTuningDialogVM.Accepted -= VectorFineTuningDialogAccepted; IsOpenVectorFineTuningDialog = false; - //LAB - _selectedBrushStop.PreventPropertyUpdate = true; - _selectedBrushStop.Red = VectorFineTuningDialogVM.BrushStopModel.Red; - _selectedBrushStop.Green = VectorFineTuningDialogVM.BrushStopModel.Green; - _selectedBrushStop.Blue = VectorFineTuningDialogVM.BrushStopModel.Blue; - - _selectedBrushStop.Cyan = VectorFineTuningDialogVM.BrushStopModel.Cyan; - _selectedBrushStop.Magenta = VectorFineTuningDialogVM.BrushStopModel.Magenta; - _selectedBrushStop.Yellow = VectorFineTuningDialogVM.BrushStopModel.Yellow; - _selectedBrushStop.Black = VectorFineTuningDialogVM.BrushStopModel.Black; - _selectedBrushStop.L = (double)VectorFineTuningDialogVM.BrushStopModel.L; - _selectedBrushStop.A = (double)VectorFineTuningDialogVM.BrushStopModel.A; + _selectedBrushStop.PreventPropertyUpdate = true; + _selectedBrushStop.L = (double)VectorFineTuningDialogVM.SelectedLog.L; + _selectedBrushStop.A = (double)VectorFineTuningDialogVM.SelectedLog.A; + _selectedBrushStop.B = (double)VectorFineTuningDialogVM.SelectedLog.B; _selectedBrushStop.PreventPropertyUpdate = false; + _selectedBrushStop.ConvertColor(); - _selectedBrushStop.B = (double)VectorFineTuningDialogVM.BrushStopModel.B; - - _selectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; - _selectedBrushStop.InitColorsFromBestmatch(); - base.Accept(); + Accept(); } + public async Task<bool> NotifyAboutTrialsData() + { + var testColor = TrialsLogEngine.Default.GetByBrushStopGuid(SelectedBrushStop.Guid); + if (testColor != null && testColor.TrialslogList.Count > 0) + { + if (true == await NotificationProvider.ShowQuestion("The color correction is in progress, the trials data will be reset. Are you sure?")) + { + TrialsLogEngine.Default.Delete( testColor); + return true; + } + return false; + } + return true; + } #endregion diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml index 1ac320c3a..ddc5ac755 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml @@ -21,7 +21,7 @@ <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="../Resources/Styles.xaml" /> </ResourceDictionary.MergedDictionaries> - <sharedConverters:DateTimeUTCToShortDateConverter x:Key="DateTimeUTCToShortDateConverter" /> + <sharedConverters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter" /> <sharedConverters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter"/> <BitmapImage x:Key="Close_mycolorsdlg" UriSource="../Images/ColorSelection/close_mycolorsdlg.png" /> @@ -114,7 +114,7 @@ <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> <Grid.RowDefinitions> - <RowDefinition Height="230"></RowDefinition> + <RowDefinition Height="200"></RowDefinition> <RowDefinition Height="1*"></RowDefinition> </Grid.RowDefinitions> <StackPanel Orientation="Vertical"> @@ -147,14 +147,14 @@ </StackPanel> </StackPanel> <Grid Grid.Row="1"> - <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="24 40 24 0"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="24 10 24 0"> <Image Stretch="Fill" Width="36" Height="36" RenderOptions.BitmapScalingMode="Fant" Source="../Images/ColorSelection/CorrectionTrial.png" HorizontalAlignment="Left"></Image> <TextBlock Margin="11 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TangoMessageBoxButtonFontSize}" FontWeight="SemiBold" > <Run Text="Correction Trial #" ></Run> <Run Text="{Binding TrialNumber, Mode=OneWay}"></Run> </TextBlock> </StackPanel> - <Grid Margin="78 110 0 0"> + <Grid Margin="78 70 0 0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*"></ColumnDefinition> <ColumnDefinition Width="311"></ColumnDefinition> @@ -172,15 +172,15 @@ </UniformGrid.Style> <StackPanel Orientation="Horizontal"> <TextBlock Text="L" FontSize="{StaticResource TangoComboBoxItemFontSize}" VerticalAlignment="Center"/> - <touch:TouchNumericUpDownConrol Margin="30 0 0 0" NumericPartWidth="94.0" Width="200" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" MaxValue="100" MinValue="0" Value="{Binding MeasuredL}" FontSize="{StaticResource TangoComboBoxItemFontSize}"/> + <touch:TouchNumericUpDownConrol Margin="30 0 0 0" NumericPartWidth="94.0" Width="200" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" MaxValue="100" MinValue="0" Value="{Binding MeasuredL, Delay=1000}" FontSize="{StaticResource TangoComboBoxItemFontSize}"/> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="a" FontSize="{StaticResource TangoComboBoxItemFontSize}" VerticalAlignment="Center"/> - <touch:TouchNumericUpDownConrol Margin="30 0 0 0" NumericPartWidth="94.0" Width="200" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" MaxValue="127" MinValue="-128" Value="{Binding MeasuredA}" FontSize="{StaticResource TangoComboBoxItemFontSize}"/> + <touch:TouchNumericUpDownConrol Margin="30 0 0 0" NumericPartWidth="94.0" Width="200" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" MaxValue="127" MinValue="-128" Value="{Binding MeasuredA, Delay=1000}" FontSize="{StaticResource TangoComboBoxItemFontSize}"/> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="b" FontSize="{StaticResource TangoComboBoxItemFontSize}" VerticalAlignment="Center"/> - <touch:TouchNumericUpDownConrol Margin="30 0 0 0" NumericPartWidth="94.0" Width="200" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" MaxValue="127" MinValue="-128" Value="{Binding MeasuredB, TargetNullValue=''}" FontSize="{StaticResource TangoComboBoxItemFontSize}"/> + <touch:TouchNumericUpDownConrol Margin="30 0 0 0" NumericPartWidth="94.0" Width="200" Height="40" HorizontalAlignment="Stretch" BorderThickness="0.8" MaxValue="127" MinValue="-128" Value="{Binding MeasuredB, Delay=1000}" FontSize="{StaticResource TangoComboBoxItemFontSize}"/> </StackPanel> </UniformGrid> @@ -234,7 +234,7 @@ <TextBlock DockPanel.Dock="Bottom" Margin="0 8 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoDarkForegroundBrush}">Clear</TextBlock> </DockPanel> </touch:TouchButton> - <touch:TouchButton Margin="66 0 0 0" HorizontalAlignment="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding ExportTrialsCommand}" > + <touch:TouchButton Margin="46 0 20 0" HorizontalAlignment="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding ExportTrialsCommand}" > <DockPanel Width="Auto" Height="44" VerticalAlignment="Center"> <Image Source="../Images/ColorSelection/Export.png" Width="19" DockPanel.Dock="Top"></Image> <TextBlock DockPanel.Dock="Bottom" VerticalAlignment="Bottom" HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoDarkForegroundBrush}">Export</TextBlock> @@ -250,59 +250,94 @@ </DockPanel> </touch:TouchExpander.Header> <Grid Margin=" 0 10 0 0" > - <touch:LightTouchDataGrid MaxHeight="380" AnimateSorting="False" EnableDragAndDrop="False" RenderOptions.EdgeMode="Unspecified" x:Name="dataGridTrialsLog" Style="{StaticResource TangoJobsGrid}" SelectedItem="{Binding SelectedLog, Mode=TwoWay}" SelectionMode="Single" IsMultiSelecting="False" ItemsSource="{Binding TrialsLogitems, Mode=OneWay}" Margin="0"> - <touch:LightTouchDataGrid.Columns> - <touch:LightTouchDataGridColumn Width="50" Header="#" > - <touch:LightTouchDataGridColumn.CellTemplate > - <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding Trial}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> - </DataTemplate> - </touch:LightTouchDataGridColumn.CellTemplate> - </touch:LightTouchDataGridColumn> - <touch:LightTouchDataGridColumn Width="140" Header="Date" HorizontalContentAlignment="Left"> - <touch:LightTouchDataGridColumn.CellTemplate> - <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding Date,Converter={StaticResource DateTimeUTCToShortDateConverter}}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Left" ></TextBlock> - </DataTemplate> - </touch:LightTouchDataGridColumn.CellTemplate> - </touch:LightTouchDataGridColumn> - <touch:LightTouchDataGridColumn Width="200" Header="CMYK" HorizontalContentAlignment="Left"> - <touch:LightTouchDataGridColumn.CellTemplate> - <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding CMYK}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> - </DataTemplate> - </touch:LightTouchDataGridColumn.CellTemplate> - </touch:LightTouchDataGridColumn> - <touch:LightTouchDataGridColumn Width="1*" Header="Measured L*a*b*" HorizontalContentAlignment="Left"> - <touch:LightTouchDataGridColumn.CellTemplate> - <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding LAB}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> - </DataTemplate> - </touch:LightTouchDataGridColumn.CellTemplate> - </touch:LightTouchDataGridColumn> - <touch:LightTouchDataGridColumn Header="dE(CMC)" Width="85" > - <touch:LightTouchDataGridColumn.CellTemplate> - <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding DeltaE, StringFormat={}{0:0.##}}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Left"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding DeltaE, Converter={StaticResource SmallerThanToBooleanConverter}, ConverterParameter=2}" Value="True"> - - <Setter Property="Foreground" Value="{StaticResource TangoGreenBrush}"></Setter> - - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - </TextBlock> - </DataTemplate> - </touch:LightTouchDataGridColumn.CellTemplate> - </touch:LightTouchDataGridColumn> - </touch:LightTouchDataGrid.Columns> - </touch:LightTouchDataGrid> - </Grid> + <touch:LightTouchDataGrid MaxHeight="450" AnimateSorting="False" EnableDragAndDrop="False" RenderOptions.EdgeMode="Unspecified" x:Name="dataGridTrialsLog" Style="{StaticResource TangoJobsGrid}" SelectedItem="{Binding SelectedLog, Mode=TwoWay}" SelectionMode="Single" IsMultiSelecting="False" ItemsSource="{Binding TrialsLogitems, Mode=OneWay}" Margin="0"> + <touch:LightTouchDataGrid.Resources> + <Style TargetType="{x:Type touch:LightTouchDataGridRow}"> + <Setter Property="Background" Value="{StaticResource TangoPrimaryBackgroundBrush}"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoLightBorderBrush}"></Setter> + <Setter Property="Padding" Value="5"></Setter> + <Setter Property="CornerRadius" Value="2"></Setter> + <Setter Property="Margin" Value="5 0"></Setter> + <Setter Property="Height" Value="44"></Setter> + <Setter Property="IsEnabled" Value="True"/> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSelectionEnable}" Value="False"> + <Setter Property="IsEnabled" Value="False"/> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:LightTouchDataGrid.Resources> + <touch:LightTouchDataGrid.Columns> + <touch:LightTouchDataGridColumn Width="50" Header="#" > + <touch:LightTouchDataGridColumn.CellTemplate > + <DataTemplate> + <TextBlock IsHitTestVisible="False" Text="{Binding Trial}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Width="140" Header="Date" HorizontalContentAlignment="Left"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <TextBlock IsHitTestVisible="False" Text="{Binding Date,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Left" ></TextBlock> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Width="200" Header="CMYK" HorizontalContentAlignment="Left"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <TextBlock IsHitTestVisible="False" Text="{Binding CMYK}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Width="1*" Header="Measured L*a*b*" HorizontalContentAlignment="Left"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <TextBlock IsHitTestVisible="False" Text="{Binding LAB}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + <touch:LightTouchDataGridColumn Header="dE(CMC)" Width="85" HorizontalContentAlignment="Left"> + <touch:LightTouchDataGridColumn.CellTemplate> + <DataTemplate> + <DockPanel> + <TextBlock DockPanel.Dock="Left" IsHitTestVisible="False" Text="{Binding DeltaEDisplay}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0 0 10 0"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding DeltaE, Converter={StaticResource SmallerThanToBooleanConverter}, ConverterParameter=2}" Value="True"> + + <Setter Property="Foreground" Value="{StaticResource TangoGreenBrush}"></Setter> + + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + <touch:TouchButton DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.DeleteTrialCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type touch:LightTouchDataGrid}}}" > + <DockPanel Width="Auto" Height="44" VerticalAlignment="Center"> + <Image Source="../Images/ColorSelection/Clear.png" Width="19" DockPanel.Dock="Top"></Image> + </DockPanel> + <touch:TouchButton.Style> + <Style TargetType="touch:TouchButton"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=touch:LightTouchDataGridRow},Path=IsSelected}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchButton.Style> + </touch:TouchButton> + </DockPanel> + </DataTemplate> + </touch:LightTouchDataGridColumn.CellTemplate> + </touch:LightTouchDataGridColumn> + </touch:LightTouchDataGrid.Columns> + </touch:LightTouchDataGrid> + </Grid> </touch:TouchExpander> </Border> <DockPanel Grid.Row="2" Margin="0 20 0 41" Background="{StaticResource TangoPrimaryBackgroundBrush}" > @@ -320,23 +355,21 @@ </Style> </touch:TouchButton.Style> </touch:TouchButton> - <touch:TouchButton x:Name="VFTCancelBtn" HorizontalAlignment="Left" Margin="82 0 0 0" BorderThickness="1" RippleBrush="{StaticResource TangoRippleDarkBrush}" BorderBrush="{StaticResource TangoPrimaryAccentBrush}" CornerRadius="25" Command="{Binding CloseCommand}" Width="200" Height="50" VerticalAlignment="Bottom" TextElement.Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoButtonFontSize}" ShadowDepth="0" Content="EXIT" EnableDropShadow="False" > + <touch:TouchButton x:Name="VFTCancelBtn" HorizontalAlignment="Left" Margin="82 0 0 0" BorderThickness="1" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="25" Command="{Binding CloseCommand}" Width="200" Height="50" VerticalAlignment="Bottom" FontSize="{StaticResource TangoButtonFontSize}" ShadowDepth="0" Content="EXIT" EnableDropShadow="False" > <touch:TouchButton.Style > <Style TargetType="touch:TouchButton" > <Setter Property="IsEnabled" Value="True"/> <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> - + <Setter Property="BorderBrush" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> <Setter Property="TextElement.Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> <Setter Property="Background" Value="Transparent"/> <Style.Triggers> <DataTrigger Binding="{Binding IsJobRunning}" Value="True"> <Setter Property="IsEnabled" Value="False"/> - </DataTrigger> - <Trigger Property="IsEnabled" Value="False"> <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> <Setter Property="TextElement.Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> - <Setter Property="BorderBrush" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> - </Trigger> + <Setter Property="BorderBrush" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> + </DataTrigger> </Style.Triggers> </Style> </touch:TouchButton.Style> 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 9d3ec385d..d1424906b 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 @@ -13,14 +13,21 @@ using Tango.BL.Enumerations; using Tango.Core; using Tango.Core.Commands; using Tango.Core.DI; +using Tango.Explorer; using Tango.Integration.Operation; +using Tango.PDF; using Tango.PPC.Common; using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Notifications.NotificationItems; using Tango.PPC.Common.Printing; +using Tango.PPC.Common.Storage; using Tango.PPC.Jobs.ColorCorrectionTool; using Tango.PPC.Jobs.Models; +using Tango.PPC.Jobs.Reports; +using Tango.PPC.Storage; +using Tango.PPC.Storage.Models; using Tango.Settings; using Tango.SharedUI; @@ -59,6 +66,15 @@ namespace Tango.PPC.Jobs.Dialogs /// </summary> [TangoInject] public IPrintingManager PrintingManager { get; set; } + + [TangoInject] + public INavigationManager NavigationManager { get; set; } + + /// <summary> + /// Gets or sets the storage provider. + /// </summary> + [TangoInject] + public IStorageProvider StorageProvider { get; set; } public BrushStopModel BrushStopModel { get; set; } @@ -311,18 +327,19 @@ namespace Tango.PPC.Jobs.Dialogs public int TrialNumber { - get { - if(ActiveLogModel == null) + get + { + if (ActiveLogModel == null) return 1; - return ActiveLogModel.TrialNumber + 1 ; + return ActiveLogModel.TrialNumber + 1; } } - public TestColor TestColor { get;set;} - + public TestColor TestColor { get; set; } + private SynchronizedObservableCollection<TrialsLogModel> _trialsLogItems; - + public SynchronizedObservableCollection<TrialsLogModel> TrialsLogitems { get { return _trialsLogItems; } @@ -338,8 +355,10 @@ namespace Tango.PPC.Jobs.Dialogs public TrialsLogModel ActiveLogModel { get { return _activeLogModel; } - set { _activeLogModel = value; - RaisePropertyChangedAuto(); + set + { + _activeLogModel = value; + RaisePropertyChangedAuto(); } } @@ -350,9 +369,16 @@ namespace Tango.PPC.Jobs.Dialogs get { return _selectedLog; } set { - _selectedLog = value; - RaisePropertyChangedAuto(); - OKCommand.RaiseCanExecuteChanged(); + if (value != ActiveLogModel) + { + _selectedLog = value; + RaisePropertyChangedAuto(); + OKCommand.RaiseCanExecuteChanged(); + + } + //else { _selectedLog = null;} + //RaisePropertyChangedAuto(); + //OKCommand.RaiseCanExecuteChanged(); } } @@ -374,14 +400,15 @@ namespace Tango.PPC.Jobs.Dialogs set { _isJobRunning = value; RaisePropertyChangedAuto(); } } - + #endregion #region Commands public RelayCommand TestCommand { get; set; } - public RelayCommand StopCommand { get;set; } + public RelayCommand StopCommand { get; set; } public RelayCommand ClearTrialsCommand { get; set; } public RelayCommand ExportTrialsCommand { get; set; } + public RelayCommand DeleteTrialCommand { get; set; } #endregion @@ -396,53 +423,65 @@ namespace Tango.PPC.Jobs.Dialogs ExportTrialsCommand = new RelayCommand(ExportTrialsLog); TestCommand = new RelayCommand(StartJob, CanStartJob); StopCommand = new RelayCommand(StopTest); + DeleteTrialCommand = new RelayCommand(DeleteTrialLog); IsExpanderOpened = true; TangoIOC.Default.Inject(this); + } + public void Init(BrushStopModel brushstop, double l, double a, double b, System.Windows.Media.Color targetColor) + { MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; MachineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted; - } - public void Init(BrushStopModel brushstop, double l, double a, double b, System.Windows.Media.Color targetColor, double cyan, double magenta, double yellow, double black) - { BrushStopModel = brushstop.Clone(); + BrushStopModel.Guid = brushstop.Guid; TargetL = l; TargetB = b; TargetA = a; TargetColor = targetColor; - Cyan = cyan; - Magenta = magenta; - Yellow = yellow; - Black = black; + BrushStopModel.ConvertColorToVolume(); + BrushStopModel.ColorSpace = ColorSpaces.LAB; + + Cyan = BrushStopModel.Cyan; + Magenta = BrushStopModel.Magenta; + Yellow = BrushStopModel.Yellow; + Black = BrushStopModel.Black; MeasuredL = MeasuredB = MeasuredA = null; TestColor = null; - if (brushstop.TestVFTID > 0) - { - List<TestColor> all = TrialsLogEngine.Default.GetAll(); - TestColor = all.FirstOrDefault(x=> x.ID == brushstop.TestVFTID); - } + TestColor = TrialsLogEngine.Default.GetByBrushStopGuid(BrushStopModel.Guid); - if (TestColor == null || TestColor.TrialslogList.Count > 1) + if (TestColor == null) { - TestColor = new TestColor() { L = TargetL, A = TargetA, B = TargetB }; ActiveLogModel = new TrialsLogModel(0, Cyan, Magenta, Yellow, Black); TrialsLogitems = new SynchronizedObservableCollection<TrialsLogModel>(); TrialsLogitems.Add(ActiveLogModel); } else { - TrialsLogitems = new SynchronizedObservableCollection<TrialsLogModel>( TestColor.TrialslogList); - ActiveLogModel = TrialsLogitems.LastOrDefault(); + TrialsLogitems = new SynchronizedObservableCollection<TrialsLogModel>(TestColor.TrialslogList.OrderByDescending(x=>x.TrialNumber)); + TrialsLogitems.ToList().ForEach(x => x.IsTested = true); + int maxTrialsNumber = TrialsLogitems.Max( x=>x.TrialNumber); + ActiveLogModel = TrialsLogitems.FirstOrDefault(x => x.TrialNumber == maxTrialsNumber); if (ActiveLogModel == null) { ActiveLogModel = new TrialsLogModel(0, Cyan, Magenta, Yellow, Black); TrialsLogitems.Add(ActiveLogModel); } + ActiveLogModel.IsActiveTrial = true; + ActiveLogModel.IsTested = false; + ActiveLogModel.IsSelectionEnable = false; + var minValue = TrialsLogitems.Min(x => x.DeltaE); + if(minValue != null && minValue < 2) + { + TrialsLogitems.Where(x=>x.DeltaE == minValue).ToList().ForEach(i => i.IsBest = true); + } + + OKCommand.RaiseCanExecuteChanged(); } IsVisible = true; RaisePropertyChanged(nameof(TrialsLogitems)); @@ -455,9 +494,59 @@ namespace Tango.PPC.Jobs.Dialogs return (SelectedLog != null && SelectedLog.IsTested); } - private void ExportTrialsLog(object obj) + private async void ExportTrialsLog(object obj) { + if (!StorageProvider.IsConnected) + { + await NotificationProvider.ShowError("No storage device connected."); + return; + } + //var result = await NavigationManager. + // NavigateForResult<StorageModule, + // Storage.Views.MainView, ExplorerFileItem, + // StorageNavigationRequest>( + // new StorageNavigationRequest() + // { + // Intent = StorageNavigationIntent.SaveFile, + // DefaultFileName = "Color_Correction_Report", + // Filter = ExplorerFileDefinition.PDFFile.Extension, + // Title = "Save Color Correction Report", + // }); + + // if (result != null) + { + ColorCorrectionRepotVM vm = new ColorCorrectionRepotVM() + { + JobName = BrushStopModel.SegmentModel.Job.Name, + TargetColor = String.Format($"L*{TargetL} a*{TargetA} b*{TargetB}") + }; + foreach (var item in TrialsLogitems) + { + vm.ReportItems.Add(new ColorCorrectionReportLogItem() + { + TrialsNumber = item.TrialNumber, + Date = item.Date, + CMYK = item.CMYK, + MeasuredLAB = item.LAB, + DeltaE = item.DeltaE, + IsBest = item.IsBest + }); + } + try + { + PdfWpfWriter writer = new PdfWpfWriter(); + writer.AddElement(new ColorCorrectionReport() { DataContext = vm }); + // writer.Save(result.Path + ExplorerFileDefinition.PDFFile.Extension); + writer.Save(StorageProvider.Drive.Name + "//Color Correction Report" + ExplorerFileDefinition.PDFFile.Extension); + await NotificationProvider.ShowSuccess("Job saved successfully."); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error saving color correction report to file."); + await NotificationProvider.ShowError($"An error occurred while trying to save the color correction report.\n{ex.Message}"); + } + } } private void ClearTrialsLog(object obj) @@ -475,10 +564,32 @@ namespace Tango.PPC.Jobs.Dialogs } - protected override void Accept() + private void DeleteTrialLog(object obj) { - OnClose(); + if (SelectedLog != null && SelectedLog != ActiveLogModel) + { + TrialsLogitems.Remove(SelectedLog); + SelectedLog = null; + var minDelataE = TrialsLogitems.Min(x => x.DeltaE); + if (minDelataE != null && minDelataE < 2) + TrialsLogitems.ToList().ForEach(x => x.IsBest = (x.DeltaE == minDelataE)); + } + } + protected override async void Accept() + { + if(IsBusy) + return; + IsBusy = true; + OnClose(); + + if( SelectedLog.DeltaE >=2) + { + if( false == await NotificationProvider.ShowQuestion("Please note that the color you have chosen is not the closest one.")) + { + return; + } + } BrushStopModel.L = (double)SelectedLog.L; BrushStopModel.A = (double)SelectedLog.A; BrushStopModel.PreventPropertyUpdate = false; @@ -488,26 +599,42 @@ namespace Tango.PPC.Jobs.Dialogs BrushStopModel.Yellow = SelectedLog.TestY; BrushStopModel.Black = SelectedLog.TestK; - if (TestColor != null && TestColor.TrialslogList.Count > 1) + if (TestColor != null) { - TestColor.Delete(); + TrialsLogEngine.Default.Delete(TestColor); } + IsBusy = false; base.Accept(); } + protected override void Cancel() { OnClose(); - if ( TrialsLogitems.Count > 1) + if (TestColor != null && TrialsLogitems.Count > 1) { - TestColor = TrialsLogEngine.Default.AddTest(TargetL, TargetA, TargetB); - TestColor.TrialslogList.Clear(); - foreach ( var item in TrialsLogitems) + if (TrialsLogitems.Count > 1) { - TestColor.AddToList(item); + TestColor.L = TargetL; + TestColor.A = TargetA; + TestColor.B = TargetB; + TestColor.BrushStopGuid = BrushStopModel.Guid; + TestColor.TrialslogList.Clear(); + TestColor.TrialslogList.AddRange(TrialsLogitems); + TrialsLogEngine.Default.UpdateTest(TestColor); } - - BrushStopModel.TestVFTID = TestColor.ID; + else + TrialsLogEngine.Default.Delete(TestColor); + } + else if(TrialsLogitems.Count > 1) + { + TestColor = new TestColor(); + TestColor.BrushStopGuid = BrushStopModel.Guid; + TestColor.L = TargetL; + TestColor.A = TargetA; + TestColor.B = TargetB; + TestColor.TrialslogList.AddRange(TrialsLogitems); + TrialsLogEngine.Default.AddTest(TestColor); } base.Cancel(); } @@ -538,15 +665,13 @@ namespace Tango.PPC.Jobs.Dialogs BrushStopModel.PreventPropertyUpdate = true; BrushStopModel.L = (double)MeasuredL; BrushStopModel.A = (double)MeasuredA; - BrushStopModel.PreventPropertyUpdate = false; BrushStopModel.B = (double)MeasuredB; - if(BrushStopModel.IsOutOfGamut) - { - /// - } - + BrushStopModel.PreventPropertyUpdate = false; + //convergion? Out of gammut???? + var deltaE = DeltaE_CMC(TargetL, TargetA, TargetB, (double)MeasuredL, (double)MeasuredA, (double)MeasuredB); ActiveLogModel.DeltaE = deltaE; + ValidationTests(); } TestCommand.RaiseCanExecuteChanged(); } @@ -557,7 +682,7 @@ namespace Tango.PPC.Jobs.Dialogs private async void StartJob() { - if(ActiveLogModel.DeltaE <= 0.5) + if (ActiveLogModel.DeltaE <= 0.5) { await NotificationProvider.ShowInfo("Previous trial seems to be very close; no more trials are recommended"); return; @@ -581,7 +706,7 @@ namespace Tango.PPC.Jobs.Dialogs Segment segment = new Segment(); segment.Name = "Standard Segment"; - segment.Length = 10;//100*2 + segment.Length = settings.FineTuningTrialLengthMeters; segment.Job = job; segment.JobGuid = job.Guid; @@ -591,7 +716,7 @@ namespace Tango.PPC.Jobs.Dialogs stop.Segment = segment; stop.ColorSpace = db.ColorSpaces.FirstOrDefault(x => x.Code == (int)ColorSpaces.Volume); stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, job.Rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault()); - + stop.SetVolume(LiquidTypes.Cyan, BrushStopModel.Cyan); stop.SetVolume(LiquidTypes.Magenta, BrushStopModel.Magenta); stop.SetVolume(LiquidTypes.Yellow, BrushStopModel.Yellow); @@ -626,12 +751,12 @@ namespace Tango.PPC.Jobs.Dialogs e.JobHandler.StatusChanged += JobHandler_StatusChanged; e.JobHandler.Stopped += JobHandler_Stopped; e.JobHandler.Completed += JobHandler_Completed; - + //e.JobHandler.CanCancelChanged += JobHandler_CanCancelChanged; } } - + /// <summary> /// Handles the Stopped event of the JobHandler. @@ -667,11 +792,11 @@ namespace Tango.PPC.Jobs.Dialogs private void MachineOperator_PrintingEnded(object sender, PrintingEventArgs e) { } - + private void MachineOperator_PrintingCompleted(object sender, PrintingEventArgs e) { LogManager.Log($"'{e.Job.Name}' printing complete. Job designation is {e.Job.Designation}."); - + // if (e.Job.Designation == BL.Enumerations.JobDesignations.FineTuning) //{ @@ -706,36 +831,40 @@ namespace Tango.PPC.Jobs.Dialogs private void JobHandler_Completed(object sender, EventArgs e) { - if(_handler != null) + if (_handler != null) { if (IsVisible) { IsJobRunning = false; - // Dispatcher.CurrentDispatcher.Invoke(() => - // { - ActiveLogModel.IsTested = true; - ActiveLogModel.Date = DateTime.UtcNow; - Cyan = BrushStopModel.Cyan; - Magenta = BrushStopModel.Magenta; - Yellow = BrushStopModel.Yellow; - Black = BrushStopModel.Black; - ActiveLogModel.TestC = BrushStopModel.Cyan; - ActiveLogModel.TestM = BrushStopModel.Magenta; - ActiveLogModel.TestY = BrushStopModel.Yellow; - ActiveLogModel.TestK = BrushStopModel.Black; + // Dispatcher.CurrentDispatcher.Invoke(() => + // { + ActiveLogModel.IsTested = true; + ActiveLogModel.Date = DateTime.UtcNow; + Cyan = BrushStopModel.Cyan; + Magenta = BrushStopModel.Magenta; + Yellow = BrushStopModel.Yellow; + Black = BrushStopModel.Black; + ActiveLogModel.TestC = BrushStopModel.Cyan; + ActiveLogModel.TestM = BrushStopModel.Magenta; + ActiveLogModel.TestY = BrushStopModel.Yellow; + ActiveLogModel.TestK = BrushStopModel.Black; if (ActiveLogModel != null && ActiveLogModel.TrialNumber < 10) - { - ActiveLogModel = new TrialsLogModel(ActiveLogModel.TrialNumber + 1, Cyan, Magenta, Yellow, Black); - TrialsLogitems.Insert(0, ActiveLogModel); - RaisePropertyChanged(nameof(TrialsLogitems)); - _measuredL = null; - _measuredB = null; - _measuredA = null; - RaisePropertyChanged(nameof(MeasuredL)); - RaisePropertyChanged(nameof(MeasuredA)); - RaisePropertyChanged(nameof(MeasuredB)); - RaisePropertyChanged(nameof(TrialNumber)); - } + { + ActiveLogModel = new TrialsLogModel(ActiveLogModel.TrialNumber + 1, Cyan, Magenta, Yellow, Black); + TrialsLogitems.Insert(0, ActiveLogModel); + var minDelataE = TrialsLogitems.Min(x=>x.DeltaE); + if(minDelataE != null && minDelataE < 2) + TrialsLogitems.ToList().ForEach( x=> x.IsBest = (x.DeltaE == minDelataE)); + + RaisePropertyChanged(nameof(TrialsLogitems)); + _measuredL = null; + _measuredB = null; + _measuredA = null; + RaisePropertyChanged(nameof(MeasuredL)); + RaisePropertyChanged(nameof(MeasuredA)); + RaisePropertyChanged(nameof(MeasuredB)); + RaisePropertyChanged(nameof(TrialNumber)); + } //}); } @@ -754,7 +883,7 @@ namespace Tango.PPC.Jobs.Dialogs { _handler.Cancel(); IsJobRunning = false; - + InvalidateRelayCommands(); } } @@ -811,6 +940,65 @@ namespace Tango.PPC.Jobs.Dialogs return dECMC; } + double DeltaE_regular(double L1, double a1, double b1, double L2, double a2, double b2) + { + return Math.Sqrt(Math.Pow(L1 - L2, 2) + Math.Pow(a1 - a2, 2) + Math.Pow(b1 - b2, 2)); + } + + private async void ValidationTests() + { + //if (ActiveLogModel.DeltaE <= 0.5) + //{ + // await NotificationProvider.ShowInfo("Previous trial seems to be very close; no more trials are recommended"); + // return ; + //} + if (TrialsLogitems.Count == 1 || ActiveLogModel.DeltaE == null) + return ; + + if(TrialsLogitems.Count >= 3) + { + var currentTrialNumber = ActiveLogModel.TrialNumber; + var item = TrialsLogitems [TrialsLogitems.Count- 3]; + var item1 = TrialsLogitems[TrialsLogitems.Count - 2]; + var item2 = TrialsLogitems[TrialsLogitems.Count - 1]; + //dEi+2- dEi+1>0.5 and dEi+1-dEi>0.5 + if (( item2.DeltaE - item1.DeltaE) > 0.5 && (item1.DeltaE - item.DeltaE) > 0.5) + { + await NotificationProvider.ShowInfo("It seems that we can’t get you any closer"); + return ; + } + //Math.Abs + //| dEi+1- dEi | and |dEi+2 -dEi+1|<=0.1. + if(Math.Abs((double)item1.DeltaE - (double)item.DeltaE)<= 0.1 && Math.Abs((double)item2.DeltaE - (double)item1.DeltaE) <= 0.1) + { + await NotificationProvider.ShowInfo("It seems that we can’t get you any closer"); + return; + } + } + + + if (TrialsLogitems.Count >= 2) + { + var item = TrialsLogitems[TrialsLogitems.Count - 2]; + var item1 = TrialsLogitems[TrialsLogitems.Count - 1]; + var deltaE_reg = DeltaE_regular(TargetL, TargetA, TargetB, (double)MeasuredL, (double)MeasuredA, (double)MeasuredB); + if ((Math.Abs((double)item1.L - (double)item.L) < 0.1 && Math.Abs((double)item1.A - (double)item.A) < 0.1 && Math.Abs((double)item1.B - (double)item.B) < 0.1) + || deltaE_reg < 0.2) + { + await NotificationProvider.ShowInfo("It seems that we can’t get you any closer"); + return; + } + if(Math.Abs((double)item1.C - (double)item.C) < 0.1 + && Math.Abs((double)item1.M - (double)item.M) < 0.1 + && Math.Abs((double)item1.Y - (double)item.Y) < 0.1 + && Math.Abs((double)item1.K - (double)item.K) < 0.1) + { + await NotificationProvider.ShowInfo("It seems that we can’t get you any closer"); + return; + } + } + return; + } #endregion diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/logo.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/logo.png Binary files differnew file mode 100644 index 000000000..75e491626 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/logo.png 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 db38a55d5..2f48ce0f8 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 @@ -17,12 +17,12 @@ using Tango.Core.ExtensionMethods; namespace Tango.PPC.Jobs.Models { - public class BrushStopModel : ViewModel + public class BrushStopModel : ViewModel { public enum PositionStatus { First = 1, - FirstColor = 2, + FirstColor = 2, Middle = 3, SecondColor = 4, Last = 5 @@ -37,6 +37,8 @@ namespace Tango.PPC.Jobs.Models #region Property + public String Guid { get; set; } + public bool PreventPropertyUpdate { get; set; } protected Double _cyan; @@ -444,11 +446,13 @@ namespace Tango.PPC.Jobs.Models public PositionStatus Position { get { return _position; } - set { _position = value; + set + { + _position = value; RaisePropertyChangedAuto(); } } - + protected ColorSpaces _colorspace; public virtual ColorSpaces ColorSpace @@ -489,7 +493,7 @@ namespace Tango.PPC.Jobs.Models } } - + /// <summary> /// Gets or sets the color catalog. /// </summary> @@ -500,7 +504,7 @@ namespace Tango.PPC.Jobs.Models { get { - if(ColorCatalogsItem != null && ColorCatalogsItem.ColorCatalogsGroup!= null) + if (ColorCatalogsItem != null && ColorCatalogsItem.ColorCatalogsGroup != null) return ColorCatalogsItem.ColorCatalogsGroup.ColorCatalog; return null; @@ -516,7 +520,7 @@ namespace Tango.PPC.Jobs.Models } set { - if(_color != value) + if (_color != value) { _color = value; RaisePropertyChangedAuto(); @@ -530,7 +534,8 @@ namespace Tango.PPC.Jobs.Models public System.Windows.Media.Color BestMatchColor { get { return _bestMatchColor; } - set { + set + { _bestMatchColor = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(BestMatchA)); @@ -539,11 +544,12 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChanged(nameof(ShownBestMatchColor)); } } - + public System.Windows.Media.Color ShownBestMatchColor { - get { - if(IsOutOfGamut) + get + { + if (IsOutOfGamut) return _bestMatchColor; return System.Windows.Media.Colors.Transparent; } @@ -554,7 +560,7 @@ namespace Tango.PPC.Jobs.Models { get { - if(Color == null) + if (Color == null) { InitColor(); } @@ -569,7 +575,7 @@ namespace Tango.PPC.Jobs.Models get { return _segmentmodel; } set { _segmentmodel = value; } } - + private bool _outOfGamutChecked; /// <summary> @@ -600,17 +606,20 @@ namespace Tango.PPC.Jobs.Models protected bool RequiredMaxLiquidTest { get; set; } - public Int32 TestVFTID { get;set; } - #endregion #region constructors - public BrushStopModel(SegmentModel segmentModel) + public BrushStopModel() + { + Guid = System.Guid.NewGuid().ToString(); + } + + public BrushStopModel(SegmentModel segmentModel) : this() { InitDefaultValues(); SegmentModel = segmentModel; - + Color = Colors.White; ColorSpace = ColorSpaces.Volume; ColorCatalogsItem = null; @@ -619,9 +628,10 @@ namespace Tango.PPC.Jobs.Models RequiredMaxLiquidTest = false; } - public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel, int version) + public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel, int version) : this() { InitDefaultValues(); + Guid = brushStop.Guid; SegmentModel = segmentModel; OffsetPercent = brushStop.OffsetPercent; Color = brushStop.Color; @@ -629,9 +639,9 @@ namespace Tango.PPC.Jobs.Models ColorSpace = brushStop.ColorSpace.Space; _colorcatalogsitem = brushStop.ColorCatalogsItem; _stopindex = brushStop.StopIndex; - + PreventPropertyUpdate = true; - if(version == 1) + if (version == 1) { Cyan = brushStop.GetVolume(LiquidTypes.Cyan); Magenta = brushStop.GetVolume(LiquidTypes.Magenta); @@ -676,8 +686,6 @@ namespace Tango.PPC.Jobs.Models _volumeConversionTimer = new ActionTimer(TimeSpan.FromMilliseconds(50)); _converter = new DefaultColorConverter(); _bestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); - - TestVFTID = 0; } #endregion @@ -694,14 +702,14 @@ namespace Tango.PPC.Jobs.Models } else { - Color = Color.FromRgb((byte)_red, (byte)_green, (byte)_blue); + Color = Color.FromRgb((byte)_red, (byte)_green, (byte)_blue); } } /// <summary> /// Sets the new color from MyColors. /// </summary> - public void SetNewColor( BrushStopModel newBrushStop) + public void SetNewColor(BrushStopModel newBrushStop) { ColorSpace = newBrushStop.ColorSpace; PreventPropertyUpdate = true; @@ -722,7 +730,7 @@ namespace Tango.PPC.Jobs.Models Black = newBrushStop.Black; ColorCatalogsItem = newBrushStop.ColorCatalogsItem; PreventPropertyUpdate = false; - + Color = newBrushStop.Color; BestMatchColor = newBrushStop.BestMatchColor; } @@ -732,48 +740,48 @@ namespace Tango.PPC.Jobs.Models /// </summary> public BrushStop CreateBrushStop(ColorSpaces colorSpace) { - List<Tango.BL.Entities.ColorSpace> list = SegmentModel.Job.ColorSpacesList; + List<Tango.BL.Entities.ColorSpace> list = SegmentModel.Job.ColorSpacesList; - BrushStop s = new BrushStop(); - s.ColorSpace = list.FirstOrDefault(x => x.Space == colorSpace); + BrushStop s = new BrushStop(); + s.ColorSpace = list.FirstOrDefault(x => x.Space == colorSpace); - Configuration configuration = SegmentModel.Job.Machine.Configuration; - Rml rml = SegmentModel.Job.Rml; - s.SetLiquidVolumes(configuration, rml, rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault()); + Configuration configuration = SegmentModel.Job.Machine.Configuration; + Rml rml = SegmentModel.Job.Rml; + s.SetLiquidVolumes(configuration, rml, rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault()); - 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); - } - else if(s.ColorSpace.Space == ColorSpaces.LAB) - { - s.ColorSpace.Space = BL.Enumerations.ColorSpaces.LAB; - s.L = this.L; - s.A = this.A; - s.B = this.B; - } - else if (s.ColorSpace.Space == ColorSpaces.RGB) - { - s.ColorSpace.Space = BL.Enumerations.ColorSpaces.RGB; - s.Red = this.Red; - s.Green = this.Green; - s.Blue = this.Blue; - } - else if(s.ColorSpace.Space == ColorSpaces.HSB) - { - s.ColorSpace.Space = BL.Enumerations.ColorSpaces.RGB; - s.Red = this.Red; - s.Green = this.Green; - s.Blue = this.Blue; - } + 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); + } + else if (s.ColorSpace.Space == ColorSpaces.LAB) + { + s.ColorSpace.Space = BL.Enumerations.ColorSpaces.LAB; + s.L = this.L; + s.A = this.A; + s.B = this.B; + } + else if (s.ColorSpace.Space == ColorSpaces.RGB) + { + s.ColorSpace.Space = BL.Enumerations.ColorSpaces.RGB; + s.Red = this.Red; + s.Green = this.Green; + s.Blue = this.Blue; + } + else if (s.ColorSpace.Space == ColorSpaces.HSB) + { + s.ColorSpace.Space = BL.Enumerations.ColorSpaces.RGB; + s.Red = this.Red; + s.Green = this.Green; + s.Blue = this.Blue; + } - return s; + return s; } - + public BrushStopModel Clone() { var cloned = new BrushStopModel(SegmentModel); @@ -809,11 +817,10 @@ namespace Tango.PPC.Jobs.Models //this.MapPropertiesTo(cloned, MappingFlags.NoReferenceTypes); cloned.PreventPropertyUpdate = false; cloned.RequiredMaxLiquidTest = false; - cloned.TestVFTID = TestVFTID; return cloned; } - public static Color GetRelativeRGB(Color first, Color second, double firstOffset, double secondOffset, double offset) + public static Color GetRelativeRGB(Color first, Color second, double firstOffset, double secondOffset, double offset) { var color = new Color(); var range = (secondOffset - firstOffset); @@ -832,15 +839,15 @@ namespace Tango.PPC.Jobs.Models Color = favoriteColor.Color; BestMatchColor = favoriteColor.Color; ColorSpace = favoriteColor.ColorSpace; - // _colorcatalogsitem = favoriteColor.ColorCatalogsItem; - + // _colorcatalogsitem = favoriteColor.ColorCatalogsItem; + PreventPropertyUpdate = true; - + Cyan = favoriteColor.Cyan; Magenta = favoriteColor.Magenta; Yellow = favoriteColor.Yellow; Black = favoriteColor.Black; - + Red = favoriteColor.Red; Green = favoriteColor.Green; Blue = favoriteColor.Blue; @@ -866,7 +873,7 @@ namespace Tango.PPC.Jobs.Models RequiredMaxLiquidTest = true; RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); OnBrushStopFieldValueChanged(); - + } private void OnRGBChanged() { @@ -916,7 +923,7 @@ namespace Tango.PPC.Jobs.Models InitColor(); BestMatchColor = Color; } - + if (ColorCatalogsItemChanged != null) { ColorCatalogsItemChanged.Invoke(this, new EventArgs()); @@ -926,7 +933,7 @@ namespace Tango.PPC.Jobs.Models { //lenth? } - + private void OnStopIndexChanged() { //throw new NotImplementedException(); @@ -934,19 +941,19 @@ namespace Tango.PPC.Jobs.Models private Rgb GetRGBColor() { - if(ColorSpace == ColorSpaces.LAB) + if (ColorSpace == ColorSpaces.LAB) { Lab lab = new Lab(L, A, B); Rgb rgb = new Rgb(lab.ToRgb()); return rgb; } - if(ColorSpace == ColorSpaces.HSB) + if (ColorSpace == ColorSpaces.HSB) { Hsb hsb = new Hsb(Hue, Saturation / 100, Brightness / 100); Rgb rgb = new Rgb(hsb.ToRgb()); return rgb; } - if(ColorSpace == ColorSpaces.Catalog && ColorCatalogsItem != null) + if (ColorSpace == ColorSpaces.Catalog && ColorCatalogsItem != null) { return new Rgb(ColorCatalogsItem.Red, ColorCatalogsItem.Green, ColorCatalogsItem.Blue); } @@ -955,7 +962,7 @@ namespace Tango.PPC.Jobs.Models public void ConvertColorToHSB() { - if(ColorSpace != ColorSpaces.HSB) + if (ColorSpace != ColorSpaces.HSB) { Hsb hsb = null; @@ -992,7 +999,7 @@ namespace Tango.PPC.Jobs.Models Rgb rgb = new Rgb(Red, Green, Blue); hsb = new Hsb(rgb.To<Hsb>()); } - else if(ColorSpace == ColorSpaces.Catalog && ColorCatalogsItem != null) + else if (ColorSpace == ColorSpaces.Catalog && ColorCatalogsItem != null) { Rgb rgb = new Rgb(ColorCatalogsItem.Red, ColorCatalogsItem.Green, ColorCatalogsItem.Blue); hsb = new Hsb(rgb.To<Hsb>()); @@ -1096,7 +1103,7 @@ namespace Tango.PPC.Jobs.Models { lab = new Lab(ColorCatalogsItem.L, ColorCatalogsItem.A, ColorCatalogsItem.B); } - if(lab != null) + if (lab != null) { _l = lab.L; _a = lab.A; @@ -1149,7 +1156,7 @@ 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) ; + _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); @@ -1186,13 +1193,13 @@ namespace Tango.PPC.Jobs.Models if (BestMatchColor == null) BestMatchColor = Color; var closestItem = catalogs.SelectMany(x => x.AllItemsOrdered).GetClosestItem(BestMatchColor); - + ColorCatalogsItem = closestItem; ColorSpace = ColorSpaces.Catalog; RaisePropertyChanged(nameof(ColorCatalog)); } } - + public void RaiseOffsetChanged() { RaisePropertyChanged(nameof(OffsetPercent)); @@ -1247,7 +1254,7 @@ namespace Tango.PPC.Jobs.Models } } - public double GetColorNLPerCm(double color,LiquidTypes type ) + public double GetColorNLPerCm(double color, LiquidTypes type) { StandardColorDispensingCalc calc = new StandardColorDispensingCalc(); @@ -1260,13 +1267,13 @@ namespace Tango.PPC.Jobs.Models } return 0.0; } - - + + public bool IsLiquidVolumesOutOfRange { get { - if (RequiredMaxLiquidTest ) + if (RequiredMaxLiquidTest) { var sum = GetColorNLPerCm(Cyan, LiquidTypes.Cyan) + GetColorNLPerCm(Magenta, LiquidTypes.Magenta) + GetColorNLPerCm(Yellow, LiquidTypes.Yellow) + GetColorNLPerCm(Black, LiquidTypes.Black); var maxLiq = GetTotalMaximumLiquidNlPerCMLimit(); @@ -1283,97 +1290,88 @@ namespace Tango.PPC.Jobs.Models public bool LiquidVolumesOutOfRange { get { return _liquidVolumesOutOfRange; } - set { - if(_liquidVolumesOutOfRange != value) + set + { + if (_liquidVolumesOutOfRange != value) { _liquidVolumesOutOfRange = value; LiquidVolumesOutOfRangeChanged?.Invoke(this, new EventArgs()); } } } - + public void OnBrushStopFieldValueChanged() { IsBusy = true; - _volumeConversionTimer.ResetReplace( () => - { - try - { - ColorSpaces colorSpace = ColorSpace; + _volumeConversionTimer.ResetReplace(() => + { + if (ColorSpace == BL.Enumerations.ColorSpaces.Volume) + { + //RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + if (IsLiquidVolumesOutOfRange) + { + IsBusy = false; + return; + } + ConvertColor(); + } + }); + } - BrushStop stop = CreateBrushStop(colorSpace); + public void ConvertColor() + { + try + { + ColorSpaces colorSpace = ColorSpace; - Configuration configuration = SegmentModel.Job.Machine.Configuration; - Rml rml = SegmentModel.Job.Rml; - - if ( ColorSpace == BL.Enumerations.ColorSpaces.Volume) - { - //RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); - if(IsLiquidVolumesOutOfRange) - { - IsBusy = false; - return; - } - } - - var output = _converter.Convert(stop, configuration, rml, false, false, false); - //output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume; - - if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume) - { - IsOutOfGamut = false; - _red = output.SingleCoordinates.Red; - _green = output.SingleCoordinates.Green; - _blue = output.SingleCoordinates.Blue; - InitColor(); - BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); - - } - else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.LAB) - { - IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); - BestMatchL = (double)output.SingleCoordinates.L; - BestMatchA = (double)output.SingleCoordinates.A; - BestMatchB = (double)output.SingleCoordinates.B; - Lab lab = new Lab(output.SingleCoordinates.L, output.SingleCoordinates.A, output.SingleCoordinates.B); - Rgb rgb = new Rgb(lab.ToRgb()); - BestMatchColor = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); - //TODO ASK ROY - //foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) - //{ - // var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == outputLiquid.LiquidType.ToInt32()); + BrushStop stop = CreateBrushStop(colorSpace); - // if (liquidVolume == null) - // { - // throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + outputLiquid.LiquidType + "'."); - // } + Configuration configuration = SegmentModel.Job.Machine.Configuration; + Rml rml = SegmentModel.Job.Rml; + var output = _converter.Convert(stop, configuration, rml, false, false, false); + //output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan).Volume; - // liquidVolume.Volume = outputLiquid.Volume; - //} - } - else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB) - { - IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); - BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); - } - else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.HSB) - { - IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); - BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); - } - } - catch (Exception ex) - { - LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine." + ex); - BestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); - } - finally - { - IsBusy = false; - } - }); + if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume) + { + IsOutOfGamut = false; + _red = output.SingleCoordinates.Red; + _green = output.SingleCoordinates.Green; + _blue = output.SingleCoordinates.Blue; + InitColor(); + BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + } + else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.LAB) + { + IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); + BestMatchL = (double)output.SingleCoordinates.L; + BestMatchA = (double)output.SingleCoordinates.A; + BestMatchB = (double)output.SingleCoordinates.B; + Lab lab = new Lab(output.SingleCoordinates.L, output.SingleCoordinates.A, output.SingleCoordinates.B); + Rgb rgb = new Rgb(lab.ToRgb()); + BestMatchColor = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + } + else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB) + { + IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); + BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + } + else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.HSB) + { + IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); + BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine." + ex); + BestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + } + finally + { + IsBusy = false; + } } #endregion diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs index a82f69ead..a83e0e595 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs @@ -12,11 +12,10 @@ namespace Tango.PPC.Jobs.Models { public class TestColor : ExtendedObject { - public List<TrialsLogModel> TrialslogList { get; set; } - [BsonId] - public Int32 ID { get; set; } - + public String BrushStopGuid { get; set; } + + public List<TrialsLogModel> TrialslogList { get; set; } public double L { get; set; } public double A { get; set; } @@ -26,45 +25,6 @@ namespace Tango.PPC.Jobs.Models { TrialslogList = new List<TrialsLogModel>(); } - - public void AddToList(TrialsLogModel log) - { - TrialslogList.Add(log); - RaisePropertyChanged(nameof(TrialslogList)); - - Task.Factory.StartNew(() => - { - TrialsLogEngine.Default.UpdateTest(this); - }); - } - - public void RemoveFromLibrary(TrialsLogModel log) - { - TrialslogList.Remove(log); - RaisePropertyChanged(nameof(TrialslogList)); - - Task.Factory.StartNew(() => - { - TrialsLogEngine.Default.UpdateTest(this); - }); - } - - public void UpdateLibrary() - { - Task.Factory.StartNew(() => - { - TrialsLogEngine.Default.UpdateTest(this); - }); - } - - public void Delete() - { - Task.Factory.StartNew(() => - { - TrialsLogEngine.Default.Delete(this); - }); - } - } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TrialsLogModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TrialsLogModel.cs index 9ae17ec03..2e56c3780 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TrialsLogModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TrialsLogModel.cs @@ -1,4 +1,5 @@ -using System; +using LiteDB; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -24,7 +25,7 @@ namespace Tango.PPC.Jobs.Models } } - + [BsonIgnore] public string Trial { get { if(TrialNumber == 0) @@ -62,6 +63,7 @@ namespace Tango.PPC.Jobs.Models public double Y { get; set; } public double K { get; set; } + [BsonIgnore] public string CMYK { get @@ -70,9 +72,13 @@ namespace Tango.PPC.Jobs.Models } } + [BsonIgnore] public double TestC { get; set; } + [BsonIgnore] public double TestM { get; set; } + [BsonIgnore] public double TestY { get; set; } + [BsonIgnore] public double TestK { get; set; } private DateTime _date; @@ -89,11 +95,24 @@ namespace Tango.PPC.Jobs.Models { get { return _deltaE; } set { _deltaE = value; - RaisePropertyChangedAuto(); } + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(DeltaEDisplay)); + } } + public string DeltaEDisplay + { + get + { + if (DeltaE == null) + return ""; + // if (IsBest) + // return String.Format($"{DeltaE:0.##} Best"); + return String.Format($"{DeltaE:0.##}"); + } + } private bool _IsActiveTrial; - + [BsonIgnore] public bool IsActiveTrial { get { return _IsActiveTrial; } @@ -101,7 +120,8 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChangedAuto(); } } - + + [BsonIgnore] public string LAB { get { @@ -110,7 +130,44 @@ namespace Tango.PPC.Jobs.Models return String.Format("{0:0.##},{1:0.##},{2:0.##}", L, A, B); } } - public bool IsTested { get; set; } + private bool _istested; + + public bool IsTested + { + get { return _istested; } + set + { + _istested = value; + if (_istested) + { + IsSelectionEnable = true; + } + } + } + + private bool _isBest; + + public bool IsBest + { + get { return _isBest; } + set { _isBest = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(DeltaEDisplay));} + } + + + + + private bool _isSelectionEnable; + [BsonIgnore] + public bool IsSelectionEnable + { + get { return _isSelectionEnable; } + set { _isSelectionEnable = value; + RaisePropertyChangedAuto(); + } + } + #endregion @@ -127,6 +184,8 @@ namespace Tango.PPC.Jobs.Models Date = DateTime.UtcNow; RaisePropertyChanged(nameof(CMYK)); IsTested = false; + IsSelectionEnable = false; + IsBest = false; } #region Methods diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Reports/ColorCorrectionReport.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Reports/ColorCorrectionReport.xaml new file mode 100644 index 000000000..0871dfd1b --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Reports/ColorCorrectionReport.xaml @@ -0,0 +1,79 @@ +<UserControl x:Class="Tango.PPC.Jobs.Reports.ColorCorrectionReport" + 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.PPC.Jobs.Reports" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800"> + <UserControl.Resources> + <Style x:Key="CCRGridColumnHeaderStyle" TargetType="{x:Type DataGridColumnHeader}"> + <Setter Property="Height" Value="50"/> + <Setter Property="FontSize" Value="14"/> + <Setter Property="FontWeight" Value="SemiBold"/> + <Setter Property="HorizontalAlignment" Value="Stretch"/> + <Setter Property="HorizontalContentAlignment" Value="Left"/> + <Setter Property="Background" Value="#7A7A7A"/> + <Setter Property="Foreground" Value="White"/> + <Setter Property="BorderThickness" Value="0,0,0,1"/> + </Style> + <Style x:Key="CCRDataGridStyle" TargetType="{x:Type DataGrid}"> + <Setter Property="BorderBrush" Value="#4B4B4B"/> + <Setter Property="BorderThickness" Value="0.5"/> + <Setter Property="GridLinesVisibility" Value="Horizontal"/> + <Setter Property="ColumnHeaderStyle" Value="{DynamicResource CCRGridColumnHeaderStyle}"/> + </Style> + </UserControl.Resources> + <Grid> + <StackPanel Orientation="Vertical" Margin="30"> + <DockPanel Height="120" VerticalAlignment="Top" > + <TextBlock DockPanel.Dock="Right" FontSize="12" Text="{Binding Date, StringFormat='{}{0:MM/dd/yyyy hh:mm}'}" VerticalAlignment="Bottom" HorizontalAlignment="Right"/> + <Image DockPanel.Dock="Left" Source="../Images/logo.png" Stretch="Uniform" HorizontalAlignment="Left" Margin="40 0 0 0" Width="282" VerticalAlignment="Top" MinHeight="106"></Image> + + </DockPanel> + <TextBlock Margin="0 40 0 0" Text=" Color Correction Report" FontSize="30" FontWeight="SemiBold" HorizontalAlignment="Center"/> + <TextBlock Margin="0 20 0 0"> + <Run Text="Job Name:" FontSize="19" ></Run> + <Run Text="{Binding JobName}" FontSize="19" ></Run> + </TextBlock> + <TextBlock Margin="0 20 0 0"> + <Run Text="Target color:" FontSize="19" ></Run> + <Run Text="{Binding TargetColor}" FontSize="19" ></Run> + </TextBlock> + <TextBlock Margin="0 20 0 20" FontSize="19" Text="Trials Log:"/> + <DataGrid Height="Auto" Width="550" ItemsSource="{Binding ReportItems}" RowHeight="30" HeadersVisibility="Column" CanUserAddRows="false" CanUserResizeColumns="False" IsReadOnly="true" HorizontalAlignment="Left" Style="{StaticResource CCRDataGridStyle}" Foreground="Black" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" TextBlock.TextAlignment="Left"> + <DataGrid.CellStyle> + <Style TargetType="DataGridCell"> + <Setter Property="TextBlock.TextAlignment" Value="Left" /> + </Style> + </DataGrid.CellStyle> + <DataGrid.Columns> + <DataGridTextColumn Header="#" FontSize="12" Binding="{Binding Trial}" Width="40" /> + <DataGridTextColumn Header="Date" FontSize="12" Binding="{Binding Date}" Width="130"/> + <DataGridTextColumn Header="CMYK" FontSize="12" Binding="{Binding CMYK}" Width="130"/> + <DataGridTextColumn Header="Measured L*a*b" FontSize="12" Binding="{Binding MeasuredLAB}" Width="130"/> + <DataGridTemplateColumn Header="dE(CMC)" Width="120"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding DeltaEPrint}" FontSize="12"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Foreground" Value="Black"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding DeltaE, Converter={StaticResource SmallerThanToBooleanConverter}, ConverterParameter=2}" Value="True"> + + <Setter Property="Foreground" Value="{StaticResource TangoGreenBrush}"></Setter> + + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Reports/ColorCorrectionReport.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Reports/ColorCorrectionReport.xaml.cs new file mode 100644 index 000000000..9580413c7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Reports/ColorCorrectionReport.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.PPC.Jobs.Reports +{ + /// <summary> + /// Interaction logic for ColorCorrectionReport.xaml + /// </summary> + public partial class ColorCorrectionReport : UserControl + { + public ColorCorrectionReport() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Reports/ColorCorrectionRepotVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Reports/ColorCorrectionRepotVM.cs new file mode 100644 index 000000000..7e07dfac6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Reports/ColorCorrectionRepotVM.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Jobs.Reports +{ + public class ColorCorrectionReportLogItem + { + public int TrialsNumber { get; set; } + public string Trial + { + get + { + if (TrialsNumber == 0) + return "T"; + return TrialsNumber.ToString(); + } + } + public DateTime Date { get; set; } + public string CMYK { get; set; } + public string MeasuredLAB { get; set; } + public double? DeltaE { get; set; } + public bool IsBest { get; set; } + public string DeltaEPrint + { + get { + if(DeltaE == null) + return""; + //if(IsBest) + // return String.Format($"{DeltaE:0.##} Best"); + return String.Format($"{DeltaE:0.##}"); + } + } + } + + public class ColorCorrectionRepotVM + { + public List<ColorCorrectionReportLogItem> ReportItems { get; set; } + public string JobName { get; set; } + public string TargetColor { get; set; } + public DateTime Date { get; set; } + + public ColorCorrectionRepotVM() + { + ReportItems = new List<ColorCorrectionReportLogItem>(); + Date = DateTime.UtcNow; + } + } +} 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 98a9bad62..41238fda1 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 @@ -156,6 +156,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Reports\ColorCorrectionReport.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Resources\Styles.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -313,6 +317,10 @@ <DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> + <Compile Include="Reports\ColorCorrectionReport.xaml.cs"> + <DependentUpon>ColorCorrectionReport.xaml</DependentUpon> + </Compile> + <Compile Include="Reports\ColorCorrectionRepotVM.cs" /> <Compile Include="UndoRedoCommands\AddBrushStopCommand.cs" /> <Compile Include="UndoRedoCommands\AddNewSegmentCommand.cs" /> <Compile Include="UndoRedoCommands\ChangeLengthCommand.cs" /> @@ -409,6 +417,10 @@ <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PDF\Tango.PDF.csproj"> + <Project>{84fb2b51-213e-4602-a5db-fa97d8ae907a}</Project> + <Name>Tango.PDF</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> <Name>Tango.PMR</Name> @@ -685,10 +697,13 @@ <Resource Include="Images\ColorSelection\CorrectionTrial.png" /> <Resource Include="Images\ColorSelection\Export.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\logo.png" /> + </ItemGroup> <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/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index 36ed2f625..b09d52965 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 @@ -613,12 +613,7 @@ namespace Tango.PPC.Jobs.ViewModels { DyeCommand.RaiseCanExecuteChanged(); } - public override void OnBeforeNavigatedFrom() - { - base.OnBeforeNavigatedFrom(); - //Save... - } - + /// <summary> /// Starts the job. /// </summary> @@ -1142,6 +1137,18 @@ namespace Tango.PPC.Jobs.ViewModels LoadJob(); } + + + public override void OnBeforeNavigatedTo() + { + base.OnBeforeNavigatedTo(); + } + + public override void OnBeforeNavigatedFrom() + { + base.OnBeforeNavigatedFrom(); + } + /// <summary> /// Called when the navigation system has navigated from this VM view. /// </summary> @@ -1360,6 +1367,7 @@ namespace Tango.PPC.Jobs.ViewModels foreach (var stop in innerSegment.BrushStops.OrderBy(x => x.StopIndex).ToList()) { var dbStop = new BrushStop(); + dbStop.Guid = stop.Guid; dbStop.Segment = dbSegment; _db.BrushStops.Add(dbStop); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 59005509e..f057f2e73 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -261,6 +261,14 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _enableProxy = value; RaisePropertyChangedAuto(); } } + private int _manualFineTuningLength; + public int FineTuningLength + { + get { return _manualFineTuningLength; } + set { _manualFineTuningLength = value; RaisePropertyChangedAuto(); } + } + + #endregion #region Commands @@ -317,6 +325,7 @@ namespace Tango.PPC.MachineSettings.ViewModels Settings.SynchronizeDiagnostics = SynchronizeDiagnostics; Settings.AutoCheckForUpdates = AutoCheckForUpdates; Settings.LubricationLevels = LubricationLevels.Where(x => x.LubricationLevel != LubricationLevel.Standard).Select(x => x.ToRmlLubricationLevel()).ToList(); + Settings.FineTuningTrialLengthMeters = FineTuningLength; MachineDataSynchronizer.IsEnabled = SynchronizeJobs || SynchronizeDiagnostics; @@ -519,6 +528,8 @@ namespace Tango.PPC.MachineSettings.ViewModels LockScreenTimeoutMinutes = (int)Settings.LockScreenTimeout.TotalMinutes; LockScreenPassword = Settings.LockScreenPassword; + FineTuningLength = Settings.FineTuningTrialLengthMeters; + SelectedJobTypes = new SelectedObjectCollection<JobTypes>(Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToObservableCollection(), Settings.SupportedJobTypes.ToObservableCollection()); SelectedColorSpaces = new SelectedObjectCollection<ColorSpaces>(Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace()).ToObservableCollection(), Settings.SupportedColorSpaces.ToObservableCollection()); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index bf8777200..74b0ce7e1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -160,6 +160,9 @@ <TextBlock VerticalAlignment="Bottom">Default Segment Length</TextBlock> <touch:TouchNumericTextBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Minimum="1" Maximum="1000" Value="{Binding Settings.DefaultSegmentLength}" HasDecimalPoint="True" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox> + <TextBlock VerticalAlignment="Bottom">Vector Fine Tuning Job Length</TextBlock> + <touch:TouchNumericTextBox HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Minimum="100" Maximum="500" Value="{Binding FineTuningLength}" HasDecimalPoint="False" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox> + <TextBlock VerticalAlignment="Bottom">Use Light Inks When Possible</TextBlock> <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="90" IsChecked="{Binding UseLightInks}"></touch:TouchToggleSlider> </controls:TableGrid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs index 3af921f7d..8d57cbfd0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs @@ -372,7 +372,8 @@ namespace Tango.PPC.Common.Controls { if(collectionFilter.Filter(item.Item)) { - _scrollViewer.ScrollToPosition(item.PositionY - _scrollViewer.ActualHeight / 2); + if (_scrollViewer != null) + _scrollViewer.ScrollToPosition(item.PositionY - _scrollViewer.ActualHeight / 2); break; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index ff6dbce08..ee353917d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -309,6 +309,11 @@ namespace Tango.PPC.Common public bool UseJobsModuleV2 { get; set; } /// <summary> + /// Gets or sets the fine tuning trial length in meters. + /// </summary> + public int FineTuningTrialLengthMeters { get; set; } + + /// <summary> /// Gets the machine service address. /// </summary> /// <returns></returns> @@ -324,6 +329,7 @@ namespace Tango.PPC.Common { LubricationLevels = new List<RmlLubricationLevel>(); JobUploadStrategy = JobUploadStrategy.JobDescriptionFile; + FineTuningTrialLengthMeters = 200; EnableGradientGeneration = true; GradientGenerationResolution = 20; MachineScanningTimeoutSeconds = 20; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 28d8ca5d1..80fce2052 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -582,7 +582,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs index 3e36a418d..9856faf3d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs @@ -64,7 +64,7 @@ namespace Tango.PPC.UI.Printing #else try { - if (_settings.EnableSpoolReplacementDialog && !_machineProvider.MachineOperator.IsSpoolReplaced) + if (job.Designation == JobDesignations.Default && _settings.EnableSpoolReplacementDialog && !_machineProvider.MachineOperator.IsSpoolReplaced) { if (!(await _notificationProvider.ShowDialog(new SpoolReplaceViewVM())).DialogResult) { |
