aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2021-06-07 14:17:51 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2021-06-07 14:17:51 +0300
commita499e1340f1f6acd7bb0672f11e0476eb42810d1 (patch)
treed3272a92bd071366c36d688ca28ccfa739d2889a /Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs
parent85e6e640d69275fa2be368433d75685546950e92 (diff)
downloadTango-a499e1340f1f6acd7bb0672f11e0476eb42810d1.tar.gz
Tango-a499e1340f1f6acd7bb0672f11e0476eb42810d1.zip
Improved memory consumption on job loading PPC.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs81
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml2
2 files changed, 64 insertions, 19 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 3ea24b5fe..c28b79e31 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
@@ -106,6 +106,16 @@ namespace Tango.PPC.Jobs.ViewModels
set { _rmls = value; RaisePropertyChangedAuto(); }
}
+ private Rml _selectedRML;
+ /// <summary>
+ /// Gets or sets the selected RML.
+ /// </summary>
+ public Rml SelectedRML
+ {
+ get { return _selectedRML; }
+ set { _selectedRML = value; RaisePropertyChangedAuto(); OnSelectedRmlChanged(); }
+ }
+
private List<SpoolType> _spoolTypes;
/// <summary>
/// Gets or sets the available spool types.
@@ -439,6 +449,9 @@ namespace Tango.PPC.Jobs.ViewModels
{
if (Job != null)
{
+ //Job.RmlChanged -= OnRmlChanged;
+ Job.NameChanged -= Job_NameChanged;
+
foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).ToList())
{
stop.ColorSpaceChanged -= Stop_ColorSpaceChanged;
@@ -448,7 +461,15 @@ namespace Tango.PPC.Jobs.ViewModels
if (Rmls != null)
{
+ Rmls.Where(x => x.Cct != null && x.Cct.Data != null).ToList().ForEach(x => x.Cct.Data = null);
Rmls.ForEach(x => x.Cct = null);
+
+ if (SelectedRML != null)
+ {
+ SelectedRML.Cct = null;
+ SelectedRML = null;
+ }
+
Rmls = null;
}
@@ -460,24 +481,23 @@ namespace Tango.PPC.Jobs.ViewModels
Job = await new JobBuilder(_db).Set(_job_to_load.Guid)
.WithConfiguration()
- .WithRML()
.WithUser()
.WithSegments()
.WithBrushStops()
.BuildAsync();
- Job.RmlChanged -= OnRmlChanged;
- Job.RmlChanged += OnRmlChanged;
+ //Job.RmlChanged -= OnRmlChanged;
+ //Job.RmlChanged += OnRmlChanged;
Job.NameChanged -= Job_NameChanged;
Job.NameChanged += Job_NameChanged;
Job.ValidateOnPropertyChanged = true;
- GetLubricationLevel();
- await SetSpoolTension(Job.Rml);
+ //GetLubricationLevel();
+ //await SetSpoolTension(Job.Rml);
LogManager.Log("Loading RMLS...");
- Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().WithSpools().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).ToList();
+ Rmls = (await new RmlsCollectionBuilder(_db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).ToList();
LogManager.Log("Loading Color Spaces...");
ColorSpaces = await _db.ColorSpaces.Where(x => x.Code != (int)BL.Enumerations.ColorSpaces.CMYK).ToListAsync();
LogManager.Log("Loading Spool Types...");
@@ -487,10 +507,10 @@ namespace Tango.PPC.Jobs.ViewModels
AvailableCatalogs = await new CatalogsCollectionBuilder(_db).SetAll().WithGroups().WithItems().ForSite(MachineProvider.Machine.SiteGuid).BuildListAsync();
- foreach (var segment in Job.Segments)
- {
- SetSegmentLiquidVolumes(segment);
- }
+ _selectedRML = Job.Rml;
+ RaisePropertyChanged(nameof(SelectedRML));
+
+ await LoadRML(_selectedRML);
if (!_check_gamut_thread.IsAlive)
{
@@ -500,7 +520,7 @@ namespace Tango.PPC.Jobs.ViewModels
SegmentsCollectionView = CollectionViewSource.GetDefaultView(Job.Segments);
SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending));
- ResetFineTuning();
+ //ResetFineTuning();
_job_to_load = null;
@@ -685,17 +705,42 @@ namespace Tango.PPC.Jobs.ViewModels
#region RML Changed
- protected async virtual void OnRmlChanged(object sender, Rml rml)
+ private async void OnSelectedRmlChanged()
+ {
+ await LoadRML(SelectedRML);
+ }
+
+ private async Task LoadRML(Rml rml)
{
- foreach (var segment in Job.Segments)
+ if (rml != null)
{
- SetSegmentLiquidVolumes(segment);
- }
+ if (Job.Rml != rml || rml.Cct == null)
+ {
+ if (rml.Cct == null)
+ {
+ Job.Rml = await new RmlBuilder(_db)
+ .Set(rml.Guid)
+ .WithActiveParametersGroup()
+ .WithCCT()
+ .WithCAT(MachineProvider.Machine.Guid)
+ .WithLiquidFactors()
+ .WithSpools()
+ .BuildAsync();
+ }
+ else
+ {
+ Job.Rml = rml;
+ }
- GetLubricationLevel();
- await SetSpoolTension(rml);
+ foreach (var segment in Job.Segments)
+ {
+ SetSegmentLiquidVolumes(segment);
+ }
- ResetFineTuning();
+ GetLubricationLevel();
+ await SetSpoolTension(rml);
+ }
+ }
}
#endregion
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml
index 7aef209ec..582e29c35 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml
@@ -505,7 +505,7 @@
<DockPanel Margin="0 15 0 0">
<TextBlock Width="100" VerticalAlignment="Bottom" Margin="0 0 0 3">Thread type:</TextBlock>
- <touch:TouchComboBox Margin="10 0 0 0" ItemsSource="{Binding Rmls}" SelectedItem="{Binding Job.Rml}" DisplayMemberPath="Name" Title="Select Thread" />
+ <touch:TouchComboBox Margin="10 0 0 0" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" DisplayMemberPath="Name" Title="Select Thread" />
</DockPanel>
<DockPanel Margin="110 5 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}" Visibility="{Binding LubricationLevel,Converter={StaticResource IsNullToVisibilityConverter}}">