diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2021-11-15 14:08:38 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2021-11-15 14:08:38 +0200 |
| commit | b53bea7ed0a615a23f841c20707d00dbcc32c91b (patch) | |
| tree | 2bd1bdb65dc57741849681fe944fd9b6dda51f98 /Software/Visual_Studio/PPC/Modules | |
| parent | a74ecac5d1980775f10d719fe8ae93b0695eee72 (diff) | |
| download | Tango-b53bea7ed0a615a23f841c20707d00dbcc32c91b.tar.gz Tango-b53bea7ed0a615a23f841c20707d00dbcc32c91b.zip | |
PPC. Color Selection Dialog. Disable buttons OK, Validation when select CMYK tab from Catalog, gui changes.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
14 files changed, 437 insertions, 481 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 94c504908..48d609a1a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -605,6 +605,7 @@ namespace Tango.PPC.Jobs.ViewModels } Job.LastUpdated = DateTime.UtcNow; + Job.Version = 1; Job.IsSynchronized = false; Job.JobStatus = BL.Enumerations.JobStatuses.Draft; Job.MarkModified(_db); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml index 97a0da9e7..3097121a6 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml @@ -13,7 +13,8 @@ <Grid.RowDefinitions> <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <controls:TwineCatalogControl x:Name="catalogControl" DataContext="{Binding RelativeSource={RelativeSource AncestorType=local:TwineCatalogViewer},Path=Catalog,Mode=TwoWay}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=local:TwineCatalogViewer},Path=SelectedItem,Mode=TwoWay}" + <controls:TwineCatalogControl x:Name="catalogControl" DataContext="{Binding RelativeSource={RelativeSource AncestorType=local:TwineCatalogViewer},Path=Catalog,Mode=TwoWay}" + SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=local:TwineCatalogViewer},Path=SelectedItem,Mode=TwoWay}" CollectionFilter ="{Binding RelativeSource={RelativeSource AncestorType=local:TwineCatalogViewer},Path=CollectionFilter,Mode=TwoWay}"/> </Grid> </UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml.cs index a0b9e62c8..d71fa66ff 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Controls/TwineCatalogViewer.xaml.cs @@ -79,8 +79,12 @@ namespace Tango.PPC.Jobs.Controls set { SetValue(CollectionFilterProperty, value); } } public static readonly DependencyProperty CollectionFilterProperty = - DependencyProperty.Register("CollectionFilter", typeof(ICollectionFilter), typeof(TwineCatalogViewer), new PropertyMetadata(null)); + DependencyProperty.Register("CollectionFilter", typeof(ICollectionFilter), typeof(TwineCatalogViewer), new PropertyMetadata(null, (d, e) => (d as TwineCatalogViewer).OnCollectionFilterChanged())); + private void OnCollectionFilterChanged() + { + + } /// <summary> /// Called when the filter has been changed /// </summary> 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 a2c33cb75..abe89b0d7 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 @@ -13,7 +13,7 @@ xmlns:global="clr-namespace:Tango.PPC.Jobs" mc:Ignorable="d" Background="{StaticResource TangoMidBackgroundBrush}" - d:DesignHeight="1280" d:DesignWidth="800" Width="780" Height="1200" + d:DesignHeight="1280" d:DesignWidth="800" Width="750" Height="1200" d:DataContext="{d:DesignInstance Type=vm:ColorSelectionViewVM, IsDesignTimeCreatable=False}"> <UserControl.Resources> @@ -97,7 +97,7 @@ <TextBlock Text="Best Match" FontSize="{StaticResource TangoDataGridHeaderFontSize}" HorizontalAlignment="Left"/> <Border HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="100" Width="100" Margin="0 21 0 0" CornerRadius="20" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> <Border.Background> - <SolidColorBrush Color="{Binding SelectedBrushStop.DisplayedColor}"/> + <SolidColorBrush Color="{Binding SelectedBrushStop.BestMatchColor}"/> </Border.Background> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding SelectedBrushStop.IsBusy,Converter={StaticResource BooleanToVisibilityConverter}}"> @@ -142,7 +142,20 @@ </StackPanel> <Grid Grid.Row="2"> - <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" Width="200" Height="50" VerticalAlignment="Bottom" Background="{StaticResource TangoMidAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" ShadowDepth="0">OK</touch:TouchButton> + <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" Width="200" Height="50" VerticalAlignment="Bottom" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" ShadowDepth="0" Content="OK"> + <touch:TouchButton.Style > + <Style TargetType="touch:TouchButton" > + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"/> + <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> </Grid> </DataTemplate> @@ -352,14 +365,15 @@ <Grid VerticalAlignment="Center" HorizontalAlignment="Left" Margin="60 5 0 0" DockPanel.Dock="Left" Width="200"> <DockPanel> <touch:TouchIcon DockPanel.Dock="Left" Foreground="{StaticResource TangoGrayBrush}" Width="20" Height="20" VerticalAlignment="Bottom" Icon="Magnify" /> - <touch:TouchTextBox Margin="5 0 0 0" Width="300" Text="{Binding Filter,Mode=TwoWay}" ></touch:TouchTextBox> + <touch:TouchTextBox Margin="5 0 0 0" Width="300" Text="{Binding Filter,Mode=TwoWay, UpdateSourceTrigger=LostFocus}" ></touch:TouchTextBox> </DockPanel> </Grid> <touch:TouchComboBox Margin="0 5 60 0" Grid.Column="1" Width="200" HorizontalContentAlignment="Right" ItemsSource="{Binding Catalogs}" SelectedItem="{Binding SelectedCatalog}" DisplayMemberPath="Name" Title="Twine Catalog"/> </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}" /> + + <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"> <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" Width="200" Height="50" VerticalAlignment="Bottom" Background="{StaticResource TangoMidAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" ShadowDepth="0">OK</touch:TouchButton> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index 17fd92ecc..4fb830112 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 @@ -196,11 +196,14 @@ namespace Tango.PPC.Jobs.Dialogs get { return _selectedBrushStop; } set { - _selectedBrushStop = value; - RaisePropertyChangedAuto(); + if (_selectedBrushStop != value) + { + _selectedBrushStop = value; + RaisePropertyChangedAuto(); + } } } - + public double MaxCyanValue { get @@ -276,10 +279,10 @@ namespace Tango.PPC.Jobs.Dialogs private void OnFilterChanged() { - + if(CollectionFilter != null) + { CollectionFilter.RaiseFilterChanged(); - // View.ScrollToTop(); - + } } #endregion @@ -301,7 +304,7 @@ namespace Tango.PPC.Jobs.Dialogs } else { - return (colorCatalogsItem.Name.ToLower().Contains(Filter.ToLower())); + return (colorCatalogsItem.Name.ToLower().StartsWith(Filter.ToLower())); } } else @@ -323,12 +326,15 @@ namespace Tango.PPC.Jobs.Dialogs InitialBrushStop = DialogEditObject.BrushStopForEdit; SelectedBrushStop = InitialBrushStop.Clone(); + SelectedBrushStop.ColorSpace = InitialBrushStop.ColorSpace; if(SelectedBrushStop.ColorSpace == ColorSpaces.Volume) SelectedColorTab = ColorTab.Volume; if (SelectedBrushStop.ColorSpace == ColorSpaces.LAB) + { SelectedColorTab = ColorTab.CIELab; - if (SelectedBrushStop.ColorSpace == ColorSpaces.Catalog) + } + else if(SelectedBrushStop.ColorSpace == ColorSpaces.Catalog) { SelectedColorTab = ColorTab.Catalog; if (SelectedBrushStop.ColorCatalogsItem != null) @@ -339,11 +345,10 @@ namespace Tango.PPC.Jobs.Dialogs { SelectedCatalog = Catalogs.FirstOrDefault(); } - } - - if (SelectedBrushStop.ColorSpace == ColorSpaces.HSB) + } + else if (SelectedBrushStop.ColorSpace == ColorSpaces.HSB) SelectedColorTab = ColorTab.HSB; - if (SelectedBrushStop.ColorSpace == ColorSpaces.RGB) + else if (SelectedBrushStop.ColorSpace == ColorSpaces.RGB) SelectedColorTab = ColorTab.RGB; } else @@ -354,8 +359,10 @@ namespace Tango.PPC.Jobs.Dialogs } SelectedBrushStop.ColorCatalogsItemChanged -= OnColorSelectionItemChanged; SelectedBrushStop.ColorCatalogsItemChanged += OnColorSelectionItemChanged; - UpdateVolumesMaxValues(); + OKCommand.RaiseCanExecuteChanged(); + SelectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; + SelectedBrushStop.LiquidVolumesOutOfRangeChanged += OnLiquidVolumesOutOfRangeChanged; } private void OnSelectedtabChanged() @@ -443,12 +450,29 @@ namespace Tango.PPC.Jobs.Dialogs RaisePropertyChanged(nameof(MaxBlackValue)); } + private void OnLiquidVolumesOutOfRangeChanged(object sender, EventArgs e) + { + + OKCommand.RaiseCanExecuteChanged(); + } + protected override void Accept() { + _selectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; base.Accept(); } + protected override void Cancel() + { + _selectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; + base.Cancel(); + } + + protected override bool CanOK() + { + return SelectedBrushStop!= null && !SelectedBrushStop.LiquidVolumesOutOfRange; + } #endregion - + } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml index 7dc654bec..c544ade70 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml @@ -9,7 +9,7 @@ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" mc:Ignorable="d" - Background="{StaticResource TangoMidBackgroundBrush}" d:DesignHeight="861" d:DesignWidth="662" Width="790" Height="1200" d:DataContext="{d:DesignInstance Type=local:JobCreationViewVM, IsDesignTimeCreatable=False}" HorizontalAlignment="Center"> + Background="{StaticResource TangoMidBackgroundBrush}" d:DesignHeight="861" d:DesignWidth="600" Width="750" Height="1200" d:DataContext="{d:DesignInstance Type=local:JobCreationViewVM, IsDesignTimeCreatable=False}" HorizontalAlignment="Center"> <UserControl.Resources> <converters:JobTypeToImageConverter x:Key="JobTypeToImageConverter" /> @@ -65,7 +65,20 @@ <Grid Grid.Row="1" Margin="24 17 24 31" Background="{StaticResource TangoPrimaryBackgroundBrush}"> <DockPanel Margin="47 38 54 40"> <Grid DockPanel.Dock="Bottom"> - <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" Width="180" Height="48" VerticalAlignment="Bottom" Background="{StaticResource TangoMidAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}">OK</touch:TouchButton> + <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" Width="180" Height="48" VerticalAlignment="Bottom" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" Content="OK"> + <touch:TouchButton.Style > + <Style TargetType="touch:TouchButton" > + <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"/> + <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> <Grid DockPanel.Dock="Top" > @@ -140,10 +153,9 @@ </Grid> <Grid Grid.Row="3" Margin="0 70 0 0" HorizontalAlignment="Stretch" Visibility="{Binding ShowDuplicate, Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Save Job As PDF" FontWeight="Normal" FontSize="{StaticResource TangoDialogFontSize}" Width="Auto"/> - <touch:TouchButton CornerRadius="25" Command="{Binding DuplicateCommand}" Width="180" Height="48" VerticalAlignment="Center" HorizontalAlignment="Right" Background="{StaticResource TangoPrimaryAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}"> - - <StackPanel> - <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Export" FontWeight="Normal" FontSize="{StaticResource TangoDialogFontSize}" Width="Auto"/> + <touch:TouchButton CornerRadius="25" Command="{Binding DuplicateCommand}" Width="180" Height="48" VerticalAlignment="Center" HorizontalAlignment="Right" Background="{StaticResource TangoPrimaryAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" IsEnabled="False"> + <StackPanel> + <TextBlock HorizontalAlignment="Left" Margin="0 0 0 0" Text="Export" FontWeight="Normal" FontSize="{StaticResource TangoDialogFontSize}" Width="Auto"/> </StackPanel> </touch:TouchButton> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs index 66be7bd04..9bc004fa9 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationViewVM.cs @@ -23,7 +23,7 @@ namespace Tango.PPC.Jobs.Dialogs get { return _jobName; } set { _jobName = value; RaisePropertyChangedAuto(); - InvalidateRelayCommands(); + OKCommand.RaiseCanExecuteChanged(); } } @@ -46,7 +46,8 @@ namespace Tango.PPC.Jobs.Dialogs get { return _selectedRML; } set { _selectedRML = value; RaisePropertyChangedAuto(); - } + OKCommand.RaiseCanExecuteChanged(); + } } private List<SpoolType> _spoolTypes; @@ -57,7 +58,9 @@ namespace Tango.PPC.Jobs.Dialogs { get { return _spoolTypes; } set { _spoolTypes = value; - RaisePropertyChangedAuto(); } + RaisePropertyChangedAuto(); + OKCommand.RaiseCanExecuteChanged(); + } } private SpoolType _selectedSpoolType; @@ -117,7 +120,8 @@ namespace Tango.PPC.Jobs.Dialogs protected override bool CanOK() { - return false == String.IsNullOrEmpty(JobName); + //var ret = (false == String.IsNullOrEmpty(JobName) && SelectedRML != null && SelectedSpoolType != null); + return (false == String.IsNullOrEmpty(JobName) && SelectedRML!=null && SelectedSpoolType!=null); } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobView.xaml index 90c5b8b9f..bf242e98b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/RepeatJobView.xaml @@ -6,27 +6,31 @@ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.Jobs.Dialogs" mc:Ignorable="d" - Background="Transparent" d:DesignHeight="630" d:DesignWidth="560" MinWidth="380" Height="280" + Background="Transparent" d:DesignHeight="630" d:DesignWidth="560" MinWidth="380" Height="250" d:DataContext="{d:DesignInstance Type=local:RepeatJobViewVM, IsDesignTimeCreatable=False}"> <Border BorderBrush="{StaticResource TangoMidAccentBrush}" Margin="-24" CornerRadius="40" BorderThickness="2" Background="{StaticResource TangoPrimaryBackgroundBrush}"> <Grid> - - <DockPanel Height="33" VerticalAlignment="Top" Margin="44 39 40 0" Grid.Row="0"> - <TextBlock DockPanel.Dock="Left" FontSize="{StaticResource TangoMessageBoxButtonFontSize}" FontWeight="SemiBold" > Copy Job Summary</TextBlock> - <touch:TouchIconButton DockPanel.Dock="Right" VerticalAlignment="Center" Height="22" Command="{Binding CloseCommand}" Icon="Close" RippleBrush="{StaticResource TangoRippleDarkBrush}" Foreground="{StaticResource TangoDarkForegroundBrush}" HorizontalAlignment="Right" /> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <DockPanel VerticalAlignment="Top" Margin="0 16 18 18" Grid.Row="0"> + <touch:TouchIconButton DockPanel.Dock="Right" VerticalAlignment="Center" Height="28" Command="{Binding CloseCommand}" Icon="CloseCircleOutline" RippleBrush="{StaticResource TangoRippleDarkBrush}" Foreground="{StaticResource TangoDarkForegroundBrush}" HorizontalAlignment="Right" /> </DockPanel> - - <Grid Margin="44 0 0 0" Grid.Row="1" Width="302" VerticalAlignment="Center" HorizontalAlignment="Left"> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Top"> - <TextBlock HorizontalAlignment="Left" DockPanel.Dock="Left" FontSize="{StaticResource TangoButtonFontSize}" >Repeat:</TextBlock> - <touch:TouchNumericUpDownConrol Margin="30 0 30 0" Width="Auto" Value="{Binding Repeats, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" BorderThickness="0" MaxValue="{Binding MaxRepeations, Mode=OneWay}" MinValue="1" Style="{StaticResource TouchNumericMiddleUpDownControl}"/> - <TextBlock HorizontalAlignment="Right" FontSize="{StaticResource TangoButtonFontSize}">Units</TextBlock> - </StackPanel> - <Rectangle Margin="0 30 0 0" Width="382" Stroke="{StaticResource TangoDividerBrush}" Height="3" VerticalAlignment="Bottom"/> - </Grid> - <touch:TouchButton Margin="0 0 0 60 " Command="{Binding OKCommand}" FontSize="{StaticResource TangoButtonFontSize}" Style="{StaticResource TangoFlatButton}" Width="100" Height="50" VerticalAlignment="Bottom">OK</touch:TouchButton> + <TextBlock Grid.Row="1" Height="26" FontSize="{StaticResource TangoMessageBoxButtonFontSize}" FontWeight="SemiBold" HorizontalAlignment="Center"> Repeat All</TextBlock> + + <StackPanel Margin="0 20 0 0" Grid.Row="2" Width="302" VerticalAlignment="Center" HorizontalAlignment="Center"> + <touch:TouchNumericUpDownConrol Margin="0 0 0 0" Width="Auto" Value="{Binding Repeats, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" BorderThickness="0" MaxValue="{Binding MaxRepeations, Mode=OneWay}" MinValue="1" Style="{StaticResource TouchNumericMiddleUpDownControl}"/> + + <Rectangle Margin="0 7 0 0" Stroke="{StaticResource TangoMidAccentBrush}" Height="1" VerticalAlignment="Bottom"/> + + + <touch:TouchButton Margin="0 41 0 0 " Command="{Binding OKCommand}" FontSize="{StaticResource TangoMessageBoxButtonFontSize}" Style="{StaticResource TangoFlatButton}" Width="Auto" VerticalAlignment="Bottom" HorizontalAlignment="Center">OK</touch:TouchButton> + </StackPanel> </Grid> </Border> </UserControl> 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 8cafd369d..6a63a9b3b 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 @@ -32,6 +32,7 @@ namespace Tango.PPC.Jobs.Models private IColorConverter _converter; public const double MAX_INK_UPTAKE = 400; public event EventHandler ColorCatalogsItemChanged; + public event EventHandler LiquidVolumesOutOfRangeChanged; #region Property @@ -316,6 +317,45 @@ namespace Tango.PPC.Jobs.Models } } + + public Double BestMatchL + { + get + { + if (BestMatchColor == null) + return 0; + Rgb color = new Rgb(BestMatchColor.R, BestMatchColor.G, BestMatchColor.B); + Lab lab = new Lab(color); + return lab.L; + } + } + + public Double BestMatchA + { + get + { + if (BestMatchColor == null) + return 0; + Rgb color = new Rgb(BestMatchColor.R, BestMatchColor.G, BestMatchColor.B); + Lab lab = new Lab(color); + return lab.A; + } + } + + + public Double BestMatchB + { + get + { + if (BestMatchColor == null) + return 0; + Rgb color = new Rgb(BestMatchColor.R, BestMatchColor.G, BestMatchColor.B); + Lab lab = new Lab(color); + return lab.B; ; + } + } + + protected Double _offsetpercent; /// <summary> @@ -391,7 +431,9 @@ namespace Tango.PPC.Jobs.Models public PositionStatus Position { get { return _position; } - set { _position = value; } + set { _position = value; + RaisePropertyChangedAuto(); + } } protected ColorSpaces _colorspace; @@ -409,6 +451,7 @@ namespace Tango.PPC.Jobs.Models { _colorspace = value; } + RaisePropertyChangedAuto(); } } @@ -427,6 +470,8 @@ namespace Tango.PPC.Jobs.Models _colorcatalogsitem = value; OnColorCatalogsItemChanged(); RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(ColorCatalog)); + } } } @@ -466,14 +511,17 @@ namespace Tango.PPC.Jobs.Models } } - private System.Windows.Media.Color _displayedColor; + private System.Windows.Media.Color _bestMatchColor; - public System.Windows.Media.Color DisplayedColor + public System.Windows.Media.Color BestMatchColor { - get { return _displayedColor; } + get { return _bestMatchColor; } set { - _displayedColor = value; + _bestMatchColor = value; RaisePropertyChangedAuto(); + RaisePropertyChanged(nameof(BestMatchA)); + RaisePropertyChanged(nameof(BestMatchB)); + RaisePropertyChanged(nameof(BestMatchB)); } } @@ -543,11 +591,12 @@ namespace Tango.PPC.Jobs.Models IsOutOfGamut = false; _volumeConversionTimer = new ActionTimer(TimeSpan.FromMilliseconds(50)); _converter = new DefaultColorConverter(); - _displayedColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + _bestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); Color = Colors.White; ColorSpace = ColorSpaces.RGB; ColorCatalogsItem = null; PreventPropertyUpdate = false; + LiquidVolumesOutOfRange = false; } public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel) @@ -555,7 +604,7 @@ namespace Tango.PPC.Jobs.Models SegmentModel = segmentModel; OffsetPercent = brushStop.OffsetPercent; Color = brushStop.Color; - DisplayedColor = brushStop.Color; + BestMatchColor = brushStop.Color; ColorSpace = brushStop.ColorSpace.Space; ColorCatalogsItem = brushStop.ColorCatalogsItem; StopIndex = brushStop.StopIndex; @@ -572,6 +621,7 @@ namespace Tango.PPC.Jobs.Models A = brushStop.A; B = brushStop.B; PreventPropertyUpdate = false; + LiquidVolumesOutOfRange = false; } #region Methods @@ -609,12 +659,11 @@ namespace Tango.PPC.Jobs.Models Magenta = newBrushStop.Magenta; Yellow = newBrushStop.Yellow; Black = newBrushStop.Black; - - PreventPropertyUpdate = false; - ColorCatalogsItem = newBrushStop.ColorCatalogsItem; + PreventPropertyUpdate = false; + Color = newBrushStop.Color; - DisplayedColor = newBrushStop.DisplayedColor; + BestMatchColor = newBrushStop.BestMatchColor; } /// <summary> @@ -686,12 +735,13 @@ namespace Tango.PPC.Jobs.Models cloned.ColorCatalogsItem = ColorCatalogsItem; cloned.ColorSpace = ColorSpace; - cloned.DisplayedColor = DisplayedColor; + cloned.BestMatchColor = BestMatchColor; cloned.OffsetMeters = OffsetMeters; cloned.OffsetPercent = OffsetPercent; cloned.Position = Position; cloned.IsOutOfGamut = IsOutOfGamut; cloned.OutOfGamutChecked = OutOfGamutChecked; + cloned.LiquidVolumesOutOfRange = LiquidVolumesOutOfRange; //this.MapPropertiesTo(cloned, MappingFlags.NoReferenceTypes); cloned.PreventPropertyUpdate = false; return cloned; @@ -761,6 +811,8 @@ namespace Tango.PPC.Jobs.Models private void OnColorCatalogsItemChanged() { + if (PreventPropertyUpdate) + return; ColorSpace = ColorSpaces.Catalog; if (_colorcatalogsitem != null) { @@ -768,8 +820,9 @@ namespace Tango.PPC.Jobs.Models _green = (int)_colorcatalogsitem.Green; _blue = (int)_colorcatalogsitem.Blue; InitColor(); - DisplayedColor = Color; + BestMatchColor = Color; } + if (ColorCatalogsItemChanged != null) { ColorCatalogsItemChanged.Invoke(this, new EventArgs()); @@ -958,21 +1011,20 @@ namespace Tango.PPC.Jobs.Models { if (ColorSpace != ColorSpaces.Volume) { - if (ColorSpace == ColorSpaces.Catalog) { - if(ColorCatalogsItem != null) - { - _cyan =ColorCatalogsItem.Cyan; - _magenta = ColorCatalogsItem.Magenta; - _yellow = ColorCatalogsItem.Yellow; - _black = ColorCatalogsItem.Black; - RaisePropertyChanged(nameof(Cyan)); - RaisePropertyChanged(nameof(Yellow)); - RaisePropertyChanged(nameof(Magenta)); - RaisePropertyChanged(nameof(Black)); - IsOutOfGamut = false; - RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + if (ColorCatalogsItem != null) + { + _cyan = ColorCatalogsItem.Cyan; + _magenta = ColorCatalogsItem.Magenta; + _yellow = ColorCatalogsItem.Yellow; + _black = ColorCatalogsItem.Black; + RaisePropertyChanged(nameof(Cyan)); + RaisePropertyChanged(nameof(Yellow)); + RaisePropertyChanged(nameof(Magenta)); + RaisePropertyChanged(nameof(Black)); + IsOutOfGamut = false; + RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); } return; } @@ -992,6 +1044,12 @@ namespace Tango.PPC.Jobs.Models _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); 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); + RaisePropertyChanged(nameof(Cyan)); RaisePropertyChanged(nameof(Yellow)); RaisePropertyChanged(nameof(Magenta)); @@ -1013,9 +1071,9 @@ namespace Tango.PPC.Jobs.Models { if (ColorSpace != ColorSpaces.Catalog) { - if (DisplayedColor == null) - DisplayedColor = Color; - var closestItem = catalogs.SelectMany(x => x.AllItemsOrdered).GetClosestItem(DisplayedColor); + if (BestMatchColor == null) + BestMatchColor = Color; + var closestItem = catalogs.SelectMany(x => x.AllItemsOrdered).GetClosestItem(BestMatchColor); ColorCatalogsItem = closestItem; RaisePropertyChanged(nameof(ColorCatalog)); @@ -1071,23 +1129,37 @@ namespace Tango.PPC.Jobs.Models } return 0.0; } + public bool IsLiquidVolumesOutOfRange { get { - if (ColorSpace == BL.Enumerations.ColorSpaces.Volume) - { - var sum = GetColorNLPerCm(Cyan, LiquidTypes.Cyan) + GetColorNLPerCm(Magenta, LiquidTypes.Magenta) + GetColorNLPerCm(Yellow, LiquidTypes.Yellow) + GetColorNLPerCm(Black, LiquidTypes.Black); - var maxLiq = GetTotalMaximumLiquidNlPerCMLimit(); + //if (ColorSpace == BL.Enumerations.ColorSpaces.Volume) + // { + var sum = GetColorNLPerCm(Cyan, LiquidTypes.Cyan) + GetColorNLPerCm(Magenta, LiquidTypes.Magenta) + GetColorNLPerCm(Yellow, LiquidTypes.Yellow) + GetColorNLPerCm(Black, LiquidTypes.Black); + var maxLiq = GetTotalMaximumLiquidNlPerCMLimit(); + LiquidVolumesOutOfRange = sum > GetTotalMaximumLiquidNlPerCMLimit(); + + return LiquidVolumesOutOfRange; + // } + // else return false; + } + } - return sum > GetTotalMaximumLiquidNlPerCMLimit(); + private bool _liquidVolumesOutOfRange; + + public bool LiquidVolumesOutOfRange + { + get { return _liquidVolumesOutOfRange; } + set { + if(_liquidVolumesOutOfRange != value) + { + _liquidVolumesOutOfRange = value; + LiquidVolumesOutOfRangeChanged?.Invoke(this, new EventArgs()); } - else return false; } } - - public void OnBrushStopFieldValueChanged() { IsBusy = true; @@ -1102,10 +1174,10 @@ namespace Tango.PPC.Jobs.Models Configuration configuration = SegmentModel.Job.Machine.Configuration; Rml rml = SegmentModel.Job.Rml; - - RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); + if ( ColorSpace == BL.Enumerations.ColorSpaces.Volume) { + //RaisePropertyChanged(nameof(IsLiquidVolumesOutOfRange)); if(IsLiquidVolumesOutOfRange) { IsBusy = false; @@ -1123,7 +1195,7 @@ namespace Tango.PPC.Jobs.Models _green = output.SingleCoordinates.Green; _blue = output.SingleCoordinates.Blue; InitColor(); - DisplayedColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + BestMatchColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); } else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.LAB) @@ -1131,7 +1203,7 @@ namespace Tango.PPC.Jobs.Models IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); Lab lab = new Lab(output.SingleCoordinates.L, output.SingleCoordinates.A, output.SingleCoordinates.B); Rgb rgb = new Rgb(lab.ToRgb()); - DisplayedColor = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + BestMatchColor = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); //TODO ASK ROY //foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) //{ @@ -1148,18 +1220,18 @@ namespace Tango.PPC.Jobs.Models else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB) { IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); - DisplayedColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + 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); - DisplayedColor = Color.FromRgb((byte)output.SingleCoordinates.Red, (byte)output.SingleCoordinates.Green, (byte)output.SingleCoordinates.Blue); + 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."); - DisplayedColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + BestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); } finally { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs index 3bb6188d9..921458197 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs @@ -119,34 +119,12 @@ namespace Tango.PPC.Jobs.Models _numberofunits = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits)); + RaisePropertyChanged(nameof(GetEstimatedDuration)); } } } - - //protected Boolean _enableintersegment; - - ///// <summary> - ///// Gets or sets the JobModel enable inter segment. - ///// </summary> - //public Boolean EnableInterSegment - //{ - // get - // { - // return _enableintersegment; - // } - - // set - // { - // if (_enableintersegment != value) - // { - // _enableintersegment = value; - // RaisePropertyChangedAuto(); - - // } - // } - //} - + protected Double _intersegmentlength; /// <summary> @@ -403,7 +381,25 @@ namespace Tango.PPC.Jobs.Models } public List<SegmentModel> SegmentsToCopy { get; set; } - + + public TimeSpan GetEstimatedDuration + { + get + { + if (Rml == null || Rml.GetActiveProcessGroup().ProcessParametersTables == null) + return TimeSpan.Zero; + var processParameters = Rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault(); + + if (processParameters.DyeingSpeed != 0) + { + return TimeSpan.FromSeconds((LengthIncludingNumberOfUnits + processParameters.DryerBufferLengthMeters) / (processParameters.DyeingSpeed / 100d)); + } + return TimeSpan.Zero; + } + } + + + #endregion public JobModel(List<ColorSpace> list) @@ -416,6 +412,7 @@ namespace Tango.PPC.Jobs.Models Segments.CollectionChanged += Segments_CollectionChanged; SelectAllSegments = false; InterSegmentLength = 5; + NumberOfUnits = 1; } #region modifications @@ -519,6 +516,7 @@ namespace Tango.PPC.Jobs.Models { RaisePropertyChanged(nameof(Length)); RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits)); + RaisePropertyChanged(nameof(GetEstimatedDuration)); } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs index d72986b0f..b55f9468f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs @@ -309,6 +309,16 @@ namespace Tango.PPC.Jobs.Models } } + private bool _isLast; + + public bool IsLast + { + get { return _isLast; } + set { _isLast = value; + RaisePropertyChangedAuto(); + } + } + #endregion #region command @@ -322,6 +332,7 @@ namespace Tango.PPC.Jobs.Models InitnewSegment(); Job = jobModel; GUID = guid; + IsLast = false; } public SegmentModel() @@ -339,6 +350,7 @@ namespace Tango.PPC.Jobs.Models IsOffsetChanged = false; Length = 5; IsSelected = false; + IsLast = false; _enableintersegment = false; AddGapCommand = new RelayCommand(x => AddGap()); DeleteGapCommand = new RelayCommand(x => DeleteGap()); @@ -358,7 +370,7 @@ namespace Tango.PPC.Jobs.Models { //TODO test if displayed is valid stop.IsValid - Color color = stop.DisplayedColor; + Color color = stop.BestMatchColor; stops.Add(new GradientStop( color, stop.OffsetPercent / 100d)); } @@ -376,7 +388,7 @@ namespace Tango.PPC.Jobs.Models for (int i = 0; i < BrushStops.Count; i++) { //TODO test if displayed is valid stop.IsValid - Color color = BrushStops[i].DisplayedColor; + Color color = BrushStops[i].BestMatchColor; _brush.GradientStops[i].Color = color; _brush.GradientStops[i].Offset = BrushStops[i].OffsetPercent / 100d; } @@ -441,7 +453,7 @@ namespace Tango.PPC.Jobs.Models middleBrushStop.OffsetPercent = 50; middleBrushStop.IsOutOfGamut = false; middleBrushStop.Color = BrushStopModel.GetRelativeRGB(firstBrush.Color, secondBrush.Color, 0, 1, 0.5); - middleBrushStop.DisplayedColor = BrushStopModel.GetRelativeRGB(firstBrush.DisplayedColor, secondBrush.DisplayedColor, 0, 1, 0.5); + middleBrushStop.BestMatchColor = BrushStopModel.GetRelativeRGB(firstBrush.BestMatchColor, secondBrush.BestMatchColor, 0, 1, 0.5); BrushStops.Add(middleBrushStop); AddOrReplaceSecondBrush(secondBrush); @@ -496,7 +508,7 @@ namespace Tango.PPC.Jobs.Models if (MiddleBrushStop != null && SecondBrushStop != null && FirstBrushStop != null) { MiddleBrushStop.Color = BrushStopModel.GetRelativeRGB(FirstBrushStop.Color, SecondBrushStop.Color, 0, 1, 0.5); - MiddleBrushStop.DisplayedColor = BrushStopModel.GetRelativeRGB(FirstBrushStop.DisplayedColor, SecondBrushStop.DisplayedColor, 0, 1, 0.5); + MiddleBrushStop.BestMatchColor = BrushStopModel.GetRelativeRGB(FirstBrushStop.BestMatchColor, SecondBrushStop.BestMatchColor, 0, 1, 0.5); } } 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 9cb6c3189..48908f09d 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 @@ -258,6 +258,16 @@ namespace Tango.PPC.Jobs.ViewModels } } + private bool _isSummaryOpened; + + public bool IsSummaryOpened + { + get { return _isSummaryOpened; } + set { _isSummaryOpened = value; + RaisePropertyChangedAuto(); + } + } + #endregion #region Commands @@ -403,56 +413,13 @@ namespace Tango.PPC.Jobs.ViewModels RedoCommand = new RelayCommand(Redo, (x) => { return false; }); IsFullMode = true; + IsSummaryOpened = true; } #endregion #region Job Management - - public void AddGradientBrushes(Segment segment, BrushStop firstBrush, BrushStop secondBrush) - { - if (segment == null) - return; - - firstBrush.BestMatchR = firstBrush.Color.R; - firstBrush.BestMatchG = firstBrush.Color.G; - firstBrush.BestMatchB = firstBrush.Color.B; - - BrushStop brushStop = firstBrush.CloneBrush(); - brushStop.StopIndex = 1; - brushStop.OffsetPercent = 0; - brushStop.IsOutOfGamut = false; - segment.BrushStops.Add(brushStop); - - BrushStop firstbrushStop = firstBrush.CloneBrush(); - firstbrushStop.StopIndex = 2; - firstbrushStop.OffsetPercent = 0; - segment.BrushStops.Add(firstbrushStop); - - secondBrush.BestMatchR = secondBrush.Color.R; - secondBrush.BestMatchG = secondBrush.Color.G; - secondBrush.BestMatchB = secondBrush.Color.B; - - - BrushStop middleBrushStop = firstBrush.CloneBrush(); - middleBrushStop.StopIndex = 3; - middleBrushStop.OffsetPercent = 50;//secondBrush.OffsetPercent; - middleBrushStop.IsOutOfGamut = false; - middleBrushStop.Color = BrushStopModel.GetRelativeRGB(firstBrush.Color, secondBrush.Color, 0, 1, 0.5); - segment.BrushStops.Add(middleBrushStop); - - BrushStop secondbrushStop = secondBrush.CloneBrush(); - secondbrushStop.StopIndex = 4; - secondbrushStop.OffsetPercent = 100; - segment.BrushStops.Add(secondbrushStop); - - BrushStop lastSecondBrushStop = secondBrush.CloneBrush(); - lastSecondBrushStop.StopIndex = 5; - lastSecondBrushStop.OffsetPercent = 100; - lastSecondBrushStop.IsOutOfGamut = false; - segment.BrushStops.Add(lastSecondBrushStop); - } - + /// <summary> /// Loads the job. /// </summary> @@ -465,7 +432,6 @@ namespace Tango.PPC.Jobs.ViewModels //View.ScrollToTop(); LogManager.Log($"Loading selected job '{_job_to_load.Name}'..."); - //NotificationProvider.SetGlobalBusyMessage("Loading job details..."); IsFree = false; _can_navigate_back = false; @@ -511,48 +477,7 @@ namespace Tango.PPC.Jobs.ViewModels .WithSegments() .WithBrushStops() .BuildAsync(); - - //Modify old Job... - //if (Job.Version == 1) - //{ - // var segments = Job.Segments; - // Job.Segments = new SynchronizedObservableCollection<Segment>(); - // int segindex = 1; - - // foreach (var segm in segments) - // { - // if (!segm.IsInterSegment && segm.BrushStops.Count > 1) - // { - // var brushes = segm.BrushStops; - // Segment currentSegment = segm; - // double lengthOfOldSegment = segm.Length; - // for (int index = 0; index < (brushes.Count - 1); index++) - // { - - // currentSegment = new Segment(); - // currentSegment.Guid = System.Guid.NewGuid().ToString(); - // currentSegment.Name = segm.Name; - // currentSegment.Job = Job; - - // currentSegment.SegmentIndex = segindex++; - // currentSegment.BrushStops = new SynchronizedObservableCollection<BrushStop>(); - - // brushes[index].Segment = currentSegment; - // brushes[index + 1].Segment = currentSegment; - // currentSegment.Length = (lengthOfOldSegment * (brushes[index + 1].OffsetPercent - brushes[index].OffsetPercent) / 100d) ; - // AddGradientBrushes(currentSegment, brushes[index], brushes[index + 1]); - // Job.Segments.Add(currentSegment); - // } - - // } - // else - // { - // segm.SegmentIndex = segindex++; - // Job.Segments.Add(segm); - // } - // } - //} - + Job.NameChanged -= Job_NameChanged; Job.NameChanged += Job_NameChanged; @@ -577,81 +502,8 @@ namespace Tango.PPC.Jobs.ViewModels await LoadRML(_selectedRML); - - ///NEW CODE Save to MODEL - var jobModel = new JobModel(ColorSpaces) - { - Name = Job.Name, - CreationDate = Job.CreationDate, - LengthPercentageFactor = Job.LengthPercentageFactor, - NumberOfUnits = Job.NumberOfUnits, - IsAllSegmentsPerSpool = Job.IsAllSegmentsPerSpool, - Rml = Job.Rml, - ColorSpace = Job.ColorSpace, - SpoolType = Job.SpoolType, - User = Job.User, - Machine = Job.Machine - }; - - foreach (var segm in Job.Segments) - { - if (Job.Version == 1 && segm.BrushStops.Count > 1) - { - int segmentindex = 1; - - var brushes = segm.BrushStops; - Segment currentSegment = segm; - double lengthOfOldSegment = segm.Length; - for (int index = 0; index < (brushes.Count - 1); index++) - { - SegmentModel csegmentModel = new SegmentModel(jobModel, segm.Guid) - { - Name = segm.Name, - Length = segm.Length, - SegmentIndex = segm.SegmentIndex, - IsInterSegment = segm.IsInterSegment, - EnableInterSegment = false, - Job = jobModel - }; - - csegmentModel.SegmentIndex = segmentindex++; - - brushes[index].Segment = currentSegment; - brushes[index + 1].Segment = currentSegment; - csegmentModel.Length = (lengthOfOldSegment * (brushes[index + 1].OffsetPercent - brushes[index].OffsetPercent) / 100d); - BrushStopModel brushStopModelFirst = new BrushStopModel(brushes[index], csegmentModel); - BrushStopModel brushStopModelSecond = new BrushStopModel(brushes[index + 1], csegmentModel); - csegmentModel.CreateGradientBrushes(brushStopModelFirst, brushStopModelSecond); - - jobModel.Segments.Add(csegmentModel); - } - } - else - { - SegmentModel segmentModel = new SegmentModel(jobModel, segm.Guid) - { - Name = segm.Name, - Length = segm.Length, - SegmentIndex = segm.SegmentIndex, - IsInterSegment = segm.IsInterSegment, - EnableInterSegment = false, - Job = jobModel - }; - foreach (var brushStop in segm.BrushStops) - { - BrushStopModel brushStopModel = new BrushStopModel(brushStop, segmentModel); - segmentModel.BrushStops.Add(brushStopModel); - } - - ArrangeBrushStopsPosition(segmentModel); - jobModel.Segments.Add(segmentModel); - } - } - JobModel = jobModel; - SegmentsCollectionView = CollectionViewSource.GetDefaultView(JobModel.Segments); - SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(SegmentModel.SegmentIndex), ListSortDirection.Ascending)); - - /// + LoadJobModel(); + _job_to_load = null; _current_job_string = Job.ToJobFileWhenLoaded().ToString(); @@ -661,12 +513,7 @@ namespace Tango.PPC.Jobs.ViewModels { Job.JobFineTuningStatus = BL.Enumerations.FineTuningStatuses.Unspecified; } - - //if (_job_to_load_intent == JobNavigationIntent.NewJob) - //{ - // IsJobDetailsExpanded = true; - //} - + LogManager.Log($"Job editing state = '{Job.JobEditingState}'."); if (Job.JobEditingState == BL.Enumerations.EditingStates.SampleDye && Job.JobSampleDyeStatus == BL.Enumerations.SampleDyeStatuses.PendingApproval) @@ -679,9 +526,8 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log("Directing view to display fine tuning region."); View.DisplayFineTuning(); } - - ValidateBrushStops(); - + + IsFullMode = true; DyeCommand.RaiseCanExecuteChanged(); } catch (Exception ex) @@ -698,6 +544,83 @@ namespace Tango.PPC.Jobs.ViewModels } } + private void LoadJobModel() + { + var jobModel = new JobModel(ColorSpaces) + { + Name = Job.Name, + CreationDate = Job.CreationDate, + LengthPercentageFactor = Job.LengthPercentageFactor, + NumberOfUnits = Job.NumberOfUnits, + IsAllSegmentsPerSpool = Job.IsAllSegmentsPerSpool, + Rml = Job.Rml, + ColorSpace = Job.ColorSpace, + SpoolType = Job.SpoolType, + User = Job.User, + Machine = Job.Machine + }; + + foreach (var segm in Job.Segments) + { + if (Job.Version == 1 && segm.BrushStops.Count > 1) + { + int segmentindex = 1; + + var brushes = segm.BrushStops; + Segment currentSegment = segm; + double lengthOfOldSegment = segm.Length; + for (int index = 0; index < (brushes.Count - 1); index++) + { + SegmentModel csegmentModel = new SegmentModel(jobModel, segm.Guid) + { + Name = segm.Name, + Length = segm.Length, + SegmentIndex = segm.SegmentIndex, + IsInterSegment = segm.IsInterSegment, + EnableInterSegment = true, + Job = jobModel + }; + + csegmentModel.SegmentIndex = segmentindex++; + + brushes[index].Segment = currentSegment; + brushes[index + 1].Segment = currentSegment; + csegmentModel.Length = (lengthOfOldSegment * (brushes[index + 1].OffsetPercent - brushes[index].OffsetPercent) / 100d); + BrushStopModel brushStopModelFirst = new BrushStopModel(brushes[index], csegmentModel); + BrushStopModel brushStopModelSecond = new BrushStopModel(brushes[index + 1], csegmentModel); + csegmentModel.CreateGradientBrushes(brushStopModelFirst, brushStopModelSecond); + + jobModel.Segments.Add(csegmentModel); + } + } + else + { + SegmentModel segmentModel = new SegmentModel(jobModel, segm.Guid) + { + Name = segm.Name, + Length = segm.Length, + SegmentIndex = segm.SegmentIndex, + IsInterSegment = segm.IsInterSegment, + EnableInterSegment = false, + Job = jobModel + }; + foreach (var brushStop in segm.BrushStops) + { + BrushStopModel brushStopModel = new BrushStopModel(brushStop, segmentModel); + segmentModel.BrushStops.Add(brushStopModel); + } + + ArrangeBrushStopsPosition(segmentModel); + jobModel.Segments.Add(segmentModel); + } + } + jobModel.Segments.Last().IsLast = true; + JobModel = jobModel; + SegmentsCollectionView = CollectionViewSource.GetDefaultView(JobModel.Segments); + SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(SegmentModel.SegmentIndex), ListSortDirection.Ascending)); + + } + private void Job_NameChanged(object sender, string e) { DyeCommand.RaiseCanExecuteChanged(); @@ -752,9 +675,9 @@ namespace Tango.PPC.Jobs.ViewModels { try { - var test = JobModel != null && !Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent && !x.IsWhite).ToList().Exists(x => x.IsOutOfGamut); + //var test = JobModel != null && !JobModel.Segments.SelectMany(x => x.BrushStops).Where(x => x.Position == BrushStopModel.PositionStatus.FirstColor || x.Position == BrushStopModel.PositionStatus.SecondColor).ToList().Exists(x => x.IsOutOfGamut); //return Job != null && Job.Validate(_db) && !Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent && !x.IsWhite).ToList().Exists(x => x.IsOutOfGamut || (x.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume && x.IsLiquidVolumesOutOfRange)); - return JobModel != null && !JobModel.Segments.SelectMany(x => x.BrushStops).Where(x => x.Position == BrushStopModel.PositionStatus.FirstColor || x.Position == BrushStopModel.PositionStatus.SecondColor).ToList().Exists(x => x.IsOutOfGamut); + return JobModel != null && !JobModel.Segments.ToList().Exists(x => x.BrushStops.Count == 0); } catch (Exception ex) { @@ -775,30 +698,31 @@ namespace Tango.PPC.Jobs.ViewModels vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm); if (!vm.DialogResult) return; - if (vm.IsDuplicate) - { - //Duplicate new job - /* - * int index = Jobs.Max(x => x.JobIndex); - - List<Job> clonedJobs = new List<Job>(); - - foreach (var job in SelectedJobs) - { - var cloned = job.Clone(); - cloned.JobIndex = ++index; - _db.Jobs.Add(cloned); - clonedJobs.Add(cloned); - } - - await _db.SaveChangesAsync(); - * */ - } + Job.Name = vm.JobName; JobModel.Name = vm.JobName; Job.SpoolType = vm.SelectedSpoolType; JobModel.SpoolType = vm.SelectedSpoolType;//update length!!!! SelectedRML = vm.SelectedRML; + + if (vm.IsDuplicate) + { + try + { + await Save(); + //Duplicate new job + var cloned = Job.Clone(); + cloned.JobIndex = (_db.Jobs.Max(x => x.JobIndex) + 1); + _db.Jobs.Add(cloned); + await _db.SaveChangesAsync(); + _job_to_load = cloned; + LoadJob(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error duplicate job."); + } + } } catch (Exception ex) { @@ -919,26 +843,7 @@ namespace Tango.PPC.Jobs.ViewModels return null; } } - - /// <summary> - /// Called when a segment has been dragged and dropped into another segment. - /// </summary> - private void DragAndDropSegment(Segment draggedSegment, Segment droppedSegment) - { - LogManager.Log($"Segment Drag & Drop '{draggedSegment.SegmentIndex}' => '{droppedSegment.SegmentIndex}'."); - - if (draggedSegment.SegmentIndex > droppedSegment.SegmentIndex) - { - draggedSegment.SegmentIndex = droppedSegment.SegmentIndex - 1; - } - else - { - draggedSegment.SegmentIndex = droppedSegment.SegmentIndex + 1; - } - - ArrangeSegmentsIndixes(); - } - + /// <summary> /// Undoes the last color. /// </summary> @@ -994,14 +899,17 @@ namespace Tango.PPC.Jobs.ViewModels JobModel.Segments.Insert(segment.SegmentIndex, newSegmentModel); } ArrangeSegmentsIndixes(); + DyeCommand.RaiseCanExecuteChanged(); } private void ArrangeSegmentsIndixes() { int index = 1; + int count = JobModel.Segments.Count(); foreach (var segment in JobModel.Segments.OrderBy(x => x.SegmentIndex)) { + segment.IsLast = ( index == count)? true : false; segment.SegmentIndex = index++; } @@ -1012,30 +920,6 @@ namespace Tango.PPC.Jobs.ViewModels #region Brush Stops Management - /// <summary> - /// Opens the twine catalog for the specified brush stop. - /// </summary> - /// <param name="stop">The stop.</param> - //private async void OpenCatalog(BrushStop stop) - //{ - // if (stop.ColorCatalog == null) - // { - // await NotificationProvider.ShowInfo("Please select a color catalog first."); - // return; - // } - - // var catalogItem = await NavigationManager.NavigateForResult<JobsV2Module, TwineCatalogView, ColorCatalogsItem, TwineCatalogNavigationObject>(new TwineCatalogNavigationObject() - // { - // SelectedItem = stop.ColorCatalogsItem, - // Catalog = stop.ColorCatalog - // }, true); - - // if (catalogItem != null) - // { - // stop.ColorCatalogsItem = catalogItem; - // } - //} - private void ArrangeBrushStopsIndexes(SegmentModel segment) { for (int i = 0; i < segment.BrushStops.Count; i++) @@ -1055,10 +939,10 @@ namespace Tango.PPC.Jobs.ViewModels segment.BrushStops.ToList().ForEach(x => x.Position = (BrushStopModel.PositionStatus)x.StopIndex); } - private bool ValidateBrushStops() - { - return Job.Segments.SelectMany(x => x.BrushStops).ToList().All(x => x.Validate(_db)); - } + //private bool ValidateBrushStops() + //{ + // return Job.Segments.SelectMany(x => x.BrushStops).ToList().All(x => x.Validate(_db)); + //} /// <summary> /// Click on AddColor button. Add newBrush; @@ -1211,86 +1095,7 @@ namespace Tango.PPC.Jobs.ViewModels #endregion - - #region Fine Tuning - - /// <summary> - /// Synchronizes the fine tune items to brush stops. - /// </summary> - //private async void SyncFineTuneItemsToBrushStops(bool displayBusy = false) - //{ - // try - // { - // if (Job != null) - // { - // if (_jobs_fine_tune_items.ContainsKey(Job.Guid)) - // { - // FineTuneItems = _jobs_fine_tune_items[Job.Guid].ToObservableCollection(); - // } - // else - // { - // if (displayBusy) - // { - // NotificationProvider.SetGlobalBusyMessage("Generating suggestions..."); - // } - - // FineTuneItems.Clear(); - - // foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent).Where(x => x.ColorSpace.Space == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace.Space == BL.Enumerations.ColorSpaces.LAB).DistinctBy(x => x.Color)) - // { - // var conversionoutput = await _converter.ConvertAsync(stop, true); - // FineTuneItem item = new FineTuneItem(conversionoutput); - // item.BrushStop = stop; - // item.BrushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => x.Color == stop.Color).ToList(); - // item.SelectedSuggestion = item.Suggestions.GetCenterSuggestion(); - // item.SelectedChanged += () => StartFineTuningCommand.RaiseCanExecuteChanged(); - // FineTuneItems.Add(item); - // } - - // _jobs_fine_tune_items[Job.Guid] = FineTuneItems.ToList(); - - // NotificationProvider.ReleaseGlobalBusyMessage(); - // } - - // ApprovalFineTuneItems = FineTuneItems.Where(x => x.IsSelected).ToObservableCollection(); - - // StartFineTuningCommand.RaiseCanExecuteChanged(); - // } - // } - // catch (Exception ex) - // { - // LogManager.Log(ex, "Error while trying to synchronize fine tuning items with brush stops."); - // } - // finally - // { - // NotificationProvider.ReleaseGlobalBusyMessage(); - // } - //} - - /// <summary> - /// Starts the fine tuning. - /// </summary> - //private async void StartFineTuning() - //{ - // try - // { - // LogManager.Log("Start fine tunning job command pressed..."); - - // _jobs_fine_tune_items[Job.Guid] = FineTuneItems.ToList(); - - // await PrintingManager.PrintFineTuning(Job, _db, FineTuneItems); - - // await NavigationManager.NavigateTo<JobsV2Module>(nameof(JobProgressView)); - // } - // catch (Exception ex) - // { - // LogManager.Log(ex, "Error executing fine tuning job."); - // await NotificationProvider.ShowError(ex.Message); - // } - //} - - #endregion - + #region Lubrication Level private void GetLubricationLevel() @@ -1538,6 +1343,8 @@ namespace Tango.PPC.Jobs.ViewModels #endregion + #region Save from models to db + private async Task Save() { if (JobModel == null) @@ -1546,6 +1353,7 @@ namespace Tango.PPC.Jobs.ViewModels Job.ColorSpace = colorSpaces.FirstOrDefault(); Job.Version = 2; + Job.NumberOfUnits = JobModel.NumberOfUnits; var oldSegments = Job.Segments.ToList(); @@ -1590,9 +1398,9 @@ namespace Tango.PPC.Jobs.ViewModels dbStop.Magenta = stop.Magenta; dbStop.Yellow = stop.Yellow; dbStop.Black = stop.Black; - dbStop.BestMatchR = stop.DisplayedColor.R; - dbStop.BestMatchG = stop.DisplayedColor.G; - dbStop.BestMatchB = stop.DisplayedColor.B; + dbStop.BestMatchR = stop.BestMatchColor.R; + dbStop.BestMatchG = stop.BestMatchColor.G; + dbStop.BestMatchB = stop.BestMatchColor.B; dbStop.OffsetPercent = stop.OffsetPercent; dbStop.StopIndex = stop.StopIndex; @@ -1616,5 +1424,7 @@ namespace Tango.PPC.Jobs.ViewModels await _db.SaveChangesAsync(); } + + #endregion } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs index 1f7042b57..821b37ebd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs @@ -423,9 +423,10 @@ namespace Tango.PPC.Jobs.ViewModels await Task.Delay(200); } JobCreationViewVM vm = new JobCreationViewVM( _spoolTypes.ToList(), _rmls.ToList(), 3, false ); - - string selectedRmlGuid = (Settings.DefaultRmlGuid != null && _rmls.Select(x => x.Guid).Contains(Settings.DefaultRmlGuid)) ? Settings.DefaultRmlGuid : _rmls.FirstOrDefault().Guid; - string selectedSpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; ; + var selectedRmlGuid = Settings.DefaultRmlGuid; + var selectedSpoolTypeGuid = Settings.DefaultSpoolTypeGuid; + vm.SelectedRML = _rmls.FirstOrDefault(x => x.Guid == Settings.DefaultRmlGuid); + vm.SelectedSpoolType = _spoolTypes.FirstOrDefault( x=>x.Guid == Settings.DefaultSpoolTypeGuid ); if (twnFile == null) { vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml index 6d867c2b5..47ae999d8 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml @@ -27,6 +27,7 @@ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"/> <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter"/> + <converters:TimeSpanToMinutesConverter x:Key="TimeSpanToMinutesConverter"/> <BitmapImage x:Key="Image_Out_Of_Gamut" UriSource="../Images/JobView/error.png" /> <BitmapImage x:Key="Image_Replace_Color" UriSource="../Images/JobView/replace-color.png" /> @@ -74,19 +75,19 @@ <StackPanel Orientation="Horizontal"> <TextBlock Text="R" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Red}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchColor.R}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> </Border> </StackPanel> <StackPanel Orientation="Horizontal" Margin="4 0 0 0"> <TextBlock Text="G" FontSize="{StaticResource TangoSmallFontSize}" VerticalAlignment="Center"/> <Border Margin="10 0 0 0" Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="42"> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Green}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchColor.G}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> </Border> </StackPanel> <StackPanel Orientation="Horizontal" Margin="4 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="42"> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding Blue}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchColor.B}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> </Border> </StackPanel> </UniformGrid> @@ -126,19 +127,19 @@ <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="42"> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding L, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchL, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> </Border> </StackPanel> <StackPanel Orientation="Horizontal" Margin="10 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="42"> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding A, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchA, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></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="42"> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding B, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Text="{Binding BestMatchB, StringFormat=0.0}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> </Border> </StackPanel> </UniformGrid> @@ -224,13 +225,13 @@ </DockPanel> </Border> </Border> - <Canvas Grid.Row="1" x:Name="alert_canvas_segment" Width="30" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="-40 -10 0 0" > + <!--<Canvas Grid.Row="1" x:Name="alert_canvas_segment" Width="30" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="-40 -10 0 0" > <touch:TouchButton Height="22" Width="24" Canvas.Left="0" Canvas.Top="0" x:Name="addmyColors" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Visibility="{Binding HasOutOfGamutBrush, Converter={StaticResource BooleanToVisibilityConverter}}"> <Border BorderThickness="0" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Background="Transparent" HorizontalAlignment="Left"> <Image Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" Source="../Images/JobView/Exclamation_black.png"/> </Border> </touch:TouchButton> - </Canvas> + </Canvas>--> <Grid Grid.Row="2" x:Name="sliderThreeThumbs" Visibility="{Binding IsGradient, Converter={StaticResource BooleanToVisibilityConverter}}" > <touch:TouchSliderThreeThumbs Height="40" MinimumMiddleRange="5.0" Length="{Binding Length}" LowerValue="{Binding LeftOffset, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" MiddleValue="{Binding MiddleOffset, Mode=TwoWay}" UpperValue="{Binding RightOffset, Mode=TwoWay}"/> @@ -283,19 +284,19 @@ </Setter.Value> </Setter> <Style.Triggers> - <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}}" Value="HSB"> + <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}, Mode=OneWay}" Value="HSB"> <Setter Property="ContentTemplate" Value="{StaticResource HSB_Template}" /> </DataTrigger> - <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}}" Value="RGB"> + <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}, Mode=TwoWay}" Value="RGB"> <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> </DataTrigger> - <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}}" Value="Volume"> + <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}, Mode=OneWay}" Value="Volume"> <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> </DataTrigger> - <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}}" Value="LAB"> + <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}, Mode=OneWay}" Value="LAB"> <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> </DataTrigger> - <DataTrigger Binding="{Binding FirstBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}}" Value="Catalog"> + <DataTrigger Binding="{Binding SecondBrushStop.ColorSpace, Converter={StaticResource EnumToDescriptionConverter}, Mode=OneWay}" Value="Catalog"> <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" /> </DataTrigger> </Style.Triggers> @@ -334,7 +335,7 @@ </Border> <DockPanel Margin="0 20 0 0" Grid.Row="1"> - <Grid Visibility="Collapsed"> + <Grid DockPanel.Dock="Right" Visibility="{Binding IsLast, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <touch:TouchButton x:Name="deletegap" DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding DeleteGapCommand}" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Visibility="{Binding EnableInterSegment, Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock Margin="10 2 0 0" FontSize="{StaticResource TangoButtonFontSize}" VerticalAlignment="Center">Delete Gap</TextBlock> </touch:TouchButton> @@ -619,25 +620,20 @@ <!--<touch:TouchDropShadowBorder Grid.Row="3" Margin="10 0 10 15" CornerRadius="0" BorderThickness="0" Padding="0" >--> <Border Grid.Row="3" Margin="10 0 10 15" BorderThickness="0"> - <touch:TouchExpander x:Name="summaryExpander" IsExpanded="True" Grid.Row="3" Margin="15 0 15 0 " FontSize="{StaticResource TangoTitleFontSize}" BorderThickness="0" Style="{StaticResource TouchRoundedExpander}"> + <touch:TouchExpander x:Name="summaryExpander" IsExpanded="{Binding IsSummaryOpened, Mode=TwoWay}" Grid.Row="3" Margin="15 0 15 0 " FontSize="{StaticResource TangoTitleFontSize}" BorderThickness="0" Style="{StaticResource TouchRoundedExpander}"> <touch:TouchExpander.Header> <DockPanel > - <touch:TouchButton DockPanel.Dock="Right" Margin="0 0 20 0" HorizontalAlignment="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding RepeatUnitsCommand}" > - <Border CornerRadius="20" Width="130" Height="40" BorderThickness="1" BorderBrush="{StaticResource TangoDarkForegroundBrush}"> - <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Foreground="{StaticResource TangoDarkForegroundBrush}">Repeat Job</TextBlock> - </Border> - <touch:TouchButton.Style> - <Style TargetType="{x:Type touch:TouchButton}"> - <Setter Property="Visibility" Value="Collapsed"/> - <Style.Triggers> - <DataTrigger Binding="{Binding Path=IsExpanded ,RelativeSource={RelativeSource Mode =FindAncestor,AncestorType={x:Type touch:TouchExpander}}}" Value="True"> - <Setter Property="Visibility" Value="Visible"/> - <Setter Property="Background" Value="red"/> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchButton.Style> - </touch:TouchButton> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="0 0 20 0" Visibility="{Binding IsSummaryOpened, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}"> + <touch:TouchButton HorizontalAlignment="Right" VerticalAlignment="Center" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding RepeatUnitsCommand}" > + <Border CornerRadius="20" Width="130" Height="40" BorderThickness="1" BorderBrush="{StaticResource TangoDarkForegroundBrush}"> + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" Foreground="{StaticResource TangoDarkForegroundBrush}">Repeat All</TextBlock> + </Border> + </touch:TouchButton> + <TextBlock Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" FontWeight="SemiBold" Foreground="{StaticResource TangoPrimaryAccentBrush}"> + <Run Text="x"></Run> + <Run Text="{Binding JobModel.NumberOfUnits,Mode=OneWay}"/> + </TextBlock> + </StackPanel> <StackPanel DockPanel.Dock="Left" Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> <Image Source="../Images/JobView/job-summary.png" Width="39" /> <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Summary</TextBlock> @@ -684,13 +680,16 @@ </StackPanel> <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 -20 5 0"> - <TextBlock Margin="0 3 0 0" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Bottom"> - <Run Text="Factor: +"></Run> + <TextBlock Margin="0 3 0 0" VerticalAlignment="Bottom"> + <!--<Run Text="Factor: +"></Run>--> + <Run Text="Duration: "></Run> + <Run Text="{Binding JobModel.GetEstimatedDuration, Converter={StaticResource TimeSpanToMinutesConverter},FallbackValue=0, Mode=OneWay,StringFormat=0.0}"></Run> + <Run Text="min"></Run> </TextBlock> - <touch:TouchNumericTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="5 0 0 0" Width="50" HorizontalContentAlignment="Center" Maximum="100" Minimum="0" Value="{Binding JobModel.LengthPercentageFactor}" KeyboardContainer="{Binding ElementName=Container}" StringFormat="0" FocusSelectionMode="SelectAll" /> + <!--<touch:TouchNumericTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="5 0 0 0" Width="50" HorizontalContentAlignment="Center" Maximum="100" Minimum="0" Value="{Binding JobModel.LengthPercentageFactor}" KeyboardContainer="{Binding ElementName=Container}" StringFormat="0" FocusSelectionMode="SelectAll" /> - <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayTextBrush}">%</TextBlock> + <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayTextBrush}">%</TextBlock>--> </StackPanel> </DockPanel> </StackPanel> |
