aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2021-01-04 11:52:20 +0200
committerAvi Levkovich <avi@twine-s.com>2021-01-04 11:52:20 +0200
commit7c3e54578ae6f2c01ec05ebc7f7e0f873955bb33 (patch)
tree3eb92323c29633dde9df39666ece64815ff7da98 /Software/Visual_Studio/PPC/Modules
parent6a2aa48d486a9f83449d7e2c5e85b62649763c49 (diff)
parentb0dc79e93c1a17667211bff5c7e48eb2d69ad386 (diff)
downloadTango-7c3e54578ae6f2c01ec05ebc7f7e0f873955bb33.tar.gz
Tango-7c3e54578ae6f2c01ec05ebc7f7e0f873955bb33.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs32
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs16
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml2
3 files changed, 37 insertions, 13 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 6f7717a90..777b1f24d 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
@@ -519,7 +519,7 @@ namespace Tango.PPC.Jobs.ViewModels
ValidateBrushStops();
- CoerceBrushStopsColorSpaceChange();
+ RegisterJobBrushStopsColorSpaceChange();
DyeCommand.RaiseCanExecuteChanged();
StartSampleDyeCommand.RaiseCanExecuteChanged();
@@ -657,8 +657,15 @@ namespace Tango.PPC.Jobs.ViewModels
/// </summary>
private bool CanStartJob()
{
- return
- Job != null && Job.Validate(_db) && !Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.IsTransparent && !x.IsWhite).ToList().Exists(x => x.IsOutOfGamut || x.IsLiquidVolumesOutOfRange);
+ try
+ {
+ 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));
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex);
+ return false;
+ }
}
#endregion
@@ -702,7 +709,7 @@ namespace Tango.PPC.Jobs.ViewModels
LogManager.Log("Adding new solid segment...");
var s = Job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10);
SetSegmentLiquidVolumes(s);
- CoerceBrushStopsColorSpaceChange();
+ RegisterJobBrushStopsColorSpaceChange();
return s;
}
catch (Exception ex)
@@ -723,7 +730,7 @@ namespace Tango.PPC.Jobs.ViewModels
LogManager.Log("Adding new gradient segment...");
var s = Job.AddGradientSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10);
SetSegmentLiquidVolumes(s);
- CoerceBrushStopsColorSpaceChange();
+ RegisterJobBrushStopsColorSpaceChange();
return s;
}
catch (Exception ex)
@@ -771,6 +778,7 @@ namespace Tango.PPC.Jobs.ViewModels
segment.BrushStops.ToList().ForEach(x =>
{
+ x.ColorSpaceChanged -= Stop_ColorSpaceChanged;
_db.BrushStops.Remove(x);
});
_db.Segments.Remove(segment);
@@ -826,7 +834,7 @@ namespace Tango.PPC.Jobs.ViewModels
#region Brush Stops Management
- private void CoerceBrushStopsColorSpaceChange()
+ private void RegisterJobBrushStopsColorSpaceChange()
{
if (Job != null)
{
@@ -842,6 +850,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
BrushStop stop = sender as BrushStop;
stop.Segment.BrushStops.Where(x => x != stop).ToList().ForEach(x => x.ColorSpace = stop.ColorSpace);
+
+ DyeCommand.RaiseCanExecuteChanged();
}
/// <summary>
@@ -853,7 +863,7 @@ namespace Tango.PPC.Jobs.ViewModels
LogManager.Log($"Adding new brush stop to segment {segment.SegmentIndex}.");
segment.AddBrushStop();
SetSegmentLiquidVolumes(segment);
- CoerceBrushStopsColorSpaceChange();
+ RegisterJobBrushStopsColorSpaceChange();
}
/// <summary>
@@ -866,6 +876,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
LogManager.Log($"removing brush stop {brushStop.StopIndex} from segment {brushStop.Segment.SegmentIndex}.");
var segment = brushStop.Segment;
+ brushStop.ColorSpaceChanged -= Stop_ColorSpaceChanged;
_db.BrushStops.Remove(brushStop);
ArrangeBrushStopsIndices(segment);
}
@@ -956,10 +967,7 @@ namespace Tango.PPC.Jobs.ViewModels
}
else if (brushStop.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume)
{
- if (vm.SelectedSuggestion != suggestions.GetCenterSuggestion())
- {
- vm.SelectedSuggestion.ApplyOnBrushStop(brushStop);
- }
+ vm.SelectedSuggestion.ApplyOnBrushStop(brushStop);
}
brushStop.Corrected = true;
@@ -1323,7 +1331,7 @@ namespace Tango.PPC.Jobs.ViewModels
if (Job != null && Job.Rml.Cct != null && IsVisible)
{
- var brushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => (x.BrushColorSpace == BL.Enumerations.ColorSpaces.LAB || x.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB) && !x.Corrected && !x.OutOfGamutChecked).ToList();
+ var brushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => x.ColorSpace != null).Where(x => (x.BrushColorSpace == BL.Enumerations.ColorSpaces.LAB || x.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB) && !x.Corrected && !x.OutOfGamutChecked).ToList();
foreach (var stop in brushStops)
{
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
index f4bbf6da3..523934985 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
@@ -227,6 +227,13 @@ namespace Tango.PPC.MachineSettings.ViewModels
set { _lubricationLevels = value; RaisePropertyChangedAuto(); }
}
+ private RmlLubricationLevelSettings _selectedLubricationLevel;
+ public RmlLubricationLevelSettings SelectedLubricationLevel
+ {
+ get { return _selectedLubricationLevel; }
+ set { _selectedLubricationLevel = value; RaisePropertyChangedAuto(); }
+ }
+
#endregion
#region Commands
@@ -445,6 +452,15 @@ namespace Tango.PPC.MachineSettings.ViewModels
}
LubricationLevels = levels;
+
+ if (SelectedLubricationLevel != null)
+ {
+ SelectedLubricationLevel = LubricationLevels.FirstOrDefault(x => x.RmlGuid == SelectedLubricationLevel.RmlGuid);
+ }
+ else
+ {
+ SelectedLubricationLevel = LubricationLevels.FirstOrDefault();
+ }
}
catch (Exception ex)
{
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
index d105278e6..e69c57753 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
@@ -176,7 +176,7 @@
<StackPanel Margin="20 0 20 40">
<StackPanel Margin="0 40 0 0">
<TextBlock FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}">Thread Type</TextBlock>
- <touch:TouchComboBox x:Name="lubricationCombo" Margin="0 5 0 0" ItemsSource="{Binding LubricationLevels}" DisplayMemberPath="Name"></touch:TouchComboBox>
+ <touch:TouchComboBox x:Name="lubricationCombo" Margin="0 5 0 0" ItemsSource="{Binding LubricationLevels}" SelectedItem="{Binding SelectedLubricationLevel}" DisplayMemberPath="Name"></touch:TouchComboBox>
</StackPanel>
<StackPanel Margin="0 20 0 0">