diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-05-14 21:34:53 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-05-14 21:34:53 +0300 |
| commit | baa65cb88df619c3df68bdf91e0e0476ca614998 (patch) | |
| tree | 285bdba7a53fc3e4f4e282dac96f03bf58ff0b86 /Software/Visual_Studio/PPC | |
| parent | f42516c06b3bb1f4f2f05384a4c341ee423aed82 (diff) | |
| download | Tango-baa65cb88df619c3df68bdf91e0e0476ca614998.tar.gz Tango-baa65cb88df619c3df68bdf91e0e0476ca614998.zip | |
Vector Fine Tuning - add dialog.
Related Work Items: #6536
Diffstat (limited to 'Software/Visual_Studio/PPC')
35 files changed, 1815 insertions, 70 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 new file mode 100644 index 000000000..678a1ed7d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ColorCorrectionTool/TrialsLogEngine.cs @@ -0,0 +1,82 @@ +using LiteDB; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Jobs.Models; + +namespace Tango.PPC.Jobs.ColorCorrectionTool +{ + public class TrialsLogEngine : IDisposable + { + private LiteDatabase _db; + private ILiteCollection<TestColor> _collection; + + private static Lazy<TrialsLogEngine> _default = new Lazy<TrialsLogEngine>(() => new TrialsLogEngine()); + + public static TrialsLogEngine Default + { + get + { + return _default.Value; + } + } + + private TrialsLogEngine() + { + Init(); + } + + private void Init() + { + String dbFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Test Color"); + Directory.CreateDirectory(dbFolder); + _db = new LiteDatabase($"Filename={Path.Combine(dbFolder, "test_color.db")}"); + _collection = _db.GetCollection<TestColor>("TestColor"); + } + + public void UpdateTest(TestColor test) + { + _collection.Update(test); + } + + public TestColor AddTest( double l, double a, double b) + { + TestColor test = new TestColor() { L = l, A = a, B = b }; + _collection.Insert(test); + return test; + } + + public List<TestColor> GetAll() + { + return _collection.FindAll().ToList(); + } + + public TestColor GetByID( Int32 id) + { + return _collection.FindOne( x=> x.ID == id); + } + + ~TrialsLogEngine() + { + Dispose(); + } + + public void Dispose() + { + try + { + _db?.Dispose(); + } + catch { } + } + + public void Delete(TestColor test) + { + _collection.Delete(test.ID); + } + } +} + 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 9b95fbb5c..4cbe8e1be 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 @@ -30,6 +30,7 @@ <BitmapImage x:Key="Close_mycolorsdlg" UriSource="../Images/ColorSelection/close_mycolorsdlg.png" /> <BitmapImage x:Key="Add_group_mycolors" UriSource="../Images/ColorSelection/add_group.png" /> <BitmapImage x:Key="Close_SaveMyColor" UriSource="../Images/ColorSelection/arrow_top_bottom.png"/> + <BitmapImage x:Key="VFineTuning_Dialog" UriSource="../Images/ColorSelection/VFineTuning.png"/> <Style TargetType="{x:Type ListBox}" x:Key="ListBoxVerticalScroll" BasedOn="{StaticResource BlankListBox}"> <Setter Property="BorderThickness" Value="0"></Setter> @@ -140,17 +141,17 @@ <touch:TouchToggleButton Canvas.Left="0" Canvas.Top="0" x:Name="addColorToGroup" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Command="{Binding SaveMyColorsCommand}" IsEnabled="{Binding SelectedBrushStop.IsLiquidVolumesOutOfRange, Converter={StaticResource BooleanInverseConverter}}"> <touch:TouchToggleButton.Style > - <Style TargetType="touch:TouchToggleButton" > - <Setter Property="Background" Value="{StaticResource TangoPrimaryAccentBrush}"/> - <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"/> - <Style.Triggers> - <Trigger Property="IsEnabled" Value="False"> - <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"></Setter> - <Setter Property="Background" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> - </Trigger> - </Style.Triggers> - </Style> - </touch:TouchToggleButton.Style> + <Style TargetType="touch:TouchToggleButton" > + <Setter Property="Background" Value="{StaticResource TangoPrimaryAccentBrush}"/> + <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"/> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchToggleButton.Style> <Border Height="26" Width="28" BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"> <Image.Style> @@ -166,7 +167,7 @@ </Style.Triggers> </Style> </Image.Style> - </Image> + </Image> </Border> </touch:TouchToggleButton> </Canvas> @@ -238,10 +239,10 @@ <ItemsControl.ItemTemplate> <DataTemplate DataType="{ x:Type models:FavoriteColor}"> <Grid Margin="0 0 34 0" HorizontalAlignment="Left" VerticalAlignment="Top"> - <Grid.RowDefinitions> - <RowDefinition Height="65"/> - <RowDefinition Height="1*"/> - </Grid.RowDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="65"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> <Border Background="{Binding Brush}" Width="65" Height="65" CornerRadius="10" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" HorizontalAlignment="Left" Visibility="{Binding DataContext.EditColorsGroupMode , ElementName=colorLibraryList , Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <touch:TouchButton Width="65" Height="65" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.SelectColorCommand , ElementName=colorSelectionView}" CommandParameter="{Binding }" /> </Border> @@ -259,7 +260,7 @@ </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> - + </DockPanel> </DataTemplate> @@ -275,21 +276,21 @@ <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" CornerRadius="12" BorderThickness="0" Padding="10" MinHeight="100" Margin="0 20 0 0"> <StackPanel Orientation="Vertical"> <Grid Margin="14 10 14 10" > - <ListBox HorizontalAlignment="Stretch" MaxHeight="320" ItemsSource="{Binding Libraries}" Style="{StaticResource ListBoxVerticalScroll}" + <ListBox HorizontalAlignment="Stretch" MaxHeight="320" ItemsSource="{Binding Libraries}" Style="{StaticResource ListBoxVerticalScroll}" ScrollViewer.VerticalScrollBarVisibility="Visible" > - <ListBox.ItemsPanel> - <ItemsPanelTemplate> - <WrapPanel Orientation="Vertical" /> - </ItemsPanelTemplate> - </ListBox.ItemsPanel> - <ListBox.ItemTemplate> - <DataTemplate DataType="{x:Type models:ColorLibrary}"> - <touch:TouchButton Command="{Binding DataContext.AddColorToLibraryCommand, ElementName=colorSelectionView}" Style="{StaticResource TangoFlatButton}" CommandParameter="{Binding }" Background="Transparent"> - <TextBlock Text="{Binding Name}" FontSize="{StaticResource TangoButtonFontSize}"></TextBlock> - </touch:TouchButton> - </DataTemplate> - </ListBox.ItemTemplate> - </ListBox> + <ListBox.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel Orientation="Vertical" /> + </ItemsPanelTemplate> + </ListBox.ItemsPanel> + <ListBox.ItemTemplate> + <DataTemplate DataType="{x:Type models:ColorLibrary}"> + <touch:TouchButton Command="{Binding DataContext.AddColorToLibraryCommand, ElementName=colorSelectionView}" Style="{StaticResource TangoFlatButton}" CommandParameter="{Binding }" Background="Transparent"> + <TextBlock Text="{Binding Name}" FontSize="{StaticResource TangoButtonFontSize}"></TextBlock> + </touch:TouchButton> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> </Grid> <Rectangle Height="1" HorizontalAlignment="Stretch" Fill="{StaticResource TangoDividerBrush}"></Rectangle> <StackPanel Orientation="Horizontal" Height="60" Margin="20 10 0 20" Visibility="{Binding AddGroupMode, Converter={StaticResource BooleanToVisibilityInverseConverter}}" > @@ -334,13 +335,14 @@ </Border> <Grid Grid.Row="1" Background="{StaticResource TangoPrimaryBackgroundBrush}" Margin="10"> <Grid.RowDefinitions> - <RowDefinition Height="100"/> + <RowDefinition Height="60.6"/> + <RowDefinition Height="39.4"/> <RowDefinition Height="1*"/> </Grid.RowDefinitions> <touch:TouchNavigationLinks x:Name="navigationCSTLinks" SelectionChanged="TouchNavigationLinks_SelectionChanged" - SelectedIndex="{Binding SelectedColorTabIndex,Mode=TwoWay}" VerticalAlignment="Bottom" Margin="20" - FontSize="{StaticResource TangoNavigationLinksFontSize}" HorizontalContentAlignment="Stretch" PreviewMouseDown="TouchNavigationLinks_OnPreviewMouseDown"> + SelectedIndex="{Binding SelectedColorTabIndex,Mode=TwoWay}" VerticalAlignment="Bottom" Margin="20,0,20.4,20" + FontSize="{StaticResource TangoNavigationLinksFontSize}" HorizontalContentAlignment="Stretch" PreviewMouseDown="TouchNavigationLinks_OnPreviewMouseDown" Grid.RowSpan="2"> <TextBlock HorizontalAlignment="Center" >HSB</TextBlock> <TextBlock HorizontalAlignment="Center" >CIELab</TextBlock> <TextBlock HorizontalAlignment="Center" >RGB</TextBlock> @@ -360,7 +362,7 @@ </touch:TouchNavigationLinks> - <Grid Grid.Row="1" x:Name="HSBGrid"> + <Grid Grid.Row="2" x:Name="HSBGrid" Margin="0,0,0.4,0"> <Grid Visibility="{Binding SelectedColorTab,Converter={StaticResource ColorTabToVisibilityConverter},ConverterParameter='HSB'}"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> @@ -391,6 +393,9 @@ <RowDefinition Height="1*" /> </Grid.RowDefinitions> + <touch:TouchImageButton Grid.Row="0" Margin="0 2 45 0" HorizontalAlignment="Right" Width="70" EnableDropShadow="False" Background="Transparent" BorderThickness="0" + Command="{ Binding VectorFineTuningCommand}" Image="{StaticResource VFineTuning_Dialog}"/> + <ContentControl Name="myLabColors" Grid.Row="0" ContentTemplate="{StaticResource myColorsBtn}" Content="{Binding}"/> <ContentControl Name="segmentContentLab" Grid.Row="1" ContentTemplate="{StaticResource brushColorPanel}" Content="{Binding}"/> @@ -490,7 +495,7 @@ </Grid> <!--<commonControls:TwineCatalogControl Margin="0 30 0 0 " DataContext="{Binding SelectedCatalog, Mode=TwoWay}" SelectedItem="{Binding DataContext.ColorCatalogsItem, Mode=TwoWay, ElementName=catalogsGrid, UpdateSourceTrigger=PropertyChanged, Delay=500}" />--> - + <controls:TwineCatalogViewer Margin="80 0 0 0 " Catalog="{Binding SelectedCatalog, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedBrushStop.ColorCatalogsItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" CollectionFilter="{Binding CollectionFilter, Mode=OneWay}"/> </DockPanel> <Grid Grid.Row="2" Margin="60 27 30 40"> @@ -512,41 +517,44 @@ <DropShadowEffect Opacity="0.5" ShadowDepth="6" Color="Silver" BlurRadius="10" Direction="270"/> </Border.Effect> <Border CornerRadius="20" Background="{StaticResource TangoPrimaryBackgroundBrush}"> - <Grid> - <DockPanel > - <Grid DockPanel.Dock="Bottom" Height="137"> - <Rectangle Height="1" Stroke="{StaticResource TangoDividerBrush}" HorizontalAlignment="Stretch"/> - <Grid Margin="48 50 0 0" > - <Grid.ColumnDefinitions> - <ColumnDefinition Width="Auto"/> - <ColumnDefinition Width="1*"/> - </Grid.ColumnDefinitions> - <touch:TouchImageButton HorizontalAlignment="Left" Width="28" Height="38" Margin="0 20 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{ Binding AddGroupCommand}" Image="{StaticResource Add_group_mycolors}"/> - <TextBlock Grid.Column="1" Margin="20 20 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" Visibility="{Binding AddGroupMode, Converter={StaticResource BooleanToVisibilityInverseConverter}}">Add Group</TextBlock> - <DockPanel Visibility="{Binding AddGroupMode, Converter={StaticResource BooleanToVisibilityConverter}}" Grid.Column="1" Margin=" 20 0 0 20"> - <touch:TouchTextBox DockPanel.Dock="Left" Margin="0 0 80 0" x:Name="newGroupNametext" MinWidth="200" Height="Auto" Text="{Binding NewGroupName, Mode=TwoWay,UpdateSourceTrigger=LostFocus}"></touch:TouchTextBox> - <touch:TouchButton DockPanel.Dock="Right" Width="160" Height="40" CornerRadius="20" Background="Transparent" EnableDropShadow="False" TextElement.Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" HorizontalAlignment="Right" Margin="10 26 20 0" VerticalAlignment="Bottom" + <Grid> + <DockPanel > + <Grid DockPanel.Dock="Bottom" Height="137"> + <Rectangle Height="1" Stroke="{StaticResource TangoDividerBrush}" HorizontalAlignment="Stretch"/> + <Grid Margin="48 50 0 0" > + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + <touch:TouchImageButton HorizontalAlignment="Left" Width="28" Height="38" Margin="0 20 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{ Binding AddGroupCommand}" Image="{StaticResource Add_group_mycolors}"/> + <TextBlock Grid.Column="1" Margin="20 20 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" Visibility="{Binding AddGroupMode, Converter={StaticResource BooleanToVisibilityInverseConverter}}">Add Group</TextBlock> + <DockPanel Visibility="{Binding AddGroupMode, Converter={StaticResource BooleanToVisibilityConverter}}" Grid.Column="1" Margin=" 20 0 0 20"> + <touch:TouchTextBox DockPanel.Dock="Left" Margin="0 0 80 0" x:Name="newGroupNametext" MinWidth="200" Height="Auto" Text="{Binding NewGroupName, Mode=TwoWay,UpdateSourceTrigger=LostFocus}"></touch:TouchTextBox> + <touch:TouchButton DockPanel.Dock="Right" Width="160" Height="40" CornerRadius="20" Background="Transparent" EnableDropShadow="False" TextElement.Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" HorizontalAlignment="Right" Margin="10 26 20 0" VerticalAlignment="Bottom" BorderThickness="1" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Command="{Binding AddNewGroupCommand}" CommandParameter="{Binding ElementName=newGroupNametext, Path=Text}">Add</touch:TouchButton> - </DockPanel> + </DockPanel> + </Grid> </Grid> - </Grid> - <DockPanel x:Name="headerPanel" Height="122" DockPanel.Dock="Top"> - <Rectangle DockPanel.Dock="Bottom" Margin="43 0 63 10" Height="1" Stroke="{StaticResource TangoDividerBrush}" VerticalAlignment="Bottom"/> - <TextBlock DockPanel.Dock="Left" Margin="43 53 0 28" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">My Colors</TextBlock> - <touch:TouchImageButton DockPanel.Dock="Top" Width="32" Height="32" Image="{StaticResource Close_mycolorsdlg}" HorizontalAlignment="Right" Margin="0 20 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding CloseMyColorsCommand}"/> - </DockPanel> - <Grid> - <ListBox x:Name="listLibraries" Grid.Row="1" Margin="10 0 10 60" ItemsSource="{Binding Libraries}" Style="{StaticResource ListBoxVerticalScroll}" + <DockPanel x:Name="headerPanel" Height="122" DockPanel.Dock="Top"> + <Rectangle DockPanel.Dock="Bottom" Margin="43 0 63 10" Height="1" Stroke="{StaticResource TangoDividerBrush}" VerticalAlignment="Bottom"/> + <TextBlock DockPanel.Dock="Left" Margin="43 53 0 28" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">My Colors</TextBlock> + <touch:TouchImageButton DockPanel.Dock="Top" Width="32" Height="32" Image="{StaticResource Close_mycolorsdlg}" HorizontalAlignment="Right" Margin="0 20 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding CloseMyColorsCommand}"/> + </DockPanel> + <Grid> + <ListBox x:Name="listLibraries" Grid.Row="1" Margin="10 0 10 60" ItemsSource="{Binding Libraries}" Style="{StaticResource ListBoxVerticalScroll}" ScrollViewer.VerticalScrollBarVisibility="Visible" Width="560" ItemTemplate="{StaticResource ColorLibrary_Template}"> - </ListBox> - </Grid> - </DockPanel> - </Grid> - </Border> + </ListBox> + </Grid> + </DockPanel> + </Grid> </Border> + </Border> </Grid> </Border> + <Border Visibility="{Binding IsOpenVectorFineTuningDialog, Converter={StaticResource BooleanToVisibilityConverter}}"> + <local:VectorFineTuningDialog DataContext="{Binding VectorFineTuningDialogVM}" /> + </Border> </Grid> </UserControl> 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 431e8696b..9a6258e84 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 @@ -40,6 +40,7 @@ namespace Tango.PPC.Jobs.Dialogs [Description("Catalog")] Catalog = 2 } + public class DialogObject { @@ -388,7 +389,23 @@ namespace Tango.PPC.Jobs.Dialogs } } + private bool _isOpenVectorFineTuningDialog; + + public bool IsOpenVectorFineTuningDialog + { + get { return _isOpenVectorFineTuningDialog; } + set { _isOpenVectorFineTuningDialog = value; + RaisePropertyChangedAuto();} + } + + private VectorFineTuningDialogVM _vectorFineTuningDialogVM; + public VectorFineTuningDialogVM VectorFineTuningDialogVM + { + get { return _vectorFineTuningDialogVM; } + set { _vectorFineTuningDialogVM = value; RaisePropertyChangedAuto(); } + } + #endregion #region commands @@ -411,6 +428,8 @@ namespace Tango.PPC.Jobs.Dialogs public RelayCommand<ColorLibrary> EditColorsLibraryCommand { get; set; } public RelayCommand<FavoriteColor> DeleteColorCommand { get; set; } + public RelayCommand VectorFineTuningCommand { get; set; } + #endregion public ColorSelectionViewVM() @@ -459,6 +478,10 @@ namespace Tango.PPC.Jobs.Dialogs MyColorsMode = false; EditColorsGroupMode = false; SaveMyColorMode = false; + + VectorFineTuningCommand = new RelayCommand(OpenVectorFineTuning); + IsOpenVectorFineTuningDialog = false; + VectorFineTuningDialogVM = new VectorFineTuningDialogVM(); } #region Show and Selection tab @@ -911,5 +934,55 @@ namespace Tango.PPC.Jobs.Dialogs #endregion + #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); + + IsOpenVectorFineTuningDialog = true; + + VectorFineTuningDialogVM.Accepted += VectorFineTuningDialogAccepted; + VectorFineTuningDialogVM.Canceled += VectorFineTuningDialogCanceled; + + //SelectedView = ColorView.ManualFineTuningView; + } + + private void VectorFineTuningDialogCanceled() + { + VectorFineTuningDialogVM.Canceled -= VectorFineTuningDialogCanceled; + SelectedBrushStop.TestVFTID = VectorFineTuningDialogVM.BrushStopModel.TestVFTID; + IsOpenVectorFineTuningDialog = false; + } + + private void VectorFineTuningDialogAccepted() + { + 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 = false; + + _selectedBrushStop.B = (double)VectorFineTuningDialogVM.BrushStopModel.B; + + _selectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; + _selectedBrushStop.InitColorsFromBestmatch(); + base.Accept(); + } + + + + #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 new file mode 100644 index 000000000..1ac320c3a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml @@ -0,0 +1,349 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.VectorFineTuningDialog" + 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.Dialogs" + xmlns:vm="clr-namespace:Tango.PPC.Jobs.Dialogs" + xmlns:controls="clr-namespace:Tango.PPC.Jobs.Controls" + xmlns:commonControls="clr-namespace:Tango.PPC.Common.Controls;assembly=Tango.PPC.Common" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:fa="http://schemas.fontawesome.io/icons/" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:appBarItems="clr-namespace:Tango.PPC.Jobs.AppBarItems" + mc:Ignorable="d" + Background="{StaticResource TangoMidBackgroundBrush}" + d:DesignHeight="1280" d:DesignWidth="800" Width="750" Height="1200" + d:DataContext="{d:DesignInstance Type=vm:VectorFineTuningDialogVM, IsDesignTimeCreatable=False}" > + + <UserControl.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="../Resources/Styles.xaml" /> + </ResourceDictionary.MergedDictionaries> + <sharedConverters:DateTimeUTCToShortDateConverter x:Key="DateTimeUTCToShortDateConverter" /> + <sharedConverters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter"/> + <BitmapImage x:Key="Close_mycolorsdlg" UriSource="../Images/ColorSelection/close_mycolorsdlg.png" /> + + <Style x:Key="GreyTextStyle" TargetType="TextBlock"> + <Setter Property="Foreground" Value="{StaticResource TangoGrayTextBrush}"></Setter> + <Setter Property="FontSize" Value="{StaticResource TangoSmallFontSize}"></Setter> + <Setter Property="VerticalAlignment" Value="Center"></Setter> + <Setter Property="HorizontalAlignment" Value="Center"></Setter> + </Style> + </ResourceDictionary> + </UserControl.Resources> + <Grid x:Name="VFTgrid" DataContext="{Binding Path=DataContext.VectorFineTuningDialogVM, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:ColorSelectionView}}}" d:DataContext="{d:DesignInstance Type=local:VectorFineTuningDialogVM, IsDesignTimeCreatable=False}"> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Height="90" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <!--<Canvas> + <Border Canvas.Right="-20" Canvas.Top="0" BorderThickness="0 0 0 0" BorderBrush="{StaticResource TangoDividerBrush}" Margin="0 0 0 0"> + <touch:TouchImageButton Padding="0" Width="Auto" Height="32" Image="{StaticResource Close_mycolorsdlg}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 2 20 2" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding CloseCommand}"/> + </Border> + </Canvas>--> + + + <Grid Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Color Correction Tool</TextBlock> + </Grid> + + <Grid Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="40 0 0 0"> + <DockPanel> + <StackPanel VerticalAlignment="Center" Background="Transparent" DockPanel.Dock="Right" Margin="15 0"> + <commonControls:MachineStatusControl HorizontalAlignment="Center" DataContext="{Binding MachineProvider.MachineOperator}" /> + <TextBlock Margin="0 10 0 0" Text="{Binding MachineProvider.MachineOperator.Status,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + </StackPanel> + + <Grid> + <appBarItems:JobProgressAppBarItemView /> + </Grid> + </DockPanel> + </Grid> + + <touch:TouchButton Grid.Column="1" Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Command="{Binding TestCommand}" CornerRadius="25" Width="180" Height="50" Margin="0 2 10 2" Content="TEST" HorizontalAlignment="Right" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" EnableDropShadow="False" FontSize="{StaticResource TangoButtonFontSize}"> + <touch:TouchButton.Style > + <Style TargetType="touch:TouchButton" > + <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoPrimaryAccentBrush}"/> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchButton.Style> + </touch:TouchButton> + <touch:TouchButton Grid.Column="1" Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityConverter}}" Command="{Binding StopCommand}" CornerRadius="25" Width="180" Height="50" Margin="0 2 10 2" Content="STOP" HorizontalAlignment="Right" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" EnableDropShadow="False" FontSize="{StaticResource TangoButtonFontSize}"> + <touch:TouchButton.Style > + <Style TargetType="touch:TouchButton" > + <Setter Property="Foreground" Value="{StaticResource TangoLightForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoPrimaryAccentBrush}"/> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </touch:TouchButton.Style> + </touch:TouchButton> + + + </Grid> + + </Border> + <Border Padding="24 16 24 0" Grid.Row="1" > + <Border BorderThickness="0" Background="{StaticResource TangoPrimaryBackgroundBrush}" > + <Grid > + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="230"></RowDefinition> + <RowDefinition Height="1*"></RowDefinition> + </Grid.RowDefinitions> + <StackPanel Orientation="Vertical"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="24 40 24 0"> + <Image Stretch="Fill" Width="36" Height="36" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/color-length.png" HorizontalAlignment="Left"></Image> + <TextBlock Margin="11 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TangoMessageBoxButtonFontSize}" FontWeight="SemiBold" Text="Target Color" /> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="71 32 24 0"> + <Border Height="60" Width="60" HorizontalAlignment="Left" Background="{Binding ColorBrush}" CornerRadius="12"></Border> + <UniformGrid Rows="1" Columns="3" Height="30" MinWidth="150" Margin="14 0 0 0"> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="L" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="50"> + <TextBlock Style="{StaticResource GreyTextStyle}" Text="{Binding TargetL, StringFormat=0.00}" ></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="5 0 0 0"> + <TextBlock Text="a" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="50"> + <TextBlock Style="{StaticResource GreyTextStyle}" Text="{Binding TargetA, StringFormat=0.00}" ></TextBlock> + </Border> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> + <TextBlock Text="b" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> + <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="50"> + <TextBlock Style="{StaticResource GreyTextStyle}" Text="{Binding TargetB, StringFormat=0.00}" ></TextBlock> + </Border> + </StackPanel> + </UniformGrid> + </StackPanel> + </StackPanel> + <Grid Grid.Row="1"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="24 40 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.ColumnDefinitions> + <ColumnDefinition Width="1*"></ColumnDefinition> + <ColumnDefinition Width="311"></ColumnDefinition> + </Grid.ColumnDefinitions> + <UniformGrid Rows="3" Columns="1" Height="176" VerticalAlignment="Top"> + <UniformGrid.Style> + <Style TargetType="UniformGrid"> + <Setter Property="IsEnabled" Value="True"/> + <Style.Triggers> + <DataTrigger Binding="{Binding IsJobRunning}" Value="True"> + <Setter Property="IsEnabled" Value="False"/> + </DataTrigger> + </Style.Triggers> + </Style> + </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}"/> + </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}"/> + </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}"/> + </StackPanel> + </UniformGrid> + + <UniformGrid Grid.Column="1" x:Name="cmyk_grid" Margin="0 16 0 0" Rows="4" Columns="1" Width="180" HorizontalAlignment="Left" Height=" 100" VerticalAlignment="Top"> + <StackPanel Orientation="Horizontal"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Width="12" HorizontalAlignment="Center" VerticalAlignment="Center">C</TextBlock> + <Rectangle Margin="10 0 0 0" Width="{Binding Cyan, Mode=OneWay}" Height="12" Fill="#00C3FF"/> + <TextBlock FontSize="{StaticResource TangoSmallFontSizeBar}" Margin="10 0 0 0" Text="{Binding Cyan, StringFormat={}{0:0.##}}" VerticalAlignment="Center"></TextBlock> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="0 10 0 0"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Width="12" HorizontalAlignment="Center">M</TextBlock> + <Rectangle Margin="10 0 0 0" Width="{Binding Magenta, Mode=OneWay}" Height="12" Fill="#FF00B3"/> + <TextBlock Margin="10 0 0 0" Text="{Binding Magenta, StringFormat={}{0:0.##}}" FontSize="{StaticResource TangoSmallFontSizeBar}" ></TextBlock> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="0 10 0 0"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Width="12" HorizontalAlignment="Center">Y</TextBlock> + <Rectangle Margin="10 0 0 0" Width="{Binding Yellow, Mode=OneWay}" Height="12" Fill="#FFE500"/> + <TextBlock Margin="10 0 0 0" Text="{Binding Yellow, StringFormat={}{0:0.##}}" FontSize="{StaticResource TangoSmallFontSizeBar}" ></TextBlock> + </StackPanel> + <StackPanel Orientation="Horizontal" Margin="0 10 0 0"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Width="12" HorizontalAlignment="Center">K</TextBlock> + <Rectangle Margin="10 0 0 0" Width="{Binding Black, Mode=OneWay}" Height="12" Fill="black"/> + <TextBlock Margin="10 0 0 0" Text="{Binding Black, StringFormat={}{0:0.##}}" FontSize="{StaticResource TangoSmallFontSizeBar}" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}"></TextBlock> + </StackPanel> + </UniformGrid> + + </Grid> + + </Grid> + </Grid> + + <Border BorderThickness="0" Grid.Row="1" > + <Border.Style > + <Style TargetType="Border"> + <Setter Property="IsEnabled" Value="True"/> + <Style.Triggers> + <DataTrigger Binding="{Binding IsJobRunning}" Value="True"> + <Setter Property="IsEnabled" Value="False"/> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <touch:TouchExpander Grid.Row="1" x:Name="trailsListExpander" IsExpanded="{Binding IsExpanderOpened, Mode=TwoWay}" Margin="0 0 0 0 " FontSize="{StaticResource TangoSmallFontSize}" BorderThickness="0" + Style="{StaticResource TouchRoundedExpander}"> + <touch:TouchExpander.Header> + <DockPanel > + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="0 0 20 0" Visibility="{Binding IsExpanderOpened, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}"> + <touch:TouchButton HorizontalAlignment="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding ClearTrialsCommand}" > + <DockPanel Width="Auto" Height="44" VerticalAlignment="Center"> + <Image Source="../Images/ColorSelection/Clear.png" Width="19" DockPanel.Dock="Top"></Image> + <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}" > + <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> + </DockPanel> + </touch:TouchButton> + </StackPanel> + <StackPanel DockPanel.Dock="Left" Orientation="Horizontal" VerticalAlignment="Center" > + <Image Source="../Images/JobView/job-summary.png" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center"> + <Run Text="Trials Log" FontSize="{StaticResource TangoDefaultFontSize}"></Run> + <Run Text="(Max 10 Trials)" FontWeight="Normal"></Run></TextBlock> + </StackPanel> + </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:TouchExpander> + </Border> + <DockPanel Grid.Row="2" Margin="0 20 0 41" Background="{StaticResource TangoPrimaryBackgroundBrush}" > + <touch:TouchButton DockPanel.Dock="Right" HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" Width="200" Height="50" VerticalAlignment="Bottom" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" ShadowDepth="0" Content="APPLY" Margin="0 0 82 0"> + <touch:TouchButton.Style > + <Style TargetType="touch:TouchButton" > + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoPrimaryAccentBrush}"/> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoDisabledBackgroundBrush}"></Setter> + </Trigger> + </Style.Triggers> + </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.Style > + <Style TargetType="touch:TouchButton" > + <Setter Property="IsEnabled" Value="True"/> + <Setter Property="Foreground" 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> + </Style.Triggers> + </Style> + </touch:TouchButton.Style> + </touch:TouchButton> + </DockPanel> + </Grid> + </Border> + </Border> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs new file mode 100644 index 000000000..cc4d9d424 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml.cs @@ -0,0 +1,33 @@ +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.Dialogs +{ + /// <summary> + /// Interaction logic for VectorFineTuningDialog.xaml + /// </summary> + public partial class VectorFineTuningDialog : UserControl + { + private VectorFineTuningDialogVM _vm; + public VectorFineTuningDialog() + { + InitializeComponent(); + Loaded += (_, __) => + { + _vm = DataContext as VectorFineTuningDialogVM; + }; + } + } +} 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 new file mode 100644 index 000000000..9d3ec385d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs @@ -0,0 +1,818 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using System.Windows.Threading; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Integration.Operation; +using Tango.PPC.Common; +using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Notifications; +using Tango.PPC.Common.Notifications.NotificationItems; +using Tango.PPC.Common.Printing; +using Tango.PPC.Jobs.ColorCorrectionTool; +using Tango.PPC.Jobs.Models; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class VectorFineTuningDialogVM : DialogViewVM + { + private JobHandler _handler; + + #region Properties + + private RunningJobStatus _runningJobStatus; + /// <summary> + /// Gets or sets the running job status. + /// </summary> + public RunningJobStatus RunningJobStatus + { + get { return _runningJobStatus; } + set { _runningJobStatus = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Gets or sets the machine provider. + /// </summary> + [TangoInject] + public IMachineProvider MachineProvider { get; set; } + + /// <summary> + /// Gets or sets the notification provider. + /// </summary> + [TangoInject] + public INotificationProvider NotificationProvider { get; set; } + + /// <summary> + /// Gets or sets the printing manager. + /// </summary> + [TangoInject] + public IPrintingManager PrintingManager { get; set; } + + public BrushStopModel BrushStopModel { get; set; } + + private System.Windows.Media.Color _targetcolor; + + public System.Windows.Media.Color TargetColor + { + get { return _targetcolor; } + set + { + _targetcolor = value; + RaisePropertyChanged(nameof(ColorBrush)); + } + } + + public SolidColorBrush ColorBrush + { + get + { + return new SolidColorBrush(TargetColor); + } + } + + protected Double _targetL; + + public Double TargetL + { + get + { + return _targetL; + } + + set + { + if (_targetL != value) + { + _targetL = value; + RaisePropertyChangedAuto(); + } + } + } + + protected Double _targetA; + + /// <summary> + /// Gets or sets the BrushStopModel a. + /// </summary> + public Double TargetA + { + get + { + return _targetA; + } + set + { + if (_targetA != value) + { + _targetA = value; + RaisePropertyChangedAuto(); + OnLABChanged(); + } + } + } + + protected Double _targetB; + + /// <summary> + /// Gets or sets the BrushStopModel b. + /// </summary> + public Double TargetB + { + get + { + return _targetB; + } + set + { + if (_targetB != value) + { + _targetB = value; + RaisePropertyChangedAuto(); + OnLABChanged(); + } + } + } + + protected Double? _measuredL; + + /// <summary> + /// Gets or sets the BrushStopModel l. + /// </summary> + + public Double? MeasuredL + { + get + { + return _measuredL; + } + + set + { + if (_measuredL != value) + { + _measuredL = value; + RaisePropertyChangedAuto(); + if (ActiveLogModel != null) + ActiveLogModel.L = _measuredL; + OnLABChanged(); + } + } + } + + protected Double? _measuredA; + + /// <summary> + /// Gets or sets the BrushStopModel a. + /// </summary> + public Double? MeasuredA + { + get + { + return _measuredA; + } + set + { + if (_measuredA != value) + { + _measuredA = value; + RaisePropertyChangedAuto(); + if (ActiveLogModel != null) + ActiveLogModel.A = _measuredA; + OnLABChanged(); + } + } + } + + protected Double? _measuredB; + + /// <summary> + /// Gets or sets the BrushStopModel b. + /// </summary> + public Double? MeasuredB + { + get + { + return _measuredB; + } + set + { + if (_measuredB != value) + { + _measuredB = value; + RaisePropertyChangedAuto(); + if (ActiveLogModel != null) + ActiveLogModel.B = _measuredB; + OnLABChanged(); + } + } + } + + protected Double _cyan; + + /// <summary> + /// Gets or sets the cyan. + /// </summary> + public Double Cyan + { + get + { + return _cyan; + } + + set + { + if (_cyan != value) + { + _cyan = value; + RaisePropertyChangedAuto(); + } + } + } + + protected Double _magenta; + + /// <summary> + /// Gets or sets the magenta. + /// </summary> + + public Double Magenta + { + get + { + return _magenta; + } + + set + { + if (_magenta != value) + { + _magenta = value; + RaisePropertyChangedAuto(); + } + } + } + + protected Double _yellow; + + /// <summary> + /// Gets or sets the yellow. + /// </summary> + + public Double Yellow + { + get + { + return _yellow; + } + + set + { + if (_yellow != value) + { + _yellow = value; + RaisePropertyChangedAuto(); + } + } + } + + protected Double _black; + + /// <summary> + /// Gets or sets the black. + /// </summary> + public Double Black + { + get + { + return _black; + } + + set + { + if (_black != value) + { + _black = value; + RaisePropertyChangedAuto(); + } + } + } + + public int TrialNumber + { + get { + if(ActiveLogModel == null) + return 1; + return ActiveLogModel.TrialNumber + 1 ; + } + } + + public TestColor TestColor { get;set;} + + + private SynchronizedObservableCollection<TrialsLogModel> _trialsLogItems; + + public SynchronizedObservableCollection<TrialsLogModel> TrialsLogitems + { + get { return _trialsLogItems; } + set + { + _trialsLogItems = value; + RaisePropertyChangedAuto(); + } + } + + private TrialsLogModel _activeLogModel; + + public TrialsLogModel ActiveLogModel + { + get { return _activeLogModel; } + set { _activeLogModel = value; + RaisePropertyChangedAuto(); + } + } + + private TrialsLogModel _selectedLog; + + public TrialsLogModel SelectedLog + { + get { return _selectedLog; } + set + { + _selectedLog = value; + RaisePropertyChangedAuto(); + OKCommand.RaiseCanExecuteChanged(); + } + } + + private bool _isExpanderOpened; + public bool IsExpanderOpened + { + get { return _isExpanderOpened; } + set + { + _isExpanderOpened = value; + RaisePropertyChangedAuto(); + } + } + + private bool _isJobRunning; + public bool IsJobRunning + { + get { return _isJobRunning; } + set { _isJobRunning = value; RaisePropertyChangedAuto(); } + } + + + #endregion + + #region Commands + public RelayCommand TestCommand { get; set; } + public RelayCommand StopCommand { get;set; } + public RelayCommand ClearTrialsCommand { get; set; } + public RelayCommand ExportTrialsCommand { get; set; } + + #endregion + + public VectorFineTuningDialogVM() + { + TargetL = 100; + TargetB = 0; + TargetA = 0; + TargetColor = Colors.White; + + ClearTrialsCommand = new RelayCommand(ClearTrialsLog); + ExportTrialsCommand = new RelayCommand(ExportTrialsLog); + TestCommand = new RelayCommand(StartJob, CanStartJob); + StopCommand = new RelayCommand(StopTest); + + IsExpanderOpened = true; + + TangoIOC.Default.Inject(this); + + 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(); + TargetL = l; + TargetB = b; + TargetA = a; + TargetColor = targetColor; + + Cyan = cyan; + Magenta = magenta; + Yellow = yellow; + Black = 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); + } + + if (TestColor == null || TestColor.TrialslogList.Count > 1) + { + 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(); + if (ActiveLogModel == null) + { + ActiveLogModel = new TrialsLogModel(0, Cyan, Magenta, Yellow, Black); + TrialsLogitems.Add(ActiveLogModel); + } + } + IsVisible = true; + RaisePropertyChanged(nameof(TrialsLogitems)); + } + + #region Methods + + protected override bool CanOK() + { + return (SelectedLog != null && SelectedLog.IsTested); + } + + private void ExportTrialsLog(object obj) + { + + } + + private void ClearTrialsLog(object obj) + { + if (TrialsLogitems.Count > 1) + { + ActiveLogModel = TrialsLogitems[0]; + ActiveLogModel.L = ActiveLogModel.A = ActiveLogModel.B = null; + TrialsLogitems.Clear(); + TrialsLogitems.Add(ActiveLogModel); + RaisePropertyChanged(nameof(TrialsLogitems)); + + ActiveLogModel.DeltaE = null; + } + + } + + protected override void Accept() + { + OnClose(); + + BrushStopModel.L = (double)SelectedLog.L; + BrushStopModel.A = (double)SelectedLog.A; + BrushStopModel.PreventPropertyUpdate = false; + BrushStopModel.B = (double)SelectedLog.B; + BrushStopModel.Cyan = SelectedLog.TestC; + BrushStopModel.Magenta = SelectedLog.TestM; + BrushStopModel.Yellow = SelectedLog.TestY; + BrushStopModel.Black = SelectedLog.TestK; + + if (TestColor != null && TestColor.TrialslogList.Count > 1) + { + TestColor.Delete(); + } + base.Accept(); + } + protected override void Cancel() + { + OnClose(); + + if ( TrialsLogitems.Count > 1) + { + TestColor = TrialsLogEngine.Default.AddTest(TargetL, TargetA, TargetB); + TestColor.TrialslogList.Clear(); + foreach ( var item in TrialsLogitems) + { + TestColor.AddToList(item); + } + + BrushStopModel.TestVFTID = TestColor.ID; + } + base.Cancel(); + } + + private void OnClose() + { + MachineProvider.MachineOperator.PrintingStarted -= MachineOperator_PrintingStarted; + MachineProvider.MachineOperator.PrintingEnded -= MachineOperator_PrintingEnded; + MachineProvider.MachineOperator.PrintingCompleted -= MachineOperator_PrintingCompleted; + } + + private bool IsValidLAB() + { + if (MeasuredL == null || MeasuredL < 0 || MeasuredL > 100 + || MeasuredA == null || MeasuredA < -128 || MeasuredA > 127 + || MeasuredB == null || MeasuredB < -128 || MeasuredB > 127) + return false; + return true; + } + + private void OnLABChanged() + { + if (ActiveLogModel == null) + return; + + if (IsValidLAB()) + { + BrushStopModel.PreventPropertyUpdate = true; + BrushStopModel.L = (double)MeasuredL; + BrushStopModel.A = (double)MeasuredA; + BrushStopModel.PreventPropertyUpdate = false; + BrushStopModel.B = (double)MeasuredB; + if(BrushStopModel.IsOutOfGamut) + { + /// + } + + var deltaE = DeltaE_CMC(TargetL, TargetA, TargetB, (double)MeasuredL, (double)MeasuredA, (double)MeasuredB); + ActiveLogModel.DeltaE = deltaE; + } + TestCommand.RaiseCanExecuteChanged(); + } + + #endregion + + #region Job + + private async void StartJob() + { + if(ActiveLogModel.DeltaE <= 0.5) + { + await NotificationProvider.ShowInfo("Previous trial seems to be very close; no more trials are recommended"); + return; + } + IsJobRunning = true; + + //calculate CMYK + BrushStopModel.ConvertColorToVolume(); + BrushStopModel.ColorSpace = ColorSpaces.LAB; + var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + Job job = new Job(); + job.Designation = JobDesignations.FineTuning; + job.Machine = await new MachineBuilder(db).Set(MachineProvider.Machine.Guid).WithConfiguration().WithSpools().WithCats().WithVersion().BuildAsync(); + job.Name = $"Manual Fine Tuning #{ActiveLogModel.TrialNumber}"; + job.Rml = await new RmlBuilder(db).Set(BrushStopModel.SegmentModel.Job.Rml.Guid).WithActiveParametersGroup().WithCAT(MachineProvider.Machine.Guid).WithCCT().WithLiquidFactors().WithSpools().BuildAsync(); + job.SpoolType = db.SpoolTypes.FirstOrDefault(x => x.Guid == settings.SpoolTypeGuid); + job.WindingMethod = db.WindingMethods.FirstOrDefault(); + + Segment segment = new Segment(); + segment.Name = "Standard Segment"; + segment.Length = 10;//100*2 + segment.Job = job; + segment.JobGuid = job.Guid; + + job.Segments.Add(segment); + + BrushStop stop = new BrushStop(); + 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); + stop.SetVolume(LiquidTypes.Black, BrushStopModel.Black); + + segment.BrushStops.Add(stop); + + try + { + await PrintingManager.Print(job, db); + } + catch (Exception ex) + { + LogManager.Log(ex, "Could not start the test job."); + await NotificationProvider.ShowError($"{ex.Message}."); + IsJobRunning = false; + } + } + //on update ActiveLogModel + } + + private bool CanStartJob(object arg) + { + return (ActiveLogModel != null && IsValidLAB() && TrialsLogitems.Count <= 10 && !IsJobRunning); + } + + private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) + { + if (IsVisible) + { + _handler = e.JobHandler; + 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. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> + private void JobHandler_Stopped(object sender, EventArgs e) + { + if (_handler != null) + { + _handler.StatusChanged -= JobHandler_StatusChanged; + _handler.Stopped -= JobHandler_Stopped; + _handler.Completed -= JobHandler_Completed; + //_handler.CanCancelChanged -= JobHandler_CanCancelChanged; + IsJobRunning = false; + InvalidateRelayCommands(); + } + } + + /// <summary> + /// Handles the JobHandler StatusChanged event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="e">The e.</param> + private void JobHandler_StatusChanged(object sender, RunningJobStatus e) + { + InvokeUI(() => + { + RunningJobStatus = e; + }); + } + + 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) + //{ + // NotificationProvider.PushNotification(new MessageNotificationItem(String.Format("'{0}' fine tuning completed successfully", e.Job.Name), "Tap to approve or repeat.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => + // { + // })); + //} + //if (IsVisible) + //{ + // IsJobRunning = false; + // Dispatcher.CurrentDispatcher.Invoke(() => + // { + // ActiveLogModel.IsTested = true; + // ActiveLogModel.Date = DateTime.UtcNow; + // if (ActiveLogModel != null && ActiveLogModel.TrialNumber < 10) + // { + // ActiveLogModel = new TrialsLogModel(ActiveLogModel.TrialNumber + 1, Cyan, Magenta, Yellow, Black); + // _trialsLogItems.Add( ActiveLogModel); + // RaisePropertyChanged(nameof(TrialsLogitems)); + // } + // _measuredL = null; + // _measuredA = null; + // _measuredB = null; + // RaisePropertyChanged(nameof(MeasuredL)); + // RaisePropertyChanged(nameof(MeasuredA)); + // RaisePropertyChanged(nameof(MeasuredB)); + // }); + //} + + } + + + private void JobHandler_Completed(object sender, EventArgs e) + { + 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; + 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)); + } + + //}); + } + + _handler.StatusChanged -= JobHandler_StatusChanged; + _handler.Stopped -= JobHandler_Stopped; + _handler.Completed -= JobHandler_Completed; + + InvalidateRelayCommands(); + } + } + + private void StopTest() + { + if (_handler != null) + { + _handler.Cancel(); + IsJobRunning = false; + + InvalidateRelayCommands(); + } + } + + #endregion + + #region Delta E + + double DeltaE_CMC(double L1, double a1, double b1, double L2, double a2, double b2) + { + double h1 = Math.Atan2(b1, a1) * (180 / Math.PI); + if (h1 < 0) + h1 = h1 + 360; + double h2 = Math.Atan2(b2, a2) * (180 / Math.PI); + if (h2 < 0) + h2 = h2 + 360; + double refX_H = h1; + //chroma calculation + double refX_C = Math.Sqrt(a1 * a1 + b1 * b1); + //reference SL parameter + double refX_SL; + if (L1 <= 16) + refX_SL = 0.511; + else + refX_SL = L1 * 0.040975 / (1 + 0.01765 * L1); + //reference SC parameter + double refX_SC = (0.638 + 0.0638 * refX_C / (1 + 0.0131 * refX_C)); + //reference CQ parameter + double refX_CQ = Math.Pow(refX_C, 4); + //reference F parameter + double refX_F = Math.Sqrt(refX_CQ / (refX_CQ + 1900)); + // reference T parameter + double refX_T = 0; + if ((refX_H > 164) & (refX_H < 345)) + refX_T = 0.56 + Math.Abs(0.2 * Math.Cos(Math.PI * (refX_H + 168) / 180)); + else if ((refX_H >= 345) | (refX_H <= 164)) + refX_T = 0.36 + Math.Abs(0.4 * Math.Cos(Math.PI * (refX_H + 35) / 180)); + // reference SH parameter + double refX_SH = refX_SC * (refX_T * refX_F + 1 - refX_F); + + //sample parameter calculations + //hue calculation + double samX_H = h2; + //chroma calculation + double samX_C = Math.Sqrt(a2 * a2 + b2 * b2); + + double dL = L1 - L2; + double dC = samX_C - refX_C; + double da = a1 - a2; + double db = b1 - b2; + double dH = Math.Sqrt(Math.Max(da * da + db * db - dC * dC, 0.0)); + + double dECMC = Math.Sqrt(Math.Pow(dL / (2 * refX_SL), 2) + Math.Pow(dC / refX_SC, 2) + Math.Pow(dH / refX_SH, 2)); + return dECMC; + + } + + #endregion + + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Clear.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Clear.png Binary files differnew file mode 100644 index 000000000..5b99530fe --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Clear.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/CorrectionTrial.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/CorrectionTrial.png Binary files differnew file mode 100644 index 000000000..a70769131 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/CorrectionTrial.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Export.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Export.png Binary files differnew file mode 100644 index 000000000..34ead5944 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/Export.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/VFineTuning.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/VFineTuning.png Binary files differnew file mode 100644 index 000000000..7794b99e0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/ColorSelection/VFineTuning.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 01ecc239f..db38a55d5 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 @@ -599,6 +599,9 @@ namespace Tango.PPC.Jobs.Models } protected bool RequiredMaxLiquidTest { get; set; } + + public Int32 TestVFTID { get;set; } + #endregion #region constructors @@ -673,6 +676,8 @@ 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 @@ -804,6 +809,7 @@ namespace Tango.PPC.Jobs.Models //this.MapPropertiesTo(cloned, MappingFlags.NoReferenceTypes); cloned.PreventPropertyUpdate = false; cloned.RequiredMaxLiquidTest = false; + cloned.TestVFTID = TestVFTID; return cloned; } 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 new file mode 100644 index 000000000..a82f69ead --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TestColor.cs @@ -0,0 +1,70 @@ +using LiteDB; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.PPC.Jobs.ColorCorrectionTool; + +namespace Tango.PPC.Jobs.Models +{ + public class TestColor : ExtendedObject + { + public List<TrialsLogModel> TrialslogList { get; set; } + + [BsonId] + public Int32 ID { get; set; } + + + public double L { get; set; } + public double A { get; set; } + public double B { get; set; } + + public TestColor() + { + 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 new file mode 100644 index 000000000..9ae17ec03 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/TrialsLogModel.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.PPC.Jobs.Models +{ + public class TrialsLogModel: ExtendedObject + { + #region Properties + + private int _trialNumber; + + public int TrialNumber + { + get { return _trialNumber; } + set + { + _trialNumber = value; + RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(Trial)); + } + } + + + public string Trial { + get { + if(TrialNumber == 0) + return "T"; + return TrialNumber.ToString(); + } + } + + private double? _l; + + public double? L + { + get { return _l; } + set { _l = value; + RaisePropertyChanged(nameof(LAB)); + OnLABChanged();} + } + private double? _a; + + public double? A + { + get { return _a; } + set { _a = value; RaisePropertyChanged(nameof(LAB)); OnLABChanged(); } + } + private double? _b; + + public double? B + { + get { return _b; } + set { _b = value; RaisePropertyChanged(nameof(LAB)); OnLABChanged(); } + } + + public double C { get; set; } + public double M { get; set; } + public double Y { get; set; } + public double K { get; set; } + + public string CMYK + { + get + { + return String.Format("{0:0.##},{1:0.##},{2:0.##},{3:0.##}", C, M, Y, K); + } + } + + public double TestC { get; set; } + public double TestM { get; set; } + public double TestY { get; set; } + public double TestK { get; set; } + + private DateTime _date; + + public DateTime Date + { + get { return _date; } + set { _date = value; RaisePropertyChangedAuto(); } + } + + private double? _deltaE; + + public double? DeltaE + { + get { return _deltaE; } + set { _deltaE = value; + RaisePropertyChangedAuto(); } + } + + private bool _IsActiveTrial; + + public bool IsActiveTrial + { + get { return _IsActiveTrial; } + set { _IsActiveTrial = value; + RaisePropertyChangedAuto(); + } + } + + public string LAB + { + get { + if(!ValidationLAB()) + return ""; + return String.Format("{0:0.##},{1:0.##},{2:0.##}", L, A, B); } + } + + public bool IsTested { get; set; } + + #endregion + + + public TrialsLogModel(int trial, double c, double m, double y, double k) + { + TrialNumber = trial; + IsActiveTrial = false; + C = c; + M = m; + Y = y; + K = k; + L = A = B = null; + Date = DateTime.UtcNow; + RaisePropertyChanged(nameof(CMYK)); + IsTested = false; + } + + #region Methods + + private bool ValidationLAB() + { + if (L == null || L < 0 || L > 100 + || A == null || A < -128 || A > 127 + || B == null || B < -128 || B > 127) + return false; + return true; + } + + private void OnLABChanged() + { + if (ValidationLAB()) + { + ; + } + } + + #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 a1bf13df7..98a9bad62 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 @@ -148,6 +148,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Dialogs\VectorFineTuningDialog.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="NotificationItems\NewSynchronizardJobsNotificationItemView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -191,6 +195,7 @@ </Compile> <Compile Include="AppButtons\StartPrintingButton.cs" /> <Compile Include="AppButtons\StopPrintingButton.cs" /> + <Compile Include="ColorCorrectionTool\TrialsLogEngine.cs" /> <Compile Include="Controls\JobModelSummaryViewerControl.xaml.cs"> <DependentUpon>JobModelSummaryViewerControl.xaml</DependentUpon> </Compile> @@ -269,6 +274,10 @@ <DependentUpon>SpoolChangeView.xaml</DependentUpon> </Compile> <Compile Include="Dialogs\SpoolChangeViewVM.cs" /> + <Compile Include="Dialogs\VectorFineTuningDialog.xaml.cs"> + <DependentUpon>VectorFineTuningDialog.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\VectorFineTuningDialogVM.cs" /> <Compile Include="Helpers\GroupSegmentTemplateSelector.cs" /> <Compile Include="JobsV2Module.cs" /> <Compile Include="JobsModuleSettings.cs" /> @@ -281,6 +290,8 @@ <Compile Include="Models\JobModel.cs" /> <Compile Include="Models\SegmentModel.cs" /> <Compile Include="Models\SegmentsGroupModel.cs" /> + <Compile Include="Models\TestColor.cs" /> + <Compile Include="Models\TrialsLogModel.cs" /> <Compile Include="MyColors\MyColorsEngine.cs" /> <Compile Include="NavigationObjects\JobNavigationObject.cs" /> <Compile Include="NavigationObjects\JobSummeryNavigationObject.cs" /> @@ -666,10 +677,18 @@ <ItemGroup> <Resource Include="Images\ColorSelection\Heart_disable.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\ColorSelection\VFineTuning.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\ColorSelection\Clear.png" /> + <Resource Include="Images\ColorSelection\CorrectionTrial.png" /> + <Resource Include="Images\ColorSelection\Export.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <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/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index cef55a4ad..36ed2f625 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 @@ -428,8 +428,8 @@ namespace Tango.PPC.Jobs.ViewModels //await SetSpoolTension(Job.Rml); LogManager.Log("Loading RMLS..."); - Rmls = (await new RmlsCollectionBuilder(_db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).OrderBy(x => x.FinalName).ToList(); - //Rmls = (await new RmlsCollectionBuilder(_db).SetAll().BuildAsync()).OrderBy(x => x.FinalName).ToList(); + //Rmls = (await new RmlsCollectionBuilder(_db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).OrderBy(x => x.FinalName).ToList(); + Rmls = (await new RmlsCollectionBuilder(_db).SetAll().BuildAsync()).OrderBy(x => x.FinalName).ToList(); LogManager.Log("Loading Color Spaces..."); ColorSpaces = await _db.ColorSpaces.Where(x => x.Code != (int)BL.Enumerations.ColorSpaces.CMYK).ToListAsync(); LogManager.Log("Loading Spool Types..."); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MachineStatusControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MachineStatusControl.xaml new file mode 100644 index 000000000..b2bb998f7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MachineStatusControl.xaml @@ -0,0 +1,49 @@ +<UserControl x:Class="Tango.PPC.Common.Controls.MachineStatusControl" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:operations="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration" + xmlns:local="clr-namespace:Tango.PPC.Common.Controls" + mc:Ignorable="d" + Width="36" Height="Auto"> + <Grid> + <touch:TouchGifAnimation Width="36" HorizontalAlignment="Center" EnableAnimation="True"> + <touch:TouchGifAnimation.Style> + <Style TargetType="touch:TouchGifAnimation"> + <Setter Property="Source" Value="/Images/GlobalStatus/standby.png"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Status}" Value="{x:Static operations:MachineStatuses.Disconnected}"> + <Setter Property="Source" Value="/Images/GlobalStatus/machine_off_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Status}" Value="{x:Static operations:MachineStatuses.PowerUp}"> + <Setter Property="Source" Value="/Images/GlobalStatus/getting_ready_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Status}" Value="{x:Static operations:MachineStatuses.Standby}"> + <Setter Property="Source" Value="/Images/GlobalStatus/standby_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Status}" Value="{x:Static operations:MachineStatuses.ReadyToDye}"> + <Setter Property="Source" Value="/Images/GlobalStatus/Ready_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Status}" Value="{x:Static operations:MachineStatuses.GettingReady}"> + <Setter Property="Source" Value="/Images/GlobalStatus/getting_ready_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Status}" Value="{x:Static operations:MachineStatuses.Printing}"> + <Setter Property="Source" Value="/Images/GlobalStatus/dyeing_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Status}" Value="{x:Static operations:MachineStatuses.ShuttingDown}"> + <Setter Property="Source" Value="/Images/GlobalStatus/shutdown_icon_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Status}" Value="{x:Static operations:MachineStatuses.Error}"> + <Setter Property="Source" Value="/Images/GlobalStatus/error_Anim.gif"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Status}" Value="{x:Static operations:MachineStatuses.Service}"> + <Setter Property="Source" Value="/Images/GlobalStatus/service_Anim.gif"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchGifAnimation.Style> + </touch:TouchGifAnimation> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MachineStatusControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MachineStatusControl.xaml.cs new file mode 100644 index 000000000..55f1294f2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MachineStatusControl.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.Common.Controls +{ + /// <summary> + /// Interaction logic for MachineStatusControl.xaml + /// </summary> + public partial class MachineStatusControl : UserControl + { + public MachineStatusControl() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/Ready_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/Ready_Anim.gif Binary files differnew file mode 100644 index 000000000..11cef3b10 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/Ready_Anim.gif diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/dyeing.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/dyeing.png Binary files differnew file mode 100644 index 000000000..fbace4fa5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/dyeing.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/dyeing_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/dyeing_Anim.gif Binary files differnew file mode 100644 index 000000000..058d9a34d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/dyeing_Anim.gif diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/error.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/error.png Binary files differnew file mode 100644 index 000000000..b4b50e4ac --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/error.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/error_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/error_Anim.gif Binary files differnew file mode 100644 index 000000000..9bf0d84f3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/error_Anim.gif diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/getting-ready.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/getting-ready.png Binary files differnew file mode 100644 index 000000000..a0dc77f92 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/getting-ready.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/getting_ready_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/getting_ready_Anim.gif Binary files differnew file mode 100644 index 000000000..79256816a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/getting_ready_Anim.gif diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/machine-off.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/machine-off.png Binary files differnew file mode 100644 index 000000000..6dc569e35 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/machine-off.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/machine_off_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/machine_off_Anim.gif Binary files differnew file mode 100644 index 000000000..9ca81da39 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/machine_off_Anim.gif diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/ready-to-dye.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/ready-to-dye.png Binary files differnew file mode 100644 index 000000000..7edf624be --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/ready-to-dye.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/service.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/service.png Binary files differnew file mode 100644 index 000000000..ba351ee66 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/service.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/service_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/service_Anim.gif Binary files differnew file mode 100644 index 000000000..f5962c36c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/service_Anim.gif diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/shutdown_icon_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/shutdown_icon_Anim.gif Binary files differnew file mode 100644 index 000000000..d936476b6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/shutdown_icon_Anim.gif diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/shutting-down.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/shutting-down.png Binary files differnew file mode 100644 index 000000000..9aa8e2db6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/shutting-down.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/standby.png b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/standby.png Binary files differnew file mode 100644 index 000000000..6b46c22c0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/standby.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/standby_Anim.gif b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/standby_Anim.gif Binary files differnew file mode 100644 index 000000000..89491179d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Images/GlobalStatus/standby_Anim.gif 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 af3531817..28d8ca5d1 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 @@ -148,6 +148,9 @@ <Compile Include="Console\IConsoleEngineService.cs" /> <Compile Include="Controls\AsyncAdornerControl.cs" /> <Compile Include="Controls\ImageGalleryControl.cs" /> + <Compile Include="Controls\MachineStatusControl.xaml.cs"> + <DependentUpon>MachineStatusControl.xaml</DependentUpon> + </Compile> <Compile Include="Controls\TwineCatalogControl.xaml.cs"> <DependentUpon>TwineCatalogControl.xaml</DependentUpon> </Compile> @@ -292,6 +295,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Controls\MachineStatusControl.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Controls\MultiPieChart.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -517,6 +524,54 @@ <Resource Include="Images\cl-full.png" /> <Resource Include="Images\lubricant2.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\dyeing.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\dyeing_Anim.gif" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\error.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\error_Anim.gif" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\getting-ready.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\getting_ready_Anim.gif" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\machine-off.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\machine_off_Anim.gif" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\ready-to-dye.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\Ready_Anim.gif" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\service.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\service_Anim.gif" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\shutdown_icon_Anim.gif" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\shutting-down.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\standby.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\GlobalStatus\standby_Anim.gif" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> @@ -527,7 +582,7 @@ </Target> <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/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs index c23455fbd..3e36a418d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs @@ -146,6 +146,7 @@ namespace Tango.PPC.UI.Printing if (!context.IsDisposed) { await context.SaveChangesAsync(); + RaiseJobSaved(job); } else { @@ -156,11 +157,10 @@ namespace Tango.PPC.UI.Printing { newJob.JobStatus = JobStatuses.Completed; await newContext.SaveChangesAsync(); + RaiseJobSaved(job); } } } - - RaiseJobSaved(job); } catch (Exception ex) { |
