diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-10-17 12:37:58 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-10-17 12:37:58 +0300 |
| commit | 41d9ff70aa37ee31fcd99803ba87cb638d3f26f7 (patch) | |
| tree | aa178252edec28d6aa3b412e4c830043d3673cb7 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | |
| parent | 3f9ce854b813fc109fbe5e531e9bb8e6276b3f90 (diff) | |
| download | Tango-41d9ff70aa37ee31fcd99803ba87cb638d3f26f7.tar.gz Tango-41d9ff70aa37ee31fcd99803ba87cb638d3f26f7.zip | |
Improved Research Selected RML loading.
Fixed issue with duplicating segments not loading liquid factors.
Select cloned segment on clone.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 60 |
1 files changed, 41 insertions, 19 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index dfba1a79c..07686165b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -44,6 +44,7 @@ using Tango.MachineStudio.Logging.Views; using Tango.AutoComplete.Editors; using System.Data.Entity; using System.Runtime.ExceptionServices; +using Tango.BL.Builders; namespace Tango.MachineStudio.Developer.ViewModels { @@ -76,6 +77,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private bool _color_changed_from_hive; private bool _dialog_shown; private bool _disable_gamut_check; + private bool _rml_has_no_cct; #region Properties @@ -731,7 +733,7 @@ namespace Tango.MachineStudio.Developer.ViewModels ImportEmbroideryFileCommand = new RelayCommand(ImportEmbroideryFile, () => SelectedMachine != null && CanWork); DisplayJobEmbroideryFileCommand = new RelayCommand<Job>(DisplayJobEmbroideryFile, () => CanWork); ReloadMachinesCommand = new RelayCommand(() => LoadMachine(), () => CanWork && SelectedMachine != null); - ResetProcessParametersCommand = new RelayCommand(ResetProcessParameters,() => CanWork && MachineOperator != null); + ResetProcessParametersCommand = new RelayCommand(ResetProcessParameters, () => CanWork && MachineOperator != null); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; @@ -794,7 +796,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { while (true) { - if (EnableColorConversion && !_disable_gamut_check && IsJobVisible && IsVisible && ActiveJob != null && ActiveJob.Segments != null) + if (!_rml_has_no_cct && EnableColorConversion && !_disable_gamut_check && IsJobVisible && IsVisible && ActiveJob != null && ActiveJob.Segments != null) { try { @@ -1401,9 +1403,23 @@ namespace Tango.MachineStudio.Developer.ViewModels if (SelectedRML != null && SelectedMachine != null) { LogManager.Log("Invalidating liquid factors, process parameters and process group history..."); - LiquidTypesRmls = ActiveJob.Machine.Configuration.NoneEmptyIdsPacks.Where(x => !x.IsEmpty).OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); - _activeJobDbContext.Adapter.GetRmlProcessParametersTablesGroups(SelectedRML.Guid); + _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().WithMediaProperties().Build(); + + if (_selectedRML.Cats.Count == 0) + { + InvokeUI(() => + { + _rml_has_no_cct = true; + _notification.ShowWarning(LogManager.Log($"No color conversion table defined for the selected RML '{_selectedRML.Name}'. Color conversion is disabled.", LogCategory.Warning)); + }); + } + else + { + _rml_has_no_cct = false; + } + + LiquidTypesRmls = ActiveJob.Machine.Configuration.NoneEmptyIdsPacks.Where(x => !x.IsEmpty).OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active); @@ -1424,17 +1440,22 @@ namespace Tango.MachineStudio.Developer.ViewModels RaisePropertyChanged(nameof(SelectedGroupHistory)); RaisePropertyChanged(nameof(RmlProcessParametersTableGroup)); }); + + ActiveJob.Rml = SelectedRML; } } private async void OnSelectedRMLChanged() { - using (_notification.PushTaskItem("Loading RML...")) + if (SelectedRML != null && SelectedMachine != null) { - await Task.Factory.StartNew(() => + using (_notification.PushTaskItem("Loading RML...")) { - InvalidateLiquidFactorsAndProcessTables(); - }); + await Task.Factory.StartNew(() => + { + InvalidateLiquidFactorsAndProcessTables(); + }); + } } } @@ -1590,21 +1611,21 @@ namespace Tango.MachineStudio.Developer.ViewModels SpoolTypes = _activeJobDbContext.SpoolTypes.ToObservableCollection(); LogManager.Log("Setting active job..."); - ActiveJob = _activeJobDbContext.Adapter.GetJob(SelectedMachineJob.Guid); + ActiveJob = new JobBuilder(_activeJobDbContext).Set(SelectedMachineJob.Guid).WithUser().WithSegments().WithBrushStops().WithConfiguration().WithRML().Build(); - _activeJobDbContext.Ccts.Where(x => x.RmlGuid == ActiveJob.RmlGuid).ToList(); - _activeJobDbContext.Cats.Where(x => x.RmlGuid == ActiveJob.RmlGuid).ToList(); - _activeJobDbContext.Machines.SingleOrDefault(x => x.Guid == ActiveJob.MachineGuid); - _activeJobDbContext.Configurations.SingleOrDefault(x => x.Guid == ActiveJob.Machine.ConfigurationGuid); + //_activeJobDbContext.Ccts.Where(x => x.RmlGuid == ActiveJob.RmlGuid).ToList(); + //_activeJobDbContext.Cats.Where(x => x.RmlGuid == ActiveJob.RmlGuid).ToList(); + //_activeJobDbContext.Machines.SingleOrDefault(x => x.Guid == ActiveJob.MachineGuid); + //_activeJobDbContext.Configurations.SingleOrDefault(x => x.Guid == ActiveJob.Machine.ConfigurationGuid); - _activeJobDbContext.LiquidTypesRmls.ToList(); + //_activeJobDbContext.LiquidTypesRmls.ToList(); - _activeJobDbContext.IdsPackFormulas.ToList(); - _activeJobDbContext.LiquidTypes.ToList(); - _activeJobDbContext.MidTankTypes.ToList(); - _activeJobDbContext.DispenserTypes.ToList(); + //_activeJobDbContext.IdsPackFormulas.ToList(); + //_activeJobDbContext.LiquidTypes.ToList(); + //_activeJobDbContext.MidTankTypes.ToList(); + //_activeJobDbContext.DispenserTypes.ToList(); - _activeJobDbContext.IdsPacks.Where(x => x.ConfigurationGuid == ActiveJob.Machine.ConfigurationGuid).ToList(); + //_activeJobDbContext.IdsPacks.Where(x => x.ConfigurationGuid == ActiveJob.Machine.ConfigurationGuid).ToList(); @@ -2031,6 +2052,7 @@ namespace Tango.MachineStudio.Developer.ViewModels var cloned = segment.Clone(); cloned.SegmentIndex = ActiveJob.Segments.Max(x => x.SegmentIndex) + 1; ActiveJob.Segments.Add(cloned); + SelectedSegment = cloned; } ArrangeSegmentsIndices(); |
