From 44af6a05f13cff1defd8ef4a01c4ecdbd7833c33 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 18 Dec 2019 21:05:38 +0200 Subject: Changed DTO's to include byte[] when generated but mapped by reference. More improvements to action logs. --- .../ViewModels/MainViewVM.cs | 142 +++++++++------- ...eStudio.HardwareDesigner_ijdp5tm3_wpftmp.csproj | 184 +++++++++++++++++++++ 2 files changed, 263 insertions(+), 63 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner_ijdp5tm3_wpftmp.csproj (limited to 'Software/Visual_Studio/MachineStudio/Modules') 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 4b276462e..bb8f117c3 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 @@ -1746,6 +1746,8 @@ namespace Tango.MachineStudio.Developer.ViewModels tables.Add(newTable); } + var rmlBeforeDTO = RmlDTO.FromObservable(SelectedRML); + group.Active = true; group.ProcessParametersTables = tables.ToSynchronizedObservableCollection(); group.Rml = SelectedRML; @@ -1760,6 +1762,8 @@ namespace Tango.MachineStudio.Developer.ViewModels SelectedRML.ProcessParametersTablesGroups.Add(group); await SelectedRML.SaveAsync(_activeJobDbContext); + _actionLogManager.InsertLog(ActionLogType.RmlSaved, AuthenticationProvider.CurrentUser, SelectedRML.Name, rmlBeforeDTO, RmlDTO.FromObservable(SelectedRML), "Active process parameters changed from Machine Studio Research module."); + InvalidateLiquidFactorsAndProcessTables(); } @@ -1804,98 +1808,110 @@ namespace Tango.MachineStudio.Developer.ViewModels using (_notification.PushTaskItem("Loading job details...")) { - await Task.Factory.StartNew(() => + try { - _disable_gamut_check = true; + await Task.Factory.StartNew(() => + { + _disable_gamut_check = true; - LogManager.Log(String.Format("Loading job {0}...", SelectedMachineJob.Name)); - SelectedSegments = new ObservableCollection(); - SelectedBrushStops = new ObservableCollection(); - SelectedRML = null; - SelectedSegment = null; - SelectedGroupHistory = null; - SelectedBrushStop = null; - SelectedProcessParametersTable = null; - RmlProcessParametersTableGroup = null; + LogManager.Log(String.Format("Loading job {0}...", SelectedMachineJob.Name)); + SelectedSegments = new ObservableCollection(); + SelectedBrushStops = new ObservableCollection(); + SelectedRML = null; + SelectedSegment = null; + SelectedGroupHistory = null; + SelectedBrushStop = null; + SelectedProcessParametersTable = null; + RmlProcessParametersTableGroup = null; - _blockInvalidateCommands = false; + _blockInvalidateCommands = false; - LogManager.Log("Creating active job DB context..."); - _activeJobDbContext = ObservablesContext.CreateDefault(); + LogManager.Log("Creating active job DB context..."); + _activeJobDbContext = ObservablesContext.CreateDefault(); - LogManager.Log("Initializing available color spaces, RMLs & Winding methods..."); + LogManager.Log("Initializing available color spaces, RMLs & Winding methods..."); - //var processParamsGroups = _activeJobDbContext.ProcessParametersTablesGroups.ToList(); - //var processParams = _activeJobDbContext.ProcessParametersTables.ToList(); + //var processParamsGroups = _activeJobDbContext.ProcessParametersTablesGroups.ToList(); + //var processParams = _activeJobDbContext.ProcessParametersTables.ToList(); - ColorSpaces = _activeJobDbContext.ColorSpaces.ToObservableCollection(); - Rmls = _activeJobDbContext.Rmls.ToObservableCollection(); - WindingMethods = _activeJobDbContext.WindingMethods.ToObservableCollection(); - SpoolTypes = _activeJobDbContext.SpoolTypes.ToObservableCollection(); + ColorSpaces = _activeJobDbContext.ColorSpaces.ToObservableCollection(); + Rmls = _activeJobDbContext.Rmls.ToObservableCollection(); + WindingMethods = _activeJobDbContext.WindingMethods.ToObservableCollection(); + SpoolTypes = _activeJobDbContext.SpoolTypes.ToObservableCollection(); - LogManager.Log("Loading machine spools..."); - _activeJobDbContext.Spools.Where(x => x.MachineGuid == SelectedMachine.Guid).Load(); + LogManager.Log("Loading machine spools..."); + _activeJobDbContext.Spools.Where(x => x.MachineGuid == SelectedMachine.Guid).Load(); - LogManager.Log("Setting active job..."); - ActiveJob = new JobBuilder(_activeJobDbContext).Set(SelectedMachineJob.Guid).WithUser().WithSegments().WithBrushStops().WithConfiguration().WithRML().Build(); + LogManager.Log("Setting active job..."); + 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(); - _beforeSaveJobDTO = JobDTO.FromObservable(ActiveJob); + _beforeSaveJobDTO = JobDTO.FromObservable(ActiveJob); - LogManager.Log("Setting selected segment..."); - _selectedSegment = ActiveJob.OrderedSegments.FirstOrDefault(); + LogManager.Log("Setting selected segment..."); + _selectedSegment = ActiveJob.OrderedSegments.FirstOrDefault(); - ActiveJob.LengthChanged -= ActiveJob_LengthChanged; - ActiveJob.LengthChanged += ActiveJob_LengthChanged; + ActiveJob.LengthChanged -= ActiveJob_LengthChanged; + ActiveJob.LengthChanged += ActiveJob_LengthChanged; - _selectedRML = ActiveJob.Rml; - InvalidateLiquidFactorsAndProcessTables(); - RaisePropertyChanged(nameof(SelectedRML)); + _selectedRML = ActiveJob.Rml; + InvalidateLiquidFactorsAndProcessTables(); + RaisePropertyChanged(nameof(SelectedRML)); - UpdateEstimatedDuration(); + UpdateEstimatedDuration(); - _blockInvalidateCommands = false; - InvalidateRelayCommands(); + _blockInvalidateCommands = false; + InvalidateRelayCommands(); - _disable_gamut_check = false; + _disable_gamut_check = false; - _settings.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null; - _settings.LastSelectedJobGuid = SelectedMachineJob != null ? SelectedMachineJob.Guid : null; + _settings.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null; + _settings.LastSelectedJobGuid = SelectedMachineJob != null ? SelectedMachineJob.Guid : null; - _settings.Save(); - }); + _settings.Save(); + }); - SegmentsCollectionView = CollectionViewSource.GetDefaultView(ActiveJob.Segments); - SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); + SegmentsCollectionView = CollectionViewSource.GetDefaultView(ActiveJob.Segments); + SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); - foreach (var segment in ActiveJob.Segments) - { - SetSegmentBrushStopsLiquidVolumes(segment); - } + foreach (var segment in ActiveJob.Segments) + { + SetSegmentBrushStopsLiquidVolumes(segment); + } - SelectedSegment = _selectedSegment; + SelectedSegment = _selectedSegment; + + if (ActiveJob != null) + { + _current_job_string = ActiveJob.ToJobFileWhenLoaded().ToString(); + } - if (ActiveJob != null) + UIHelper.DoEvents(); + _navigation.NavigateTo(DeveloperNavigationView.JobView); + } + catch (Exception ex) { - _current_job_string = ActiveJob.ToJobFileWhenLoaded().ToString(); + LogManager.Log(ex, "Error loading job."); + _notification.ShowError($"An error occurred while trying to load the selected job.\n{ex.FlattenMessage()}"); + } + finally + { + CanWork = true; } - - UIHelper.DoEvents(); - _navigation.NavigateTo(DeveloperNavigationView.JobView); } CanWork = true; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner_ijdp5tm3_wpftmp.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner_ijdp5tm3_wpftmp.csproj new file mode 100644 index 000000000..0ef643858 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner_ijdp5tm3_wpftmp.csproj @@ -0,0 +1,184 @@ + + + + + Debug + AnyCPU + {69DB0564-268C-4B3C-B5D6-A3CDC7D14EAE} + library + Tango.MachineStudio.HardwareDesigner + Tango.MachineStudio.HardwareDesigner + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\Machine Studio\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\Build\Machine Studio\Release\ + TRACE + prompt + 4 + + + + + + GlobalVersionInfo.cs + + + + + + + + + + + ComparisonWizardView.xaml + + + + MainView.xaml + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {58e8825f-0c96-449c-b320-1e82b0aa876b} + Tango.CSV + + + {b112d89a-a106-41ae-a0c1-4abc84c477f5} + Tango.DragAndDrop + + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {cb0b0aa2-bb24-4bca-a720-45e397684e12} + Tango.MachineStudio.Common + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.3.1