diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-03-17 17:13:19 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-03-17 17:13:19 +0200 |
| commit | e22c6c134455f7b2423215f7d7c6a0e707c65c7c (patch) | |
| tree | 4e07f516a679965defe7b7178b579d8b3e33c7dd /Software/Visual_Studio/PPC/Modules | |
| parent | cb872d2cbcc20fe456b4e2ca8633c803bd104de7 (diff) | |
| parent | ad89c52f42dd38dcdc332d2e1059b49858e0b9dd (diff) | |
| download | Tango-e22c6c134455f7b2423215f7d7c6a0e707c65c7c.tar.gz Tango-e22c6c134455f7b2423215f7d7c6a0e707c65c7c.zip | |
Merged Buzzer Branch To Software !!!
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
13 files changed, 488 insertions, 201 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml index 68b0a839c..85d35cf4f 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 @@ -617,7 +617,7 @@ <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding SelectedBrushStop.LiquidVolumes}" IsTabStop="False" MinWidth="200"> <ItemsControl.ItemTemplate> <DataTemplate DataType="{x:Type models:LiquidVolumeModel}"> - <touch:TouchColorPickerControl Margin=" 0 10 0 0" MinWidth="200" MinValue="0" IsTabStop="False" + <touch:TouchColorPickerControl Name="CMYK" Margin=" 0 10 0 0" MinWidth="200" MinValue="0" IsTabStop="False" ColorPickerText="{Binding IdsPack.LiquidType.Name}" AutoThumbColor="True" ThumbHeightInside="28" 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 5b750189f..bc91c10c1 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 @@ -46,7 +46,7 @@ namespace Tango.PPC.Jobs.Dialogs [Description("Catalog")] Catalog = 2 } - + public class DialogObject { @@ -284,7 +284,9 @@ namespace Tango.PPC.Jobs.Dialogs public ObservableCollection<ColorLibrary> Libraries { get { return _libraries; } - set { _libraries = value; + set + { + _libraries = value; RaisePropertyChangedAuto(); LoadLibraryDictionary(); } @@ -302,8 +304,9 @@ namespace Tango.PPC.Jobs.Dialogs public ColorLibrary SelectedColorLibraryMyColor { get { return _selectedColorLibraryMyColor; } - set { - if(_selectedColorLibraryMyColor != null) + set + { + if (_selectedColorLibraryMyColor != null) _selectedColorLibraryMyColor.IsSelected = false; _selectedColorLibraryMyColor = value; @@ -381,7 +384,8 @@ namespace Tango.PPC.Jobs.Dialogs public bool IsSelectedColorInLibrary { get { return _isSelectedColorInLibrary; } - set { + set + { _isSelectedColorInLibrary = value; RaisePropertyChangedAuto(); } @@ -402,8 +406,11 @@ namespace Tango.PPC.Jobs.Dialogs public bool IsOpenVectorFineTuningDialog { get { return _isOpenVectorFineTuningDialog; } - set { _isOpenVectorFineTuningDialog = value; - RaisePropertyChangedAuto();} + set + { + _isOpenVectorFineTuningDialog = value; + RaisePropertyChangedAuto(); + } } private VectorFineTuningDialogVM _vectorFineTuningDialogVM; @@ -434,8 +441,11 @@ namespace Tango.PPC.Jobs.Dialogs public String MyColorName { get { return _myColorName; } - set { _myColorName = value; - RaisePropertyChangedAuto();} + set + { + _myColorName = value; + RaisePropertyChangedAuto(); + } } private String _editColorButtonName; @@ -443,8 +453,11 @@ namespace Tango.PPC.Jobs.Dialogs public String EditColorButtonName { get { return _editColorButtonName; } - set { _editColorButtonName = value; - RaisePropertyChangedAuto();} + set + { + _editColorButtonName = value; + RaisePropertyChangedAuto(); + } } private PPCSettings _settings; @@ -500,7 +513,7 @@ namespace Tango.PPC.Jobs.Dialogs Libraries = MyColorsEngine.Default.GetAll().ToObservableCollection(); var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); InitColorTab(settings.DefaultTabColorSpace); - + _volumeConversionTimer = new ActionTimer(TimeSpan.FromMilliseconds(50)); _converter = new DefaultColorConverter(); CollectionFilter = new DefaultCollectionFilter(); @@ -516,7 +529,7 @@ namespace Tango.PPC.Jobs.Dialogs } else { - if(colorCatalogsItem.Name.ToLower().StartsWith(Filter.ToLower())) + if (colorCatalogsItem.Name.ToLower().StartsWith(Filter.ToLower())) { SelectedBrushStop.ColorCatalogsItem = colorCatalogsItem; } @@ -532,12 +545,12 @@ namespace Tango.PPC.Jobs.Dialogs OpenCloseAddMyColorDialogCommand = new RelayCommand(OpenCloseAddMyColorDialog); SaveMyColorsCommand = new RelayCommand(SaveMyColors); OpenMyColorsCommand = new RelayCommand(() => { MyColorsMode = true; }); - CloseMyColorsCommand = new RelayCommand(() => { MyColorsMode = false; SearchColorText = "";}); + CloseMyColorsCommand = new RelayCommand(() => { MyColorsMode = false; SearchColorText = ""; }); SelectColorCommand = new RelayCommand<FavoriteColor>(SelectColor); AddGroupCommand = new RelayCommand(AddGroup); AddNewGroupCommand = new RelayCommand<string>(AddNewGroup); AddNewGroupAndColorCommand = new RelayCommand<string>(AddNewGroupAndColor); - + SelectLibraryCommand = new RelayCommand<ColorLibrary>(SelectLibrary); DeleteGroupCommand = new RelayCommand<ColorLibrary>(DeleteGroup); EditColorsLibraryCommand = new RelayCommand<ColorLibrary>(EditColorsLibrary); @@ -560,36 +573,36 @@ namespace Tango.PPC.Jobs.Dialogs public override void OnShow() { Catalogs = DialogEditObject.Catalogs; - + Libraries.CollectionChanged -= Libraries_CollectionChanged; Libraries.CollectionChanged += Libraries_CollectionChanged; ColorLibrariesView = CollectionViewSource.GetDefaultView(Libraries); ColorLibrariesView.SortDescriptions.Add(new SortDescription(nameof(ColorLibrary.Name), ListSortDirection.Ascending)); - ColorLibrariesView.Filter = new Predicate<object> (item => - { - var ColorLibraryItem = item as ColorLibrary; + ColorLibrariesView.Filter = new Predicate<object>(item => + { + var ColorLibraryItem = item as ColorLibrary; - if (ColorLibraryItem != null) - { - if (String.IsNullOrEmpty(SearchColorText)) - { - ColorLibraryItem.ColorList.ToList().ForEach(x => x.IsSelected = false); - return true; - } - else - { - ColorLibraryItem.ColorList.ToList().ForEach( x=> x.IsSelected = x.Name.ToLower().StartsWith(SearchColorText.ToLower())); - - if(ColorLibraryItem.ColorList.ToList().Any(x=>x.Name.ToLower().StartsWith(SearchColorText.ToLower()))) - return true; - return (ColorLibraryItem.Name.ToLower().StartsWith(SearchColorText.ToLower())); - } - } - else - { - return true; - } - }); + if (ColorLibraryItem != null) + { + if (String.IsNullOrEmpty(SearchColorText)) + { + ColorLibraryItem.ColorList.ToList().ForEach(x => x.IsSelected = false); + return true; + } + else + { + ColorLibraryItem.ColorList.ToList().ForEach(x => x.IsSelected = x.Name.ToLower().StartsWith(SearchColorText.ToLower())); + + if (ColorLibraryItem.ColorList.ToList().Any(x => x.Name.ToLower().StartsWith(SearchColorText.ToLower()))) + return true; + return (ColorLibraryItem.Name.ToLower().StartsWith(SearchColorText.ToLower())); + } + } + else + { + return true; + } + }); base.OnShow(); SegmentIndex = DialogEditObject.SelectedSegment.SegmentIndex; @@ -602,7 +615,7 @@ namespace Tango.PPC.Jobs.Dialogs SelectedBrushStop.Guid = InitialBrushStop.Guid; SelectedBrushStop.ColorSpace = InitialBrushStop.ColorSpace; if (SelectedBrushStop.ColorSpace == ColorSpaces.Volume) - { + { SelectedColorTab = ColorTab.Volume; SelectedBrushStop.SaveColorBeforeChanges(); } @@ -650,8 +663,8 @@ namespace Tango.PPC.Jobs.Dialogs CheckIsSelectedColorInLibrary(); SelectedBrushStop.ConvertColor();//test OOG RaisePropertyChanged(nameof(FineTuningEnabled)); - } - + } + private void OnSelectedtabChanged() { switch (SelectedColorTab) @@ -742,9 +755,9 @@ namespace Tango.PPC.Jobs.Dialogs case ColorSpaces.CMYK: SelectedColorTab = ColorTab.Volume; break; - //case ColorSpaces.HSB: - // SelectedColorTab = ColorTab.HSB; - // break; + //case ColorSpaces.HSB: + // SelectedColorTab = ColorTab.HSB; + // break; } } } @@ -771,19 +784,19 @@ namespace Tango.PPC.Jobs.Dialogs private double GetMaxCMYKValueOrDefault(LiquidTypes type) { - if (SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null + if (SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null && SelectedBrushStop.SegmentModel.Job != null && SelectedBrushStop.SegmentModel.Job.Rml != null && SelectedBrushStop.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Count > 0) - { + { var liquidTypesRml = SelectedBrushStop.SegmentModel.Job.Rml.LiquidTypesRmls.FirstOrDefault(x => x.LiquidType.Type == type); - var processParametersTable = SelectedBrushStop.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Single().ProcessParametersTables.OrderBy(y=>y.TableIndex).LastOrDefault(); - + var processParametersTable = SelectedBrushStop.SegmentModel.Job.Rml.ProcessParametersTablesGroups.Single().ProcessParametersTables.OrderBy(y => y.TableIndex).LastOrDefault(); + if (liquidTypesRml != null && processParametersTable != null && liquidTypesRml.MaxNlPerCm != 0) { - //var test = (processParametersTable.MaxInkUptake /( liquidTypesRml.MaxNlPerCm)* 100); - + //var test = (processParametersTable.MaxInkUptake /( liquidTypesRml.MaxNlPerCm)* 100); + return (processParametersTable.MaxInkUptake / (liquidTypesRml.MaxNlPerCm) * 100); } @@ -801,16 +814,16 @@ namespace Tango.PPC.Jobs.Dialogs OKCommand.RaiseCanExecuteChanged(); } - + protected override async void Accept() { if (SelectedBrushStop.IsOutOfGamut) { - if( false == await NotificationProvider.ShowQuestion("The color you chose is not supported, by pressing OK the system will enter the best-match color.")) + if (false == await NotificationProvider.ShowQuestion("The color you chose is not supported, by pressing OK the system will enter the best-match color.")) { - return; + return; } - // if (SelectedBrushStop.ColorSpace == ColorSpaces.LAB) + // if (SelectedBrushStop.ColorSpace == ColorSpaces.LAB) { var testColor = TrialsLogEngine.Default.GetByBrushStopGuid(SelectedBrushStop.Guid); if (testColor != null && testColor.TrialslogList.Count > 0) @@ -819,18 +832,18 @@ namespace Tango.PPC.Jobs.Dialogs } } } - + _selectedBrushStop.LiquidVolumesOutOfRangeChanged -= OnLiquidVolumesOutOfRangeChanged; _selectedBrushStop.UpdateColorOnAccept(); base.Accept(); } protected override void Cancel() { - if(IsOpenVectorFineTuningDialog) + if (IsOpenVectorFineTuningDialog) return; - + var TestColor = TrialsLogEngine.Default.GetByBrushStopGuid(_selectedBrushStop.Guid); - if (TestColor != null && InitialBrushStop != null && + if (TestColor != null && InitialBrushStop != null && ((InitialBrushStop.ColorSpace == ColorSpaces.LAB && (TestColor.OpenedFromCatalog != false || TestColor.OpenedFromCMYK != false)) || (InitialBrushStop.ColorSpace == ColorSpaces.Volume && TestColor.OpenedFromCMYK != true) || (InitialBrushStop.ColorSpace == ColorSpaces.Catalog && TestColor.OpenedFromCatalog != true))) @@ -857,13 +870,14 @@ namespace Tango.PPC.Jobs.Dialogs private void OpenCloseAddMyColorDialog() { - if(IsBusy) + if (IsBusy) return; IsBusy = true; - - if(SaveMyColorMode == false && IsSelectedColorInLibrary) + + if (SaveMyColorMode == false && IsSelectedColorInLibrary) { - try { + try + { List<FavoriteColor> colors; if (_colorSpaceToFavoriteColorDictionary != null && SelectedBrushStop != null && _colorSpaceToFavoriteColorDictionary.TryGetValue(SelectedBrushStop.ColorSpace, out colors) && colors != null) { @@ -873,19 +887,19 @@ namespace Tango.PPC.Jobs.Dialogs MyColorName = favoriteColor.Name; foreach (var library in Libraries) { - if(library.IsColorExist(favoriteColor)) + if (library.IsColorExist(favoriteColor)) { library.RemoveFromLibrary(favoriteColor); LoadLibraryDictionary(); IsSelectedColorInLibrary = false; break; - } - } + } + } } - + } } - catch( Exception ex) + catch (Exception ex) { LogManager.Log(ex, "An error occurred while trying to delete My Colors."); } @@ -899,10 +913,10 @@ namespace Tango.PPC.Jobs.Dialogs SaveMyColorMode = !SaveMyColorMode; //Init MyColorName on open the dialog String colorName = "MyColor"; - if ( SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null && SelectedBrushStop.SegmentModel.Job != null ) + if (SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null && SelectedBrushStop.SegmentModel.Job != null) { colorName = SelectedBrushStop.SegmentModel.Job.Name; - if(colorName.Length > 40) + if (colorName.Length > 40) colorName = colorName.Substring(0, 40); } MyColorName = colorName; @@ -947,7 +961,7 @@ namespace Tango.PPC.Jobs.Dialogs { NewGroupName = "Library" + (Libraries.Count() + 1); AddGroupMode = false; - SaveMyColorMode = false; + SaveMyColorMode = false; } /// <summary> /// Adds the new group in Save My Colors list. @@ -955,9 +969,9 @@ namespace Tango.PPC.Jobs.Dialogs /// <param name="name">The name of the new Library.</param> private void AddNewGroup(string name) { - if (!String.IsNullOrEmpty(name) && false == Libraries.Any(x=>x.Name.ToUpper() == name.ToUpper())) + if (!String.IsNullOrEmpty(name) && false == Libraries.Any(x => x.Name.ToUpper() == name.ToUpper())) { - Libraries.Insert(0 ,MyColorsEngine.Default.AddLibrary(name)); + Libraries.Insert(0, MyColorsEngine.Default.AddLibrary(name)); } else { @@ -985,13 +999,13 @@ namespace Tango.PPC.Jobs.Dialogs } SelectedColorLibrary = library; - // AddColorToLibrary(library); + // AddColorToLibrary(library); } NewGroupName = "Library" + (Libraries.Count() + 1); //SaveMyColorMode = false; //AddGroupMode = false; } - + /// <summary> /// Adds the selected color to library in Save my Colors. /// </summary> @@ -1004,10 +1018,15 @@ namespace Tango.PPC.Jobs.Dialogs newcolor.Red = SelectedBrushStop.Red; newcolor.Green = SelectedBrushStop.Green; newcolor.Blue = SelectedBrushStop.Blue; - newcolor.Cyan = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume; - newcolor.Magenta = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume; - newcolor.Yellow = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume; - newcolor.Black = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume; + + foreach (var liquidVolume in SelectedBrushStop.LiquidVolumes.Where(x => x.IdsPack.LiquidType.AvailableForStandardUser)) + { + newcolor.SetVolume(liquidVolume.IdsPack.LiquidType.Type, liquidVolume.Volume); + } + //newcolor.Cyan = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume; + //newcolor.Magenta = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume; + //newcolor.Yellow = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume; + //newcolor.Black = SelectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume; newcolor.L = SelectedBrushStop.L; newcolor.A = SelectedBrushStop.A; newcolor.B = SelectedBrushStop.B; @@ -1046,7 +1065,7 @@ namespace Tango.PPC.Jobs.Dialogs { SelectedColor = favoriteColor; MyColorsMode = false; - + //test RML? SelectedBrushStop.SetMyColor(favoriteColor); RaisePropertyChanged(nameof(SelectedBrushStop)); @@ -1060,7 +1079,7 @@ namespace Tango.PPC.Jobs.Dialogs case ColorSpaces.Volume: { SelectedColorTab = ColorTab.Volume; - if(favoriteColor.RmlGuid != SelectedBrushStop.SegmentModel.Job.Rml.Guid) + if (favoriteColor.RmlGuid != SelectedBrushStop.SegmentModel.Job.Rml.Guid) NotificationProvider.ShowInfo("The color may be different from the selected."); } break; @@ -1158,7 +1177,7 @@ namespace Tango.PPC.Jobs.Dialogs } } - private async void UploadFile() + private async void UploadFile() { if (Settings.StorageRootPath == null || false == Directory.Exists(Settings.StorageRootPath)) { @@ -1225,16 +1244,16 @@ namespace Tango.PPC.Jobs.Dialogs private void LoadLibraryDictionary() { _colorSpaceToFavoriteColorDictionary = new Dictionary<ColorSpaces, List<FavoriteColor>>(); - foreach( var library in Libraries) + foreach (var library in Libraries) { - foreach( var color in library.ColorList) + foreach (var color in library.ColorList) { List<FavoriteColor> colors; - if(!_colorSpaceToFavoriteColorDictionary.TryGetValue( color.ColorSpace, out colors) || colors == null) + if (!_colorSpaceToFavoriteColorDictionary.TryGetValue(color.ColorSpace, out colors) || colors == null) { colors = new List<FavoriteColor>(); colors.Add(color); - _colorSpaceToFavoriteColorDictionary[color.ColorSpace] = colors; + _colorSpaceToFavoriteColorDictionary[color.ColorSpace] = colors; } else { @@ -1250,7 +1269,7 @@ namespace Tango.PPC.Jobs.Dialogs switch (e.Action) { case NotifyCollectionChangedAction.Add: - var libraries= e.NewItems.Cast<ColorLibrary>().ToList(); + var libraries = e.NewItems.Cast<ColorLibrary>().ToList(); for (int i = 0; i < libraries.Count; i++) { Dictionary<ColorSpaces, List<FavoriteColor>> groups = libraries[i].ColorList.GroupBy(r => r.ColorSpace).ToDictionary(g => g.Key, g => g.ToList()); @@ -1299,8 +1318,8 @@ namespace Tango.PPC.Jobs.Dialogs SelectedBrushStop.SaveColorBeforeChanges(); - VectorFineTuningDialogVM.Init( SelectedBrushStop, SelectedBrushStop.ColorSpace);//SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B); //, SelectedBrushStop.Color); - + VectorFineTuningDialogVM.Init(SelectedBrushStop, SelectedBrushStop.ColorSpace);//SelectedBrushStop.L, SelectedBrushStop.A, SelectedBrushStop.B); //, SelectedBrushStop.Color); + IsOpenVectorFineTuningDialog = true; VectorFineTuningDialogVM.Canceled -= VectorFineTuningDialogCanceled; @@ -1325,7 +1344,7 @@ namespace Tango.PPC.Jobs.Dialogs VectorFineTuningDialogVM.Accepted -= VectorFineTuningDialogAccepted; IsOpenVectorFineTuningDialog = false; - if(VectorFineTuningDialogVM.SelectedLog != null ) + if (VectorFineTuningDialogVM.SelectedLog != null) { _selectedBrushStop.PreventPropertyUpdate = true; @@ -1336,12 +1355,12 @@ namespace Tango.PPC.Jobs.Dialogs _selectedBrushStop.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = VectorFineTuningDialogVM.SelectedLog.K; _selectedBrushStop.L = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionL; - _selectedBrushStop.A = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionA; - _selectedBrushStop.B = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionB; + _selectedBrushStop.A = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionA; + _selectedBrushStop.B = (double)VectorFineTuningDialogVM.SelectedLog.SuggestionB; _selectedBrushStop.ColorSpace = ColorSpaces.Volume; _selectedBrushStop.PreventPropertyUpdate = false; - + //if not tested // _selectedBrushStop.PreventPropertyUpdate = false; _selectedBrushStop.ConvertColor(); @@ -1361,7 +1380,7 @@ namespace Tango.PPC.Jobs.Dialogs { if (true == await NotificationProvider.ShowQuestion("The color correction is in progress, the trials data will be reset. Are you sure?")) { - TrialsLogEngine.Default.Delete( testColor); + TrialsLogEngine.Default.Delete(testColor); return true; } else @@ -1377,8 +1396,8 @@ namespace Tango.PPC.Jobs.Dialogs public async Task<bool> NotifyAboutTrialsDataColorsSpace() { var testColor = TrialsLogEngine.Default.GetByBrushStopGuid(SelectedBrushStop.Guid); - if (testColor != null && testColor.TrialslogList.Count > 0 && - ((testColor.OpenedFromCatalog && SelectedColorTab != ColorTab.Catalog) + if (testColor != null && testColor.TrialslogList.Count > 0 && + ((testColor.OpenedFromCatalog && SelectedColorTab != ColorTab.Catalog) || (testColor.OpenedFromCMYK && SelectedColorTab != ColorTab.Volume) || (testColor.OpenedFromCatalog == false && testColor.OpenedFromCMYK == false && SelectedColorTab != ColorTab.CIELab))) { @@ -1392,7 +1411,7 @@ namespace Tango.PPC.Jobs.Dialogs await NotificationProvider.ShowInfo("The color will not be changed."); return false; } - + } return true; } 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 0224ab766..7ebde1913 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 @@ -138,7 +138,7 @@ </DockPanel > <DockPanel Visibility="{Binding ShowDuplicate,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 50 0 0" HorizontalAlignment="Stretch"> - <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" FontSize="{StaticResource TangoDialogFontSize}" Width="155" > + <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" FontSize="{StaticResource TangoDialogFontSize}" Width="160" > <Run Text="Use Flat Spool"></Run> </TextBlock> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs index 183ce0185..a597a4c50 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs @@ -1684,10 +1684,10 @@ namespace Tango.PPC.Jobs.Dialogs private void UpdateOnEndJob() { ActiveLogModel.IsTested = true; - Cyan = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = Cyan; - Magenta = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = Magenta; - Yellow = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = Yellow; - Black = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = Black; + Cyan = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume; + Magenta = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume; + Yellow = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume; + Black = BrushStopModel.LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume; if (ActiveLogModel != null && TrialsLogitems.Count <= 10) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index 4fa45744b..5634f783e 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 @@ -646,16 +646,18 @@ namespace Tango.PPC.Jobs.Models #region constructors - public BrushStopModel() + public BrushStopModel(BrushStop stop) { Guid = System.Guid.NewGuid().ToString(); TangoIOC.Default.Inject(this); + BrushStop = stop; + LiquidVolumes = new LiquidVolumesCollection(); } - public BrushStopModel(SegmentModel segmentModel) : this() + public BrushStopModel(SegmentModel segmentModel, BrushStop stop) : this(stop) { SegmentModel = segmentModel; @@ -675,7 +677,7 @@ namespace Tango.PPC.Jobs.Models RequiredMaxLiquidTest = false; } - public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel, int version) : this() + public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel, int version) : this(brushStop) { SegmentModel = segmentModel; BrushStop = brushStop; @@ -868,7 +870,7 @@ namespace Tango.PPC.Jobs.Models public BrushStopModel Clone() { - var cloned = new BrushStopModel(SegmentModel); + var cloned = new BrushStopModel(SegmentModel, BrushStop); cloned.StopIndex = StopIndex; cloned.PreventPropertyUpdate = true; cloned.Red = Red; @@ -885,7 +887,7 @@ namespace Tango.PPC.Jobs.Models cloned.Saturation = Saturation; cloned.Brightness = Brightness; cloned.Color = Color; - + cloned.BrushStop = BrushStop; cloned.ColorCatalogsItem = ColorCatalogsItem; cloned.ColorSpace = ColorSpace; cloned.BestMatchColor = BestMatchColor; @@ -926,11 +928,19 @@ namespace Tango.PPC.Jobs.Models PreventPropertyUpdate = true; - LiquidVolumes.ResetVolume(); - LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = favoriteColor.Cyan; - LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = favoriteColor.Magenta; - LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = favoriteColor.Yellow; - LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = favoriteColor.Black; + //LiquidVolumes.ResetVolume(); + + foreach (var liquidVolume in LiquidVolumes.Where(x => x.IdsPack.LiquidType.AvailableForStandardUser)) + { + liquidVolume.Volume = favoriteColor.GetVolume(liquidVolume.IdsPack.LiquidType.Type); + } + + RaisePropertyChanged(nameof(LiquidVolumes)); + + //LiquidVolumes.GetLiquidVolume(LiquidTypes.Cyan).Volume = favoriteColor.Cyan; + //LiquidVolumes.GetLiquidVolume(LiquidTypes.Magenta).Volume = favoriteColor.Magenta; + //LiquidVolumes.GetLiquidVolume(LiquidTypes.Yellow).Volume = favoriteColor.Yellow; + //LiquidVolumes.GetLiquidVolume(LiquidTypes.Black).Volume = favoriteColor.Black; Red = favoriteColor.Red; @@ -962,6 +972,7 @@ namespace Tango.PPC.Jobs.Models Configuration configuration = SegmentModel.Job.Machine.Configuration; Rml rml = SegmentModel.Job.Rml; + s.Segment = BrushStop.Segment; s.SetLiquidVolumes(configuration, rml, rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault()); @@ -1373,7 +1384,7 @@ namespace Tango.PPC.Jobs.Models foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) { - LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType).SetVolumeSilent(outputLiquid.Volume); + LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType)?.SetVolumeSilent(outputLiquid.Volume); } IsOutOfGamut = false; @@ -1452,7 +1463,7 @@ namespace Tango.PPC.Jobs.Models foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids) { - LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType).SetVolumeSilent(outputLiquid.Volume); + LiquidVolumes.GetLiquidVolume(outputLiquid.LiquidType)?.SetVolumeSilent(outputLiquid.Volume); } IsOutOfGamut = output.OutOfGamut; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs index 1d7b7c7c2..c72e7c530 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs @@ -70,6 +70,8 @@ namespace Tango.PPC.Jobs.Models public int BestMatchB { get; set; } + public List<FavoriteColorLiquidVolume> LiquidVolumes { get; set; } + [BsonIgnore] public Color Color { @@ -102,8 +104,11 @@ namespace Tango.PPC.Jobs.Models public bool IsSelected { get { return _isSelected; } - set { _isSelected = value; - RaisePropertyChangedAuto();} + set + { + _isSelected = value; + RaisePropertyChangedAuto(); + } } @@ -111,6 +116,7 @@ namespace Tango.PPC.Jobs.Models public FavoriteColor() { + LiquidVolumes = new List<FavoriteColorLiquidVolume>(); Hue = Saturation = 0; Brightness = 100; L = 100; @@ -125,14 +131,93 @@ namespace Tango.PPC.Jobs.Models public bool Equals(FavoriteColor color) { - if(color == null) + if (color == null) return false; - return (ColorSpace == color.ColorSpace - && Cyan == color.Cyan && Magenta == color.Magenta && Yellow == color.Yellow && Black ==color.Black + var step1 = (ColorSpace == color.ColorSpace && Red == color.Red && Green == color.Green && Blue == color.Blue - && L == color.L && A == color.A && B == color.B + && L == color.L && A == color.A && B == color.B && Hue == color.Hue && Saturation == color.Saturation && Brightness == color.Brightness); + + foreach (var liquidType in Enum.GetValues(typeof(LiquidTypes)).Cast<LiquidTypes>()) + { + if (GetVolume(liquidType) != color.GetVolume(liquidType)) + { + return false; + } + } + + if (step1) return true; + return false; + } + + public double GetVolume(LiquidTypes liquidType) + { + if (liquidType == LiquidTypes.Cyan) + { + var liquidVolume = LiquidVolumes.FirstOrDefault(x => x.LiquidType == liquidType); + if (liquidVolume == null) + { + var newColor = new FavoriteColorLiquidVolume() { LiquidType = liquidType, Volume = Cyan }; + LiquidVolumes.Add(newColor); + return newColor.Volume; + } + } + else if (liquidType == LiquidTypes.Magenta) + { + var liquidVolume = LiquidVolumes.FirstOrDefault(x => x.LiquidType == liquidType); + if (liquidVolume == null) + { + var newColor = new FavoriteColorLiquidVolume() { LiquidType = liquidType, Volume = Magenta }; + LiquidVolumes.Add(newColor); + return newColor.Volume; + } + } + else if (liquidType == LiquidTypes.Yellow) + { + var liquidVolume = LiquidVolumes.FirstOrDefault(x => x.LiquidType == liquidType); + if (liquidVolume == null) + { + var newColor = new FavoriteColorLiquidVolume() { LiquidType = liquidType, Volume = Yellow }; + LiquidVolumes.Add(newColor); + return newColor.Volume; + } + } + else if (liquidType == LiquidTypes.Black) + { + var liquidVolume = LiquidVolumes.FirstOrDefault(x => x.LiquidType == liquidType); + if (liquidVolume == null) + { + var newColor = new FavoriteColorLiquidVolume() { LiquidType = liquidType, Volume = Black }; + LiquidVolumes.Add(newColor); + return newColor.Volume; + } + } + + { + var liquidVolume = LiquidVolumes.FirstOrDefault(x => x.LiquidType == liquidType); + if (liquidVolume != null) + { + return liquidVolume.Volume; + } + else + { + return 0; + } + } + } + + public void SetVolume(LiquidTypes liquidType, double volume) + { + var liquidVolume = LiquidVolumes.FirstOrDefault(x => x.LiquidType == liquidType); + if (liquidVolume != null) + { + liquidVolume.Volume = volume; + } + else + { + LiquidVolumes.Add(new FavoriteColorLiquidVolume() { LiquidType = liquidType, Volume = volume }); + } } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColorLiquidVolume.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColorLiquidVolume.cs new file mode 100644 index 000000000..a296bcfc4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColorLiquidVolume.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Enumerations; + +namespace Tango.PPC.Jobs.Models +{ + public class FavoriteColorLiquidVolume + { + public LiquidTypes LiquidType { get; set; } + public double Volume { get; set; } + } +} 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 edfa065d1..283c051e8 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 @@ -864,7 +864,7 @@ namespace Tango.PPC.Jobs.Models Name = "Inter Segment", Job = this, }; - segment.BrushStops.Add(new BrushStopModel(segment) + segment.BrushStops.Add(new BrushStopModel(segment, null) { ColorSpace = ColorSpaces.RGB, Color = System.Windows.Media.Colors.White, @@ -917,8 +917,11 @@ namespace Tango.PPC.Jobs.Models { foreach (var stop in innerSegment.BrushStops.OrderBy(x => x.StopIndex).ToList()) { - BrushStop bs = stop.CreateBrushStop(); - stops.Add(bs); + if (stop.BrushStop != null) + { + BrushStop bs = stop.CreateBrushStop(); + stops.Add(bs); + } } } else if (segment is SegmentsGroupModel group) @@ -927,13 +930,24 @@ namespace Tango.PPC.Jobs.Models { foreach (var stop in segm_group.BrushStops.OrderBy(x => x.StopIndex).ToList()) { - BrushStop bs = stop.CreateBrushStop(); - stops.Add(bs); + if (stop.BrushStop != null) + { + BrushStop bs = stop.CreateBrushStop(); + stops.Add(bs); + } } } } } - return _converter.GetRecommendedProcessParameters(Rml, Machine, stops, Rml.GetActiveProcessGroup(), useLightInks); + + if (stops.Count > 0) + { + return _converter.GetRecommendedProcessParameters(Rml, Machine, stops, Rml.GetActiveProcessGroup(), useLightInks); + } + else + { + return Rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault(); + } } catch (Exception ex) { 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 ca80b27a0..91f5a854d 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 @@ -320,6 +320,7 @@ <Compile Include="Models\BrushStopModel.cs" /> <Compile Include="Models\ColorLibrary.cs" /> <Compile Include="Models\FavoriteColor.cs" /> + <Compile Include="Models\FavoriteColorLiquidVolume.cs" /> <Compile Include="Models\ISegmentModel.cs" /> <Compile Include="Models\JobModel.cs" /> <Compile Include="Models\LiquidVolumeModel.cs" /> @@ -764,7 +765,7 @@ <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/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs index 5298cf096..2004d60b7 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModelLocator.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.DI; +using Tango.PPC.Common.Build; using Tango.PPC.Jobs.Dialogs; using Tango.PPC.Jobs.ViewModels; @@ -21,7 +22,10 @@ namespace Tango.PPC.Jobs TangoIOC.Default.Register<JobSummeryViewVM>(); TangoIOC.Default.Register<JobViewVM>(); TangoIOC.Default.Register<TwineCatalogViewVM>(); - TangoIOC.Default.Register<JobProgressViewVM>(); + if (TangoIOC.Default.GetInstance<IBuildProvider>().BuildType == BuildType.TS1800) + { + TangoIOC.Default.Register<JobProgressViewVM>(); + } TangoIOC.Default.Register<ColorSelectionViewVM>(); } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs index a5b68b368..3dccd812e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobProgressViewVM.cs @@ -1,10 +1,14 @@ using System; using System.Collections.Generic; +using System.Data.Entity; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL; using Tango.BL.Entities; using Tango.BL.Enumerations; +using Tango.ColorConversion; using Tango.Core.Commands; using Tango.Integration.Operation; using Tango.Logging; @@ -28,6 +32,9 @@ namespace Tango.PPC.Jobs.ViewModels { private StopPrintingButton _stop_job_btn; private JobHandler _handler; + private List<ColorSpace> _colorSpaces; + private bool _conversion_Busy; + private bool _printingEnded; #region Properties @@ -38,12 +45,15 @@ namespace Tango.PPC.Jobs.ViewModels public Job Job { get { return _job; } - set { _job = value; - if(_job == null) + set + { + _job = value; + if (_job == null) { IsDyeingProcess = false; } - RaisePropertyChangedAuto(); } + RaisePropertyChangedAuto(); + } } private RunningJobStatus _runningJobStatus; @@ -53,9 +63,10 @@ namespace Tango.PPC.Jobs.ViewModels public RunningJobStatus RunningJobStatus { get { return _runningJobStatus; } - set { + set + { _runningJobStatus = value; - if(_runningJobStatus == null) + if (_runningJobStatus == null) { IsDyeingProcess = false; } @@ -63,6 +74,14 @@ namespace Tango.PPC.Jobs.ViewModels } } + private bool _displayInputOutput; + public bool DisplayInputOutput + { + get { return _displayInputOutput; } + set { _displayInputOutput = value; RaisePropertyChangedAuto(); } + } + + private bool _isDisplayJobOutline; /// <summary> /// Gets or sets a value indicating whether to display the job outline. @@ -104,16 +123,35 @@ namespace Tango.PPC.Jobs.ViewModels get { return _currentBrushStop; } set { - // if (_currentBrushStop != value) + if (_currentBrushStop != value) { _currentBrushStop = value; OnUpdateCurrentBrush(); - RaisePropertyChangedAuto(); } } } - public JobBrushStop JobBrushStop { get; set; } + private JobBrushStop _jobBrushStop; + public JobBrushStop JobBrushStop + { + get { return _jobBrushStop; } + set + { + if (_jobBrushStop != value) + { + _jobBrushStop = value; + + RaisePropertyChanged(nameof(CyanOutput)); + RaisePropertyChanged(nameof(LightCyanOutput)); + RaisePropertyChanged(nameof(MagentaOutput)); + RaisePropertyChanged(nameof(LightMagentaOutput)); + RaisePropertyChanged(nameof(YellowOutput)); + RaisePropertyChanged(nameof(LightYellowOutput)); + RaisePropertyChanged(nameof(BlackOutput)); + } + } + } + public double CyanOutput { @@ -205,15 +243,8 @@ namespace Tango.PPC.Jobs.ViewModels protected void OnUpdateCurrentBrush() { - CurrentBrushStop.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters); - - RaisePropertyChanged(nameof(CyanOutput)); - RaisePropertyChanged(nameof(LightCyanOutput)); - RaisePropertyChanged(nameof(MagentaOutput)); - RaisePropertyChanged(nameof(LightMagentaOutput)); - RaisePropertyChanged(nameof(YellowOutput)); - RaisePropertyChanged(nameof(LightYellowOutput)); - RaisePropertyChanged(nameof(BlackOutput)); + CurrentBrushStop?.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters); + RaisePropertyChanged(nameof(CurrentBrushStop)); } private double GetVolumeLiquidType(LiquidTypes liquidType) @@ -237,10 +268,22 @@ namespace Tango.PPC.Jobs.ViewModels /// <summary> /// Called when the application has been started. /// </summary> - public override void OnApplicationStarted() + public override async void OnApplicationStarted() { MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; + + try + { + using (var db = ObservablesContext.CreateDefault()) + { + _colorSpaces = await db.ColorSpaces.ToListAsync(); + } + } + catch (Exception ex) + { + LogManager.Log(ex); + } } /// <summary> @@ -278,8 +321,12 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="e">The <see cref="PrintingEventArgs"/> instance containing the event data.</param> private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { + DisplayInputOutput = false; + _printingEnded = false; _handler = e.JobHandler; Job = e.Job; + CurrentBrushStop = null; + JobBrushStop = null; e.JobHandler.StatusChanged += JobHandler_StatusChanged; e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; e.JobHandler.Stopped += JobHandler_Stopped; @@ -291,6 +338,9 @@ namespace Tango.PPC.Jobs.ViewModels private void MachineOperator_PrintingEnded(object sender, PrintingEventArgs e) { + _printingEnded = true; + CurrentBrushStop = RunningJobStatus.CurrentSegment.BrushStops.OrderBy(x => x.StopIndex).Last(); + LogManager.Log("Printing ended, popping job stop button..."); if (_stop_job_btn != null) @@ -347,46 +397,133 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="e">The e.</param> private void JobHandler_StatusChanged(object sender, RunningJobStatus e) { - InvokeUI(() => + InvokeUI(async () => { RunningJobStatus = e; IsDyeingProcess = (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null); - if (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null) - { - if (_runningJobStatus.CurrentSegment.IsInterSegment) - { - CurrentBrushStop = _runningJobStatus.CurrentSegment.BrushStops.FirstOrDefault(); - JobBrushStop = null; - } - else + if (RunningJobStatus != null && RunningJobStatus.CurrentSegment != null) { - var realsegmIndex = 1; - if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + + try { - int segmentIndex = _runningJobStatus.CurrentSegment.SegmentIndex - (Job.EffectiveSegments.Count * RunningJobStatus.CurrentUnit); - if (RunningJobStatus.CurrentUnit > 0) + if (_runningJobStatus.CurrentSegment.IsInterSegment) + { + var stop = _runningJobStatus.CurrentSegment.BrushStops.FirstOrDefault(); + stop.ColorSpace = CurrentBrushStop.ColorSpace; + CurrentBrushStop = stop; + JobBrushStop = null; + } + else { - segmentIndex -= RunningJobStatus.CurrentUnit;// inter segment between units + var realsegmIndex = 1; + if (Job.EnableInterSegment && Job.InterSegmentLength > 0) + { + int segmentIndex = _runningJobStatus.CurrentSegment.SegmentIndex - (Job.EffectiveSegments.Count * RunningJobStatus.CurrentUnit); + if (RunningJobStatus.CurrentUnit > 0) + { + segmentIndex -= RunningJobStatus.CurrentUnit;// inter segment between units + } + realsegmIndex = (int)(segmentIndex / 2) + 1; + } + else + { + realsegmIndex = Math.Max(_runningJobStatus.CurrentSegment.SegmentIndex - (Job.Segments.Count * RunningJobStatus.CurrentUnit), 0); + } + + var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == realsegmIndex); + JobSegment jobSegment = null; + if (segment != null) + { + if (_handler.JobTicket.Segments.Count > 0) + { + jobSegment = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)]; + if (jobSegment.BrushStops.Count == 1) + { + JobBrushStop = jobSegment.BrushStops.First(); + } + else if (jobSegment.BrushStops.Count > 1) + { + JobBrushStop = jobSegment.BrushStops.Last(x => x.OffsetMeters <= e.CurrentSegment.Progress); + } + else + { + JobBrushStop = null; + } + } + } + + + if (segment != null && jobSegment != null && jobSegment.BrushStops.Count > 1) + { + if (!_conversion_Busy) + { + var brushStop = RunningJobStatus.CurrentSegment.FirstBrushStop; + await ApplyJobBrushStopToBrushStop(JobBrushStop, brushStop); + + if (!_printingEnded) + { + _currentBrushStop = brushStop; + RaisePropertyChanged(nameof(CurrentBrushStop)); + } + } + } + else + { + CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop; + } + + } - realsegmIndex = (int)(segmentIndex / 2) + 1; } - else + catch (Exception ex) { - realsegmIndex = Math.Max(_runningJobStatus.CurrentSegment.SegmentIndex - (Job.Segments.Count * RunningJobStatus.CurrentUnit), 0); + LogManager.Log(ex, "Error displaying job progress input output."); } - var segment = Job.Segments.FirstOrDefault(x => x.SegmentIndex == realsegmIndex); - if (segment != null) + DisplayInputOutput = true; + } + }); + } + + private async Task ApplyJobBrushStopToBrushStop(JobBrushStop stop, BrushStop s) + { + _conversion_Busy = true; + + foreach (var dispenser in stop.Dispensers) + { + s.SetVolume(dispenser.Index, dispenser.Volume); + } + + s.SetLiquidVolumes(MachineProvider.Machine.Configuration, Job.Rml, MachineProvider.MachineOperator.CurrentProcessParameters); + + foreach (var liquidVolume in s.LiquidVolumes.Where(x => x.IdsPack.LiquidType.IsLightInk && x.Volume > 0).ToList()) + { + var darkInk = s.LiquidVolumes.FirstOrDefault(x => x.IdsPack.LiquidType.Code == liquidVolume.IdsPack.LiquidType.DarkInkCode); + if (darkInk != null) + { + darkInk.Volume = liquidVolume.Volume / 10d; + liquidVolume.Volume = 0; + } + } + + if (_colorSpaces != null) + { + if ((s.BrushColorSpace == ColorSpaces.RGB || s.BrushColorSpace == ColorSpaces.LAB) && (!s.IsLast && !s.IsFirst)) + { + var converter = new DefaultColorConverter(); + + var previousSpace = s.ColorSpace; + s.SetColorSpaceSilent(_colorSpaces.First(x => x.Space == ColorSpaces.Volume)); + var output = await converter.ConvertAsync(s, false, false); + s.SetColorSpaceSilent(previousSpace); + if (!_printingEnded) { - if (_handler.JobTicket.Segments.Count > 0) - { - JobBrushStop = _handler.JobTicket.Segments[Job.OrderedSegments.IndexOf(segment)].BrushStops.First(); - } + output.ApplyOnBrushStop(s, MachineProvider.MachineOperator.CurrentProcessParameters); } - CurrentBrushStop = RunningJobStatus.CurrentSegment.FirstBrushStop; } - } - }); + } + + _conversion_Busy = false; } /// <summary> 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 81ce7f959..dd93a3cf6 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 @@ -110,11 +110,12 @@ namespace Tango.PPC.Jobs.ViewModels public bool CanEdit { - get { - return Job != null && - (!MachineProvider.MachineOperator.IsPrinting - || MachineProvider.MachineOperator.RunningJob == null - || MachineProvider.MachineOperator.RunningJob.Guid != Job.Guid) + get + { + return Job != null && + (!MachineProvider.MachineOperator.IsPrinting + || MachineProvider.MachineOperator.RunningJob == null + || MachineProvider.MachineOperator.RunningJob.Guid != Job.Guid) && !HasResumeModel; } } @@ -125,7 +126,7 @@ namespace Tango.PPC.Jobs.ViewModels { return Job != null && HasResumeModel && (!MachineProvider.MachineOperator.IsPrinting - || (MachineProvider.MachineOperator.RunningJob != null + || (MachineProvider.MachineOperator.RunningJob != null && MachineProvider.MachineOperator.RunningJob.Guid != Job.Guid)); } } @@ -301,7 +302,7 @@ namespace Tango.PPC.Jobs.ViewModels } } } - + private JobResumeModel _resumeModel; public JobResumeModel ResumeModel { @@ -444,7 +445,7 @@ namespace Tango.PPC.Jobs.ViewModels CopyCommand = new RelayCommand(Copy); UndoCommand = new RelayCommand(Undo);//(x) => { return UndoRedoManager.Instance.IsEnableUndoOperation(); } RedoCommand = new RelayCommand(Redo);//(x) => { return UndoRedoManager.Instance.IsEnableRedoOperation();} - DropResumeCommand = new RelayCommand(DropResume, (x)=> CanDropResume); + DropResumeCommand = new RelayCommand(DropResume, (x) => CanDropResume); NavigateBackToJobs = new RelayCommand(NavigateBack); @@ -531,7 +532,7 @@ namespace Tango.PPC.Jobs.ViewModels } RaisePropertyChanged(nameof(CanEdit)); - DropResumeCommand.RaiseCanExecuteChanged(); + DropResumeCommand.RaiseCanExecuteChanged(); Job.NameChanged -= Job_NameChanged; Job.NameChanged += Job_NameChanged; @@ -1178,7 +1179,7 @@ namespace Tango.PPC.Jobs.ViewModels DialogEditObject = new ColorSelectionViewVM.DialogObject() { SelectedSegment = segment, - BrushStopForEdit = new BrushStopModel(segment), + BrushStopForEdit = new BrushStopModel(segment, null), IsEditingMode = false, Catalogs = _catalogs } @@ -1785,10 +1786,10 @@ namespace Tango.PPC.Jobs.ViewModels private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { RaisePropertyChanged(nameof(CanEdit)); - InvokeUI( () => - { - DropResumeCommand.RaiseCanExecuteChanged(); - }); + InvokeUI(() => + { + DropResumeCommand.RaiseCanExecuteChanged(); + }); } private void MachineOperator_PrintingEnded(object sender, Integration.Operation.PrintingEventArgs e) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml index 27cf5a53c..2d7d3db15 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobProgressView.xaml @@ -45,21 +45,21 @@ <DataTemplate x:Key="RGB_Template" DataType="{x:Type entities:BrushStop}"> <UniformGrid Rows="1" Columns="3" Height="Auto" > <StackPanel Orientation="Vertical" Width="50"> - <Border Width="50" Height="50" Background="Red" CornerRadius="16" HorizontalAlignment="Left"> - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Red}" VerticalAlignment="Center"></TextBlock> + <Border Width="50" Height="50" Background="#E13C3C" CornerRadius="16" HorizontalAlignment="Left"> + <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Foreground="{StaticResource TangoLightForegroundBrush}" Text="{Binding Red}" VerticalAlignment="Center"></TextBlock> </Border> <TextBlock Margin="0 10 0 0" Text="R" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" HorizontalAlignment="Center"/> </StackPanel> <StackPanel Orientation="Vertical" Margin="4 0 0 0" Width="50"> - <Border Width="50" Height="50" Background="Green" CornerRadius="16" HorizontalAlignment="Left"> - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Green}" VerticalAlignment="Center"></TextBlock> + <Border Width="50" Height="50" Background="#5CBB5C" CornerRadius="16" HorizontalAlignment="Left"> + <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Green}" VerticalAlignment="Center" Foreground="{StaticResource TangoLightForegroundBrush}"></TextBlock> </Border> <TextBlock Margin="0 10 0 0" Text="G" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" HorizontalAlignment="Center"/> </StackPanel> <StackPanel Orientation="Vertical" Margin="4 0 0 0" Width="50"> - <Border Width="50" Height="50" Background="Blue" CornerRadius="16" HorizontalAlignment="Left"> + <Border Width="50" Height="50" Background="#DC0808F1" CornerRadius="16" HorizontalAlignment="Left"> <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding Blue}" VerticalAlignment="Center" Foreground="{StaticResource TangoLightForegroundBrush}"></TextBlock> </Border> <TextBlock Margin="0 10 0 0" Text="B" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" HorizontalAlignment="Center"/> @@ -71,20 +71,20 @@ <DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}"> <UniformGrid Rows="1" Columns="3" Height="Auto" MinWidth="180" HorizontalAlignment="Left"> <StackPanel Orientation="Vertical" Width="50"> - <Border Width="50" Height="50" Background="Gray" CornerRadius="16" HorizontalAlignment="Left"> + <Border Width="50" Height="50" Background="#CECECE" CornerRadius="16" HorizontalAlignment="Left"> <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding L, StringFormat=0.##}" VerticalAlignment="Center"></TextBlock> </Border> <TextBlock Margin="0 10 0 0 " Text="L" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> </StackPanel> <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left" Margin="5 0 0 0"> - <Border Width="50" Height="50" Background="red" CornerRadius="16" HorizontalAlignment="Left"> - <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding A, StringFormat=0.##}" VerticalAlignment="Center"></TextBlock> + <Border Width="50" Height="50" Background="#E13C3C" CornerRadius="16" HorizontalAlignment="Left"> + <TextBlock Margin="0 0 0 0" Style="{StaticResource SliderGreyTextStyle}" Foreground="{StaticResource TangoLightForegroundBrush}" Text="{Binding A, StringFormat=0.##}" VerticalAlignment="Center"></TextBlock> </Border> <TextBlock Margin="0 10 0 0 " Text="a" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> </StackPanel> <StackPanel Orientation="Vertical" Margin="10 0 0 0" Width="50"> - <Border Width="50" Height="50" Background="Blue" CornerRadius="16" HorizontalAlignment="Left"> + <Border Width="50" Height="50" Background="#DC0808F1" CornerRadius="16" HorizontalAlignment="Left"> <TextBlock Margin="0 0 0 0" HorizontalAlignment="Center" Style="{StaticResource SliderGreyTextStyle}" Text="{Binding B, StringFormat=0.##}" Foreground="{StaticResource TangoLightForegroundBrush}" VerticalAlignment="Center"></TextBlock> </Border> <TextBlock Margin="0 10 0 0 " Text="b" FontSize="{StaticResource TangoDefaultFontSize}" HorizontalAlignment="Center"/> @@ -318,7 +318,7 @@ </TextBlock.Style> </TextBlock> </StackPanel> - <UniformGrid Margin="0 20 0 0" Rows="1" Columns="3" Height="Auto" MinWidth="190" HorizontalAlignment="Left" Visibility="{Binding IsDyeingProcess,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <UniformGrid Margin="0 20 0 0" Rows="1" Columns="3" Height="Auto" MinWidth="190" HorizontalAlignment="Left" Visibility="{Binding DisplayInputOutput,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <StackPanel Orientation="Vertical" Width="50"> <Border Width="50" Height="50" Background="Transparent" CornerRadius="16" HorizontalAlignment="Left" BorderBrush="{StaticResource TangoDisabledForegroundBrush}" BorderThickness="1"> <TextBlock Margin="0 0 0 0 " Style="{StaticResource SliderGreyTextStyle}" Text="-" ></TextBlock> @@ -338,7 +338,7 @@ <TextBlock Margin="0 10 0 0 " Text="B" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center"/> </StackPanel> </UniformGrid> - <Grid Visibility="{Binding IsDyeingProcess,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Grid Visibility="{Binding DisplayInputOutput,Converter={StaticResource BooleanToVisibilityConverter}}"> <ContentControl x:Name="leftBrushValues" HorizontalAlignment="Left" Content="{Binding CurrentBrushStop}" Width="Auto" Height="Auto" Margin="0 20 0 0"> <ContentControl.Style> <Style TargetType="ContentControl"> @@ -371,7 +371,7 @@ <Image Source="../Images/JobProgressView/output.png" Stretch="None" VerticalAlignment="Top" HorizontalAlignment="Left" Height="Auto" ClipToBounds="True"/> <TextBlock VerticalAlignment="Center" Margin="15 0 0 0" FontSize="{StaticResource TangoDefaultFontSize}" >Output ( % ) </TextBlock> </StackPanel> - <UniformGrid Margin="0 20 0 0" Rows="1" Columns="7" Height="Auto" Width="435" HorizontalAlignment="Left" Visibility="{Binding IsDyeingProcess,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <UniformGrid Margin="0 20 0 0" Rows="1" Columns="7" Height="Auto" Width="435" HorizontalAlignment="Left" Visibility="{Binding DisplayInputOutput,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <StackPanel Orientation="Vertical" Width="50"> <Border Width="50" Height="50" Background="Transparent" CornerRadius="16" HorizontalAlignment="Left" BorderBrush="{StaticResource TangoDisabledForegroundBrush}" BorderThickness="1"> <TextBlock Margin="0 0 0 0 " Text="0" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center" VerticalAlignment="Center"/> @@ -416,7 +416,7 @@ </StackPanel> </UniformGrid> - <UniformGrid Columns="7" Rows="1" Margin="0 20 0 0" Width="440" HorizontalAlignment="Left" Visibility="{Binding IsDyeingProcess,Converter={StaticResource BooleanToVisibilityConverter}}"> + <UniformGrid Columns="7" Rows="1" Margin="0 20 0 0" Width="440" HorizontalAlignment="Left" Visibility="{Binding DisplayInputOutput,Converter={StaticResource BooleanToVisibilityConverter}}"> <StackPanel Orientation="Vertical" Width="50" HorizontalAlignment="Left" > <Border Width="50" Height="50" Background="#007FB5" CornerRadius="16" HorizontalAlignment="Left" VerticalAlignment="Center"> <TextBlock Margin="0 0 0 0 " HorizontalAlignment="Center" Text="{Binding CyanOutput}" VerticalAlignment="Center" Foreground="White"></TextBlock> |
