aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2021-01-11 15:01:04 +0200
committerAvi Levkovich <avi@twine-s.com>2021-01-11 15:01:04 +0200
commit3c9d531523b255df4351d1ddafd8acffcb89237e (patch)
treefccbccaaa0ee4a82f545d7a9d339630dbb064087 /Software/Visual_Studio/PPC/Modules
parent1e3551c5fddf4b4fd7b52b762a88033149400012 (diff)
parent9e4e1d03cd01f5ad90c9da2340cfd735c1755b5e (diff)
downloadTango-3c9d531523b255df4351d1ddafd8acffcb89237e.tar.gz
Tango-3c9d531523b255df4351d1ddafd8acffcb89237e.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.cs42
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs14
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml15
3 files changed, 65 insertions, 6 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 5cdf9d7a3..c61d52592 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
@@ -435,6 +435,7 @@ namespace Tango.PPC.Jobs.ViewModels
foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).ToList())
{
stop.ColorSpaceChanged -= Stop_ColorSpaceChanged;
+ stop.ColorCatalogChanged -= Stop_ColorCatalogChanged;
}
}
@@ -519,7 +520,7 @@ namespace Tango.PPC.Jobs.ViewModels
ValidateBrushStops();
- RegisterJobBrushStopsColorSpaceChange();
+ RegisterJobBrushStopsEvents();
DyeCommand.RaiseCanExecuteChanged();
StartSampleDyeCommand.RaiseCanExecuteChanged();
@@ -709,7 +710,7 @@ namespace Tango.PPC.Jobs.ViewModels
LogManager.Log("Adding new solid segment...");
var s = Job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10);
SetSegmentLiquidVolumes(s);
- RegisterJobBrushStopsColorSpaceChange();
+ RegisterJobBrushStopsEvents();
return s;
}
catch (Exception ex)
@@ -730,7 +731,7 @@ namespace Tango.PPC.Jobs.ViewModels
LogManager.Log("Adding new gradient segment...");
var s = Job.AddGradientSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10);
SetSegmentLiquidVolumes(s);
- RegisterJobBrushStopsColorSpaceChange();
+ RegisterJobBrushStopsEvents();
return s;
}
catch (Exception ex)
@@ -834,7 +835,7 @@ namespace Tango.PPC.Jobs.ViewModels
#region Brush Stops Management
- private void RegisterJobBrushStopsColorSpaceChange()
+ private void RegisterJobBrushStopsEvents()
{
if (Job != null)
{
@@ -842,6 +843,9 @@ namespace Tango.PPC.Jobs.ViewModels
{
stop.ColorSpaceChanged -= Stop_ColorSpaceChanged;
stop.ColorSpaceChanged += Stop_ColorSpaceChanged;
+
+ stop.ColorCatalogChanged -= Stop_ColorCatalogChanged;
+ stop.ColorCatalogChanged += Stop_ColorCatalogChanged;
}
}
}
@@ -854,6 +858,34 @@ namespace Tango.PPC.Jobs.ViewModels
DyeCommand.RaiseCanExecuteChanged();
}
+ private void Stop_ColorCatalogChanged(object sender, ColorCatalog catalog)
+ {
+ BrushStop stop = sender as BrushStop;
+
+ if (stop.ColorSpace != null && stop.BrushColorSpace == BL.Enumerations.ColorSpaces.Catalog)
+ {
+ if (stop.ColorCatalogsItem != null)
+ {
+ try
+ {
+ if (catalog != null && catalog.AllItemsOrdered.Count > 0)
+ {
+ stop.ColorCatalogsItem = catalog.GetClosestItem(stop.ColorCatalogsItem.Color);
+ }
+ else
+ {
+ stop.ColorCatalogsItem = null;
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error getting closest catalog color.");
+ stop.ColorCatalogsItem = null;
+ }
+ }
+ }
+ }
+
/// <summary>
/// Adds a new brush stop to the specified segment.
/// </summary>
@@ -863,7 +895,7 @@ namespace Tango.PPC.Jobs.ViewModels
LogManager.Log($"Adding new brush stop to segment {segment.SegmentIndex}.");
segment.AddBrushStop();
SetSegmentLiquidVolumes(segment);
- RegisterJobBrushStopsColorSpaceChange();
+ RegisterJobBrushStopsEvents();
}
/// <summary>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
index fe831587c..afbce995d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
@@ -537,7 +537,19 @@ namespace Tango.PPC.Jobs.ViewModels
if (colorProfile == null)
{
- job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 100);
+ var segment = job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 100);
+
+ try
+ {
+ if (vm.SelectedColorSpace == ColorSpaces.Catalog)
+ {
+ segment.BrushStops[0].ColorCatalogGuid = catalogVM.SelectedCatalog.Guid;
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error setting first segment brush stop color catalog guide.");
+ }
}
else
{
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
index 52abfc239..292a87bb9 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
@@ -131,6 +131,21 @@
</Table.Columns>
<TableRowGroup>
+
+ <TableRow>
+ <TableCell>
+ <Paragraph>
+ <TextBlock>Environment:</TextBlock>
+ </Paragraph>
+ </TableCell>
+
+ <TableCell>
+ <Paragraph>
+ <TextBlock Text="{Binding Settings.DeploymentSlot,Converter={StaticResource EnumToDescriptionConverter},Mode=OneWay,TargetNullValue='N/A',FallbackValue='N/A'}"/>
+ </Paragraph>
+ </TableCell>
+ </TableRow>
+
<TableRow>
<TableCell>
<Paragraph>