aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-12-28 00:50:47 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-12-28 00:50:47 +0200
commit028cca5fd51b4e5edb183e41e4e6831028a39e44 (patch)
treeeda1e3ac087073eaba532ddb3a977dd51cccd853 /Software/Visual_Studio
parentad969db71a39b4854d744412eb6482c0391a4dd9 (diff)
parent0fdbc932838bb6e007cfa8a0079d1880c800ed81 (diff)
downloadTango-028cca5fd51b4e5edb183e41e4e6831028a39e44.tar.gz
Tango-028cca5fd51b4e5edb183e41e4e6831028a39e44.zip
Merged Urgent-Color-Space Branch.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml31
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs12
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs169
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs10
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml515
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs9
-rw-r--r--Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs31
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs71
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/ColorCatalog.cs20
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsGroup.cs8
-rw-r--r--Software/Visual_Studio/Tango.BL/ExtensionMethods/ColorCatalogItemsExtensions.cs23
-rw-r--r--Software/Visual_Studio/Tango.BL/Tango.BL.csproj3
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs193
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Components/LazyBinding.cs160
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs18
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj3
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.xaml4
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml2
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml2
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs21
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml3
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentReplaceControl.cs188
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentReplaceControl.xaml15
-rw-r--r--Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj7
-rw-r--r--Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml1
26 files changed, 1031 insertions, 490 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml
index afe331145..bd0bbfd11 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml
@@ -3,11 +3,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL"
xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:local="clr-namespace:Tango.PPC.Jobs.Controls"
mc:Ignorable="d"
- d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=entities:Job, IsDesignTimeCreatable=False}" x:Name="control">
+ d:DesignHeight="60" d:DesignWidth="500" Height="38" x:Name="control">
<Grid>
<Grid.ColumnDefinitions>
@@ -20,7 +21,7 @@
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
- <ItemsControl ClipToBounds="False" ItemsSource="{Binding EffectiveSegments,IsAsync=True}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayMarkers,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <ItemsControl ClipToBounds="False" ItemsSource="{Binding ElementName=control,Path=Job.EffectiveSegments}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayMarkers,Converter={StaticResource BooleanToVisibilityConverter}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel>
@@ -31,15 +32,15 @@
<Grid x:Name="grid">
<Grid.Width>
<MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}">
- <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Length"></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="Job.Length"></Binding>
<Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding>
<Binding Path="LengthWithFactor"></Binding>
</MultiBinding>
</Grid.Width>
- <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSize}">
- <TextBlock.Style>
- <Style TargetType="TextBlock">
+ <DockPanel HorizontalAlignment="Center" TextElement.FontSize="{StaticResource TangoSmallFontSize}">
+ <DockPanel.Style>
+ <Style TargetType="DockPanel">
<Setter Property="Visibility" Value="Visible"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=grid,Path=ActualWidth,Converter={StaticResource SmallerThanToBooleanConverter},ConverterParameter=20}" Value="True">
@@ -47,9 +48,10 @@
</DataTrigger>
</Style.Triggers>
</Style>
- </TextBlock.Style>
- <Run Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0,IsAsync=True}"></Run><Run Text="m"></Run>
- </TextBlock>
+ </DockPanel.Style>
+ <controls:FastTextBlock Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0}" />
+ <controls:FastTextBlock Text="m" />
+ </DockPanel>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
@@ -66,11 +68,8 @@
</RectangleGeometry.Rect>
</RectangleGeometry>
</Border.Clip>
- <Border.Background>
- <ImageBrush ImageSource="../Images/JobView/transparent_small.jpg" Stretch="None" TileMode="Tile" AlignmentX="Left" ViewportUnits="Absolute" Viewport="0,0,94,30" />
- </Border.Background>
<Grid>
- <ItemsControl ClipToBounds="False" ItemsSource="{Binding EffectiveSegments,IsAsync=True}">
+ <ItemsControl ClipToBounds="False" ItemsSource="{Binding ElementName=control,Path=Job.EffectiveSegments}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel>
@@ -81,7 +80,7 @@
<Grid>
<Grid.Width>
<MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}">
- <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Length"></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="Job.Length"></Binding>
<Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding>
<Binding Path="LengthWithFactor"></Binding>
</MultiBinding>
@@ -104,7 +103,7 @@
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
- <Condition Binding="{Binding JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" />
+ <Condition Binding="{Binding ElementName=control,Path=Job.JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" />
<Condition Binding="{Binding ElementName=control,Path=IsActive}" Value="False" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Visible"></Setter>
@@ -114,7 +113,7 @@
</Grid.Style>
<TextBlock Margin="10 0 0 -2" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">
- <Run Text="x"></Run><Run Text="{Binding NumberOfUnits}"></Run>
+ <Run Text="x"></Run><Run Text="{Binding ElementName=control,Path=Job.NumberOfUnits}"></Run>
</TextBlock>
</Grid>
</Grid>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs
index 1c0b90f91..c977e71d0 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs
@@ -23,6 +23,18 @@ namespace Tango.PPC.Jobs.Controls
/// <seealso cref="System.Windows.Markup.IComponentConnector" />
public partial class JobSummeryViewer : UserControl
{
+
+ /// <summary>
+ /// Gets or sets the job.
+ /// </summary>
+ public Job Job
+ {
+ get { return (Job)GetValue(JobProperty); }
+ set { SetValue(JobProperty, value); }
+ }
+ public static readonly DependencyProperty JobProperty =
+ DependencyProperty.Register("Job", typeof(Job), typeof(JobSummeryViewer), new PropertyMetadata(null));
+
/// <summary>
/// Maybe not necessary!
/// </summary>
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 5e90d3b5b..cfac759dd 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
@@ -37,6 +37,7 @@ using Tango.PPC.Storage;
using System.IO;
using Tango.ColorConversion;
using Tango.Integration.Operation;
+using Tango.BL.Enumerations;
namespace Tango.PPC.Jobs.ViewModels
{
@@ -188,39 +189,16 @@ namespace Tango.PPC.Jobs.ViewModels
set { _isJobDetailsExpanded = value; RaisePropertyChangedAuto(); }
}
- private List<ColorCatalogsItem> _catalogItems;
- /// <summary>
- /// Gets or sets the twine catalog items.
- /// </summary>
- public List<ColorCatalogsItem> CatalogItems
- {
- get { return _catalogItems; }
- set { _catalogItems = value; RaisePropertyChangedAuto(); }
- }
-
- private ColorCatalogsItem _selectedCatalogItem;
- /// <summary>
- /// Gets or sets the selected catalog item.
- /// </summary>
- public ColorCatalogsItem SelectedCatalogItem
- {
- get { return _selectedCatalogItem; }
- set { _selectedCatalogItem = value; RaisePropertyChangedAuto(); }
- }
-
/// <summary>
/// Gets or sets the twine catalog automatic complete provider.
/// </summary>
public IAutoCompleteProvider CatalogAutoCompleteProvider { get; set; }
- private ColorCatalog _selectedCatalog;
- /// <summary>
- /// Gets or sets the selected catalog.
- /// </summary>
- public ColorCatalog SelectedCatalog
+ private List<ColorCatalog> _availableCatalogs;
+ public List<ColorCatalog> AvailableCatalogs
{
- get { return _selectedCatalog; }
- set { _selectedCatalog = value; RaisePropertyChangedAuto(); }
+ get { return _availableCatalogs; }
+ set { _availableCatalogs = value; RaisePropertyChangedAuto(); }
}
#endregion
@@ -362,7 +340,6 @@ namespace Tango.PPC.Jobs.ViewModels
FineTuneItems = new ObservableCollection<FineTuneItem>();
ApprovalFineTuneItems = new ObservableCollection<FineTuneItem>();
- CatalogItems = new List<ColorCatalogsItem>();
CustomersAutoCompleteProvider = new AutoCompleteProvider<Customer>((customer, filter) =>
{
@@ -445,6 +422,14 @@ namespace Tango.PPC.Jobs.ViewModels
if (_db != null)
{
+ if (Job != null)
+ {
+ foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).ToList())
+ {
+ stop.ColorSpaceChanged -= Stop_ColorSpaceChanged;
+ }
+ }
+
Rmls.ForEach(x => x.Cct = null);
Rmls = null;
_db.Dispose();
@@ -471,33 +456,17 @@ namespace Tango.PPC.Jobs.ViewModels
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();
LogManager.Log("Loading Color Spaces...");
- ColorSpaces = await _db.ColorSpaces.ToListAsync();
+ ColorSpaces = await _db.ColorSpaces.Where(x => x.Code != (int)BL.Enumerations.ColorSpaces.CMYK).ToListAsync();
LogManager.Log("Loading Spool Types...");
SpoolTypes = await _db.SpoolTypes.ToListAsync();
LogManager.Log("Loading Customers...");
Customers = await _db.Customers.Where(x => x.OrganizationGuid == MachineProvider.Machine.OrganizationGuid).ToListAsync();
- if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog)
- {
- SelectedCatalog = await new CatalogBuilder(_db).Set(Job.ColorCatalogGuid).WithGroups().WithItems().BuildAsync();
-
- if (SelectedCatalog != null)
- {
- CatalogItems = SelectedCatalog.ColorCatalogsGroups.SelectMany(x => x.ColorCatalogsItems).OrderBy(x => x.ItemIndex).ToList();
- }
- else
- {
- await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job.");
- Job = null;
- _can_navigate_back = true;
- await NavigationManager.NavigateBack();
- return;
- }
- }
+ AvailableCatalogs = await new CatalogsCollectionBuilder(_db).SetAll().WithGroups().WithItems().ForSite(MachineProvider.Machine.SiteGuid).BuildListAsync();
foreach (var segment in Job.Segments)
{
- SetSegmentLiquidVolumesIfVolume(segment);
+ SetSegmentLiquidVolumes(segment);
}
if (!_check_gamut_thread.IsAlive)
@@ -540,6 +509,8 @@ namespace Tango.PPC.Jobs.ViewModels
ValidateBrushStops();
+ CoerceBrushStopsColorSpaceChange();
+
DyeCommand.RaiseCanExecuteChanged();
StartSampleDyeCommand.RaiseCanExecuteChanged();
StartFineTuningCommand.RaiseCanExecuteChanged();
@@ -718,7 +689,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
LogManager.Log("Adding new solid segment...");
var s = Job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10);
- SetSegmentLiquidVolumesIfVolume(s);
+ SetSegmentLiquidVolumes(s);
+ CoerceBrushStopsColorSpaceChange();
return s;
}
catch (Exception ex)
@@ -738,7 +710,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
LogManager.Log("Adding new gradient segment...");
var s = Job.AddGradientSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10);
- SetSegmentLiquidVolumesIfVolume(s);
+ SetSegmentLiquidVolumes(s);
+ CoerceBrushStopsColorSpaceChange();
return s;
}
catch (Exception ex)
@@ -811,19 +784,16 @@ namespace Tango.PPC.Jobs.ViewModels
/// Sets the segment liquid volumes.
/// </summary>
/// <param name="segment">The segment.</param>
- private void SetSegmentLiquidVolumesIfVolume(Segment segment)
+ private void SetSegmentLiquidVolumes(Segment segment)
{
- if (Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.Volume.ToInt32())
+ foreach (var stop in segment.BrushStops)
{
- foreach (var stop in segment.BrushStops)
- {
- stop.SetLiquidVolumes(Job.Machine.Configuration, Job.Rml, Job.Rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault());
+ stop.SetLiquidVolumes(Job.Machine.Configuration, Job.Rml, Job.Rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault());
- var lub = stop.LiquidVolumes.FirstOrDefault(x => x.IdsPack.LiquidType.Code == (int)BL.Enumerations.LiquidTypes.Lubricant);
- if (lub != null)
- {
- lub.Volume = 100;
- }
+ var lub = stop.LiquidVolumes.FirstOrDefault(x => x.IdsPack.LiquidType.Code == (int)BL.Enumerations.LiquidTypes.Lubricant);
+ if (lub != null)
+ {
+ lub.Volume = 100;
}
}
}
@@ -844,6 +814,24 @@ namespace Tango.PPC.Jobs.ViewModels
#region Brush Stops Management
+ private void CoerceBrushStopsColorSpaceChange()
+ {
+ if (Job != null)
+ {
+ foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).ToList())
+ {
+ stop.ColorSpaceChanged -= Stop_ColorSpaceChanged;
+ stop.ColorSpaceChanged += Stop_ColorSpaceChanged;
+ }
+ }
+ }
+
+ private void Stop_ColorSpaceChanged(object sender, ColorSpace e)
+ {
+ BrushStop stop = sender as BrushStop;
+ stop.Segment.BrushStops.Where(x => x != stop).ToList().ForEach(x => x.ColorSpace = stop.ColorSpace);
+ }
+
/// <summary>
/// Adds a new brush stop to the specified segment.
/// </summary>
@@ -852,7 +840,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
LogManager.Log($"Adding new brush stop to segment {segment.SegmentIndex}.");
segment.AddBrushStop();
- SetSegmentLiquidVolumesIfVolume(segment);
+ SetSegmentLiquidVolumes(segment);
+ CoerceBrushStopsColorSpaceChange();
}
/// <summary>
@@ -987,34 +976,56 @@ namespace Tango.PPC.Jobs.ViewModels
{
if (stop != null && stop.ColorSpace != null)
{
- stop.Corrected = false;
- stop.OutOfGamutChecked = false;
+ if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.Catalog) return;
- if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume)
+ _volumeConversionTimer.ResetReplace(() =>
{
- _volumeConversionTimer.ResetReplace(() =>
+
+ try
{
- try
- {
- var output = _converter.Convert(stop, false);
+ var output = _converter.Convert(stop, false);
+ if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume)
+ {
stop.Red = output.SingleCoordinates.Red;
stop.Green = output.SingleCoordinates.Green;
stop.Blue = output.SingleCoordinates.Blue;
+ stop.L = output.SingleCoordinates.L;
+ stop.A = output.SingleCoordinates.A;
+ stop.B = output.SingleCoordinates.B;
stop.Corrected = true;
stop.IsOutOfGamut = false;
-
- InvokeUI(() =>
- {
- DyeCommand.RaiseCanExecuteChanged();
- });
}
- catch (Exception ex)
+ else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.LAB)
{
- LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine.");
+ output.ApplyOnBrushStopVolumesOnly(stop);
+ stop.Corrected = false;
+ stop.OutOfGamutChecked = false;
}
- });
- }
+ else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB)
+ {
+ output.ApplyOnBrushStopVolumesOnly(stop);
+ stop.Corrected = false;
+ stop.OutOfGamutChecked = false;
+ }
+
+ try
+ {
+ var closestItem = AvailableCatalogs.SelectMany(x => x.AllItemsOrdered).GetClosestItem(stop.Color);
+ stop.ColorCatalog = closestItem.ColorCatalogsGroup.ColorCatalog;
+ stop.ColorCatalogsItem = closestItem;
+ }
+ catch { }
+
+ InvokeUI(() => DyeCommand.RaiseCanExecuteChanged());
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine.");
+ }
+
+ });
+
}
}
@@ -1027,7 +1038,7 @@ namespace Tango.PPC.Jobs.ViewModels
var catalogItem = await NavigationManager.NavigateForResult<JobsModule, TwineCatalogView, ColorCatalogsItem, TwineCatalogNavigationObject>(new TwineCatalogNavigationObject()
{
SelectedItem = stop.ColorCatalogsItem,
- Catalog = SelectedCatalog
+ Catalog = stop.ColorCatalog
}, true);
if (catalogItem != null)
@@ -1298,9 +1309,9 @@ namespace Tango.PPC.Jobs.ViewModels
{
Thread.Sleep(500);
- if (Job != null && Job.Rml.Cct != null && IsVisible && (Job.ColorSpace != null && (Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32() || Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.LAB.ToInt32())))
+ if (Job != null && Job.Rml.Cct != null && IsVisible)
{
- var brushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.Corrected && !x.OutOfGamutChecked).ToList();
+ 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();
foreach (var stop in brushStops)
{
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 4ae98b1d0..6440f7e46 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
@@ -314,11 +314,11 @@ namespace Tango.PPC.Jobs.ViewModels
/// <param name="job">The job.</param>
public async void SelectJob(Job job, bool directlyToEdit = false)
{
- if (!ApplicationManager.IsInTechnicianMode && job.ColorSpace != null && job.ColorSpace.Code == ColorSpaces.Volume.ToInt32())
- {
- await NotificationProvider.ShowError("The selected job is supported only in technician mode.");
- return;
- }
+ //if (!ApplicationManager.IsInTechnicianMode && job.ColorSpace != null && job.ColorSpace.Code == ColorSpaces.Volume.ToInt32())
+ //{
+ // await NotificationProvider.ShowError("The selected job is supported only in technician mode.");
+ // return;
+ //}
LogManager.Log($"Job '{job.Name}' selected.");
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml
index 4785805a6..ddda98df9 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml
@@ -92,7 +92,7 @@
</UniformGrid>
</Grid>
- <controls:JobSummeryViewer Height="40" DataContext="{Binding Job}" VerticalAlignment="Center" Margin="20 0" Grid.Row="2" />
+ <controls:JobSummeryViewer Height="40" Job="{Binding Job}" VerticalAlignment="Center" Margin="20 0" Grid.Row="2" />
</Grid>
</DockPanel>
</Border>
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 6a94034db..c1472793a 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
@@ -51,7 +51,7 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border>
- <touch:TouchNumericTextBox DisplayWatermarkHint="True" Width="50" Watermark="{Binding IdsPack.LiquidType.Name,IsAsync=True}" Margin="2 0" ValueChanged="OnLiquidVolumeFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Volume}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="200" JoggingFactor="0.5" StringFormat="0.0" />
+ <touch:TouchNumericTextBox DisplayWatermarkHint="True" Width="50" Watermark="{Binding IdsPack.LiquidType.Name}" Margin="2 0" ValueChanged="OnLiquidVolumeFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Volume}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="200" JoggingFactor="0.5" StringFormat="0.0" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
@@ -65,33 +65,34 @@
<DataTemplate x:Key="RGB_Template" DataType="{x:Type entities:BrushStop}">
<UniformGrid Rows="1" Columns="3">
- <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Red}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" />
- <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Green}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" />
- <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Blue}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" />
+ <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Red}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" />
+ <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Green}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" />
+ <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Blue}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" />
</UniformGrid>
</DataTemplate>
<DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}">
<UniformGrid Rows="1" Columns="4">
- <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Cyan,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" />
- <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Magenta,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" />
- <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Yellow,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" />
- <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Black,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" />
+ <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Cyan,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" />
+ <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Magenta,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" />
+ <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Yellow,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" />
+ <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Black,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" />
</UniformGrid>
</DataTemplate>
<DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}">
<UniformGrid Rows="1" Columns="3">
- <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding L}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="100" StringFormat="0.00" />
- <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding A}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" />
- <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding B}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" />
+ <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding L}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="100" StringFormat="0.00" />
+ <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding A}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" />
+ <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding B}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" />
</UniformGrid>
</DataTemplate>
<DataTemplate x:Key="CATALOG_Template" DataType="{x:Type entities:BrushStop}">
- <DockPanel>
+ <DockPanel Margin="0 0 -90 0">
+ <touch:TouchComboBox DockPanel.Dock="Left" ItemsSource="{Binding ElementName=view,Path=DataContext.AvailableCatalogs}" SelectedItem="{Binding ColorCatalog}" DisplayMemberPath="Name" Title="Select Catalog" Width="130" Margin="0 0 10 0" />
<touch:TouchIconButton Margin="0 0 -50 -10" CornerRadius="50" Width="50" Height="50" Padding="13" RippleBrush="{StaticResource TangoRippleDarkBrush}" DockPanel.Dock="Right" Icon="Palette" Foreground="{StaticResource TangoPrimaryAccentBrush}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.OpenCatalogCommand}" CommandParameter="{Binding}"></touch:TouchIconButton>
- <touch:TouchAutoComplete Margin="2 0" ItemsSource="{Binding ElementName=view,Path=DataContext.CatalogItems}" Watermark="Color Code" PopupHeight="250" DisplayMemberPath="Name" AutoCompleteProvider="{Binding ElementName=view,Path=DataContext.CatalogAutoCompleteProvider}" SelectedItem="{Binding ColorCatalogsItem,Mode=TwoWay,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" keyboard:KeyboardView.Container="{Binding ElementName=Container}">
+ <touch:TouchAutoComplete Margin="2 0" ItemsSource="{Binding ColorCatalog.AllItemsOrdered}" Watermark="Color Code" PopupHeight="250" DisplayMemberPath="Name" AutoCompleteProvider="{Binding ElementName=view,Path=DataContext.CatalogAutoCompleteProvider}" SelectedItem="{Binding ColorCatalogsItem,Mode=TwoWay,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" keyboard:KeyboardView.Container="{Binding ElementName=Container}">
<touch:TouchAutoComplete.ItemTemplate>
<DataTemplate>
<DockPanel Margin="2">
@@ -117,11 +118,11 @@
<Style TargetType="Border">
<Setter Property="Background">
<Setter.Value>
- <SolidColorBrush Color="{Binding Color,IsAsync=True}" />
+ <SolidColorBrush Color="{Binding Color}" />
</Setter.Value>
</Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True" >
+ <DataTrigger Binding="{Binding IsTransparent}" Value="True" >
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="{StaticResource Image_TransparentSmall}" Stretch="None" />
@@ -149,44 +150,33 @@
</Setter.Value>
</Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="RGB">
+ <DataTrigger Binding="{Binding ColorSpace.Name}" Value="RGB">
<Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" />
</DataTrigger>
- <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="CMYK">
+ <DataTrigger Binding="{Binding ColorSpace.Name}" Value="CMYK">
<Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" />
</DataTrigger>
- <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="LAB">
+ <DataTrigger Binding="{Binding ColorSpace.Name}" Value="LAB">
<Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" />
</DataTrigger>
- <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Catalog">
+ <DataTrigger Binding="{Binding ColorSpace.Name}" Value="Catalog">
<Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" />
</DataTrigger>
- <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume">
+ <DataTrigger Binding="{Binding ColorSpace.Name}" Value="Volume">
<Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" />
</DataTrigger>
- <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True">
- <Setter Property="ContentTemplate">
- <Setter.Value>
- <DataTemplate>
- <Grid Height="40">
- <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayBrush}">Transparent</TextBlock>
- </Grid>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- </DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</DockPanel>
- <Canvas Visibility="{Binding IsOutOfGamut,IsAsync=True,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <Canvas Visibility="{Binding IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter}}">
<TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock>
</Canvas>
<DockPanel LastChildFill="False" Margin="0 20 0 0" IsEnabled="{Binding IsMiddle}">
- <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left">Position (m):</TextBlock>
+ <controls:FastTextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left">Position (m):</controls:FastTextBlock>
<Grid Margin="20 0 0 0" Width="300" DockPanel.Dock="Right">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
@@ -200,280 +190,271 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0 0 -130 0" HorizontalAlignment="Right" VerticalAlignment="Top">
- <StackPanel Orientation="Horizontal" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,IsAsync=True,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
- <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding IsTransparent,IsAsync=True}"></touch:TouchToggleIconButton>-->
- <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand,IsAsync=True}" CommandParameter="{Binding}" Visibility="{Binding ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},IsAsync=True}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton>
+ <StackPanel Orientation="Horizontal" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
+ <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding IsTransparent}"></touch:TouchToggleIconButton>-->
+ <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding}" Visibility="{Binding ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter}}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton>
</StackPanel>
- <touch:TouchIconButton Margin="0 0 50 0" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" Command="{Binding ElementName=view,Path=DataContext.RemoveBrushStopCommand,IsAsync=True}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" />
+ <touch:TouchIconButton Margin="0 0 50 0" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" Command="{Binding ElementName=view,Path=DataContext.RemoveBrushStopCommand}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" />
</StackPanel>
</Grid>
</DataTemplate>
<DataTemplate x:Key="Segment_Template" DataType="{x:Type entities:Segment}">
- <touch:TouchVirtualizedContentControl Margin="0 0 0 15">
- <Border RenderOptions.EdgeMode="Unspecified" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}">
- <Border.CacheMode>
- <BitmapCache RenderAtScale="1" SnapsToDevicePixels="True" />
- </Border.CacheMode>
- <!--<Border.Effect>
- <DropShadowEffect Opacity="0.5" Color="{StaticResource TangoDropShadowColor}" BlurRadius="10" ShadowDepth="15" />
- </Border.Effect>-->
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Grid Background="Transparent" dragAndDrop:DragAndDropService.DropCommand="{Binding ElementName=view,Path=DataContext.SegmentDroppedCommand}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.Droppable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding ElementName=DraggingSurface}">
- <Grid.Style>
- <Style TargetType="Grid">
- <Setter Property="Opacity" Value="1"></Setter>
- <Style.Triggers>
- <Trigger Property="dragAndDrop:DragAndDropService.IsDraggableOver" Value="True">
- <Setter Property="Opacity" Value="0.5"></Setter>
- </Trigger>
- </Style.Triggers>
- </Style>
- </Grid.Style>
- <DockPanel>
- <DockPanel.Style>
- <Style TargetType="DockPanel">
- <Setter Property="Height" Value="163"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True">
- <Setter Property="Height" Value="74"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </DockPanel.Style>
-
- <Border DockPanel.Dock="Left" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}">
- <Border.Background>
- <ImageBrush ImageSource="{StaticResource Image_Transparent}" Stretch="None" />
- </Border.Background>
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="CornerRadius" Value="8 0 0 8"></Setter>
- <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,IsAsync=True}"></Setter>
+ <touch:TouchVirtualizedContentReplaceControl Margin="0 0 0 15" MinHeight="165" Disconnect="False">
+ <touch:TouchVirtualizedContentReplaceControl.Content>
+ <DataTemplate>
+ <Border RenderOptions.EdgeMode="Unspecified" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Grid Background="Transparent" dragAndDrop:DragAndDropService.DropCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SegmentDroppedCommand}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.Droppable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding ElementName=DraggingSurface}">
+ <Grid.Style>
+ <Style TargetType="Grid">
+ <Setter Property="Opacity" Value="1"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True">
- <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2',IsAsync=True}"></Setter>
- </DataTrigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition>
- <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition>
- </MultiDataTrigger.Conditions>
- <Setter Property="CornerRadius" Value="8 0 0 0"></Setter>
- </MultiDataTrigger>
+ <Trigger Property="dragAndDrop:DragAndDropService.IsDraggableOver" Value="True">
+ <Setter Property="Opacity" Value="0.5"></Setter>
+ </Trigger>
</Style.Triggers>
</Style>
- </Border.Style>
- <Border Background="{Binding SegmentBrush}">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="CornerRadius" Value="8 0 0 8"></Setter>
- <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,IsAsync=True}"></Setter>
+ </Grid.Style>
+ <DockPanel>
+ <DockPanel.Style>
+ <Style TargetType="DockPanel">
+ <Setter Property="Height" Value="163"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True">
- <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2',IsAsync=True}"></Setter>
+ <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True">
+ <Setter Property="Height" Value="74"></Setter>
</DataTrigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition>
- <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition>
- </MultiDataTrigger.Conditions>
- <Setter Property="CornerRadius" Value="8 0 0 0"></Setter>
- </MultiDataTrigger>
</Style.Triggers>
</Style>
- </Border.Style>
- </Border>
- </Border>
+ </DockPanel.Style>
- <Grid>
- <DockPanel Margin="30 0" VerticalAlignment="Center">
- <StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
- <Canvas Visibility="{Binding HasOutOfGamutBrushStop,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}">
- <Image Canvas.Left="-25" Canvas.Top="1" Source="{StaticResource Image_Out_Of_Gamut}" Width="19" Height="19" />
- </Canvas>
- <TextBlock FontSize="{StaticResource TangoTitleFontSize}">
- <Run>Segment #</Run>
- <Run Text="{Binding SegmentIndex,Mode=OneWay,IsAsync=True}"></Run>
- </TextBlock>
- </StackPanel>
+ <Border DockPanel.Dock="Left" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}">
+ <!--<Border.Background>
+ <ImageBrush ImageSource="{StaticResource Image_Transparent}" Stretch="None" />
+ </Border.Background>-->
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="CornerRadius" Value="8 0 0 8"></Setter>
+ <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True">
+ <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2'}"></Setter>
+ </DataTrigger>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="True"></Condition>
+ <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked}" Value="True"></Condition>
+ </MultiDataTrigger.Conditions>
+ <Setter Property="CornerRadius" Value="8 0 0 0"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <Border Background="{Binding SegmentBrush}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="CornerRadius" Value="8 0 0 8"></Setter>
+ <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True">
+ <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2'}"></Setter>
+ </DataTrigger>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="True"></Condition>
+ <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked}" Value="True"></Condition>
+ </MultiDataTrigger.Conditions>
+ <Setter Property="CornerRadius" Value="8 0 0 0"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ </Border>
+ </Border>
<Grid>
- <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}">
- <DockPanel LastChildFill="False">
- <DockPanel.Style>
- <Style TargetType="DockPanel">
- <Setter Property="Visibility" Value="Visible"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True">
- <Setter Property="Visibility" Value="Collapsed"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </DockPanel.Style>
- <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Color code:"></TextBlock>
+ <DockPanel Margin="30 0" VerticalAlignment="Center">
+ <StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
+ <Canvas Visibility="{Binding HasOutOfGamutBrushStop,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <Image Canvas.Left="-25" Canvas.Top="1" Source="{StaticResource Image_Out_Of_Gamut}" Width="19" Height="19" />
+ </Canvas>
+ <DockPanel>
+ <controls:FastTextBlock FontSize="{StaticResource TangoTitleFontSize}">Segment #</controls:FastTextBlock>
+ <controls:FastTextBlock FontSize="{StaticResource TangoTitleFontSize}" Text="{Binding SegmentIndex,Mode=OneWay}"></controls:FastTextBlock>
+ </DockPanel>
+ </StackPanel>
- <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0],IsAsync=True}">
- <StackPanel>
- <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180">
- <ContentControl.Style>
- <Style TargetType="ContentControl">
- <Setter Property="ContentTemplate">
- <Setter.Value>
- <DataTemplate>
+ <Grid>
+ <StackPanel Margin="0 5 0 0" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <DockPanel LastChildFill="False" Margin="0 0 0 0">
+ <controls:FastTextBlock Text="Color space:" VerticalAlignment="Bottom"></controls:FastTextBlock>
+ <touch:TouchComboBox DockPanel.Dock="Right" ItemsSource="{Binding ElementName=view,Path=DataContext.ColorSpaces}" SelectedItem="{Binding BrushStops[0].ColorSpace}" DisplayMemberPath="Name" Title="Select Color Space" Width="179" HorizontalAlignment="Right" />
+ </DockPanel>
+ <DockPanel LastChildFill="False" Margin="0 5 0 0">
+ <DockPanel.Style>
+ <Style TargetType="DockPanel">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="True">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </DockPanel.Style>
+ <controls:FastTextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Color code:"></controls:FastTextBlock>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="RGB">
- <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="CMYK">
- <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="LAB">
- <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Catalog">
- <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume">
- <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True">
+ <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0]}">
+ <StackPanel>
+ <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180">
+ <ContentControl.Style>
+ <Style TargetType="ContentControl">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
- <Grid Height="40">
- <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayBrush}">Transparent</TextBlock>
- </Grid>
+
</DataTemplate>
</Setter.Value>
</Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ContentControl.Style>
- </ContentControl>
- </StackPanel>
- </Grid>
- </DockPanel>
- <Canvas>
- <Canvas.Style>
- <Style TargetType="Canvas">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding ColorSpace.Name}" Value="RGB">
+ <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding ColorSpace.Name}" Value="CMYK">
+ <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding ColorSpace.Name}" Value="LAB">
+ <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding ColorSpace.Name}" Value="Catalog">
+ <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding ColorSpace.Name}" Value="Volume">
+ <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </ContentControl.Style>
+ </ContentControl>
+ </StackPanel>
+ </Grid>
+ </DockPanel>
+ <Canvas>
+ <Canvas.Style>
+ <Style TargetType="Canvas">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="False" />
+ <Condition Binding="{Binding BrushStops[0].IsOutOfGamut}" Value="True" />
+ </MultiDataTrigger.Conditions>
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Canvas.Style>
+ <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock>
+ </Canvas>
+ <DockPanel LastChildFill="False" Margin="0 0 0 0">
+ <controls:FastTextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):"></controls:FastTextBlock>
+ <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" />
+ </DockPanel>
+ </StackPanel>
+ </Grid>
+ </DockPanel>
+
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 10 10 0">
+ <TextBlock Visibility="{Binding ElementName=toggle_small_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Length,StringFormat={}{0:N1} m}">
+ <TextBlock.Style>
+ <Style TargetType="TextBlock">
+ <Setter Property="Margin" Value="0 16 20 0"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding ElementName=toggleEdit,Path=IsChecked}" Value="True">
+ <Setter Property="Margin" Value="0 5 20 0"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBlock.Style>
+ </TextBlock>
+
+ <StackPanel Orientation="Horizontal">
+ <StackPanel.Style>
+ <Style TargetType="StackPanel">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
- <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" />
- <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" />
+ <Condition Binding="{Binding ElementName=toggleEdit,Path=IsChecked}" Value="False" />
+ <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked}" Value="True" />
+ <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="False" />
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Visible"></Setter>
</MultiDataTrigger>
</Style.Triggers>
</Style>
- </Canvas.Style>
- <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock>
- </Canvas>
- <DockPanel LastChildFill="False" Margin="0 20 0 0">
- <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):"></TextBlock>
- <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" />
- </DockPanel>
- </StackPanel>
- </Grid>
- </DockPanel>
-
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 10 10 0">
- <TextBlock Visibility="{Binding ElementName=toggle_small_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Length,StringFormat={}{0:N1} m}">
- <TextBlock.Style>
- <Style TargetType="TextBlock">
- <Setter Property="Margin" Value="0 16 20 0"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=toggleEdit,Path=IsChecked}" Value="True">
- <Setter Property="Margin" Value="0 5 20 0"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </TextBlock.Style>
- </TextBlock>
-
- <StackPanel Orientation="Horizontal">
- <StackPanel.Style>
- <Style TargetType="StackPanel">
- <Setter Property="Visibility" Value="Collapsed"></Setter>
- <Style.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding ElementName=toggleEdit,Path=IsChecked,IsAsync=True}" Value="False" />
- <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True" />
- <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" />
- </MultiDataTrigger.Conditions>
- <Setter Property="Visibility" Value="Visible"></Setter>
- </MultiDataTrigger>
- </Style.Triggers>
- </Style>
- </StackPanel.Style>
+ </StackPanel.Style>
- <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding BrushStops[0].IsTransparent,IsAsync=True}"></touch:TouchToggleIconButton>-->
+ <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding BrushStops[0].IsTransparent}"></touch:TouchToggleIconButton>-->
- <touch:TouchImageButton Visibility="{Binding BrushStops[0].ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},IsAsync=True}" Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton>
- </StackPanel>
+ <touch:TouchImageButton Visibility="{Binding BrushStops[0].ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter}}" Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton>
+ </StackPanel>
- <StackPanel Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" Orientation="Horizontal">
+ <StackPanel Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" Orientation="Horizontal">
- <touch:TouchIconButton Command="{Binding ElementName=view,Path=DataContext.RemoveSegmentCommand}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" />
+ <touch:TouchIconButton Command="{Binding ElementName=view,Path=DataContext.RemoveSegmentCommand}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" />
- <dragAndDrop:DragThumb Background="Transparent" IsHitTestVisible="True">
- <touch:TouchIconButton IsHitTestVisible="False" EnableDropShadow="False" Icon="BarsSolid" Padding="15" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" />
- </dragAndDrop:DragThumb>
- </StackPanel>
- </StackPanel>
+ <dragAndDrop:DragThumb Background="Transparent" IsHitTestVisible="True">
+ <touch:TouchIconButton IsHitTestVisible="False" EnableDropShadow="False" Icon="BarsSolid" Padding="15" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" />
+ </dragAndDrop:DragThumb>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+ </DockPanel>
</Grid>
- </DockPanel>
- </Grid>
- <Border Grid.Row="1" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0 1 0 0">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Visibility" Value="Collapsed"></Setter>
- <Style.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition>
- <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition>
- </MultiDataTrigger.Conditions>
+ <Border Grid.Row="1" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0 1 0 0">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="True"></Condition>
+ <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked}" Value="True"></Condition>
+ </MultiDataTrigger.Conditions>
- <Setter Property="Visibility" Value="Visible"></Setter>
- </MultiDataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
- <StackPanel>
- <ItemsControl ItemsSource="{Binding BrushStops}" ItemTemplate="{StaticResource BrushStop_Template}">
+ <StackPanel>
+ <ItemsControl ItemsSource="{Binding BrushStops}" ItemTemplate="{StaticResource BrushStop_Template}">
- </ItemsControl>
+ </ItemsControl>
- <touch:TouchButton Command="{Binding ElementName=view,Path=DataContext.AddBrushStopCommand}" CommandParameter="{Binding}" Background="Transparent" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontWeight="Normal" Foreground="{StaticResource TangoPrimaryAccentBrush}" HorizontalAlignment="Left" EnableDropShadow="False" Margin="50 30 0 60">
- <StackPanel Orientation="Horizontal">
- <Grid Width="49" Height="49">
- <Rectangle Stroke="{StaticResource TangoPrimaryAccentBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="5" RadiusY="5"></Rectangle>
- <fa:ImageAwesome Icon="Plus" Width="16" Height="16" Foreground="{StaticResource TangoPrimaryAccentBrush}" />
- </Grid>
+ <touch:TouchButton Command="{Binding ElementName=view,Path=DataContext.AddBrushStopCommand}" CommandParameter="{Binding}" Background="Transparent" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontWeight="Normal" Foreground="{StaticResource TangoPrimaryAccentBrush}" HorizontalAlignment="Left" EnableDropShadow="False" Margin="50 30 0 60">
+ <StackPanel Orientation="Horizontal">
+ <Grid Width="49" Height="49">
+ <Rectangle Stroke="{StaticResource TangoPrimaryAccentBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="5" RadiusY="5"></Rectangle>
+ <fa:ImageAwesome Icon="Plus" Width="16" Height="16" Foreground="{StaticResource TangoPrimaryAccentBrush}" />
+ </Grid>
- <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">ADD COLOR</TextBlock>
+ <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">ADD COLOR</TextBlock>
+ </StackPanel>
+ </touch:TouchButton>
</StackPanel>
- </touch:TouchButton>
- </StackPanel>
+ </Border>
+ </Grid>
</Border>
- </Grid>
- </Border>
- </touch:TouchVirtualizedContentControl>
+ </DataTemplate>
+ </touch:TouchVirtualizedContentReplaceControl.Content>
+ </touch:TouchVirtualizedContentReplaceControl>
</DataTemplate>
</UserControl.Resources>
@@ -485,11 +466,6 @@
<touch:TouchLoadingPanel Grid.Row="1" IsLoading="{Binding IsBusy}">
<Grid>
-
- <Grid.CacheMode>
- <BitmapCache RenderAtScale="1" SnapsToDevicePixels="False" />
- </Grid.CacheMode>
-
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
@@ -507,8 +483,7 @@
<TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Details</TextBlock>
<TextBlock FontWeight="Medium" Margin="50 0 0 0" VerticalAlignment="Center">
- <Run Text="{Binding Job.Rml.Name}"></Run><Run>,</Run>
- <Run Text="{Binding Job.ColorSpace.Name}"></Run>
+ <Run Text="{Binding Job.Rml.Name}"></Run>
</TextBlock>
</StackPanel>
</touch:TouchExpander.Header>
@@ -727,7 +702,11 @@
<StackPanel Style="{StaticResource Level2ContainerExtraMargin}">
<Grid>
- <localControls:JobSummeryViewer DataContext="{Binding Job,IsAsync=True}" Height="40"/>
+ <touch:TouchVirtualizedContentReplaceControl MinHeight="40">
+ <DataTemplate>
+ <localControls:JobSummeryViewer Job="{Binding Job}" Height="40" DisplayMarkers="False" />
+ </DataTemplate>
+ </touch:TouchVirtualizedContentReplaceControl>
</Grid>
<DockPanel Margin="0 30 0 0" LastChildFill="False">
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
index 1f2895f26..b3fcd1208 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
@@ -58,14 +58,23 @@ namespace Tango.PPC.UI.Printing
#else
try
{
+ _notificationProvider.SetGlobalBusyMessage("Processing job...");
handler = await _machineProvider.MachineOperator.Print(job);
+ _notificationProvider.ReleaseGlobalBusyMessage();
}
catch (InsufficientLiquidQuantityException ex)
{
+ _notificationProvider.ReleaseGlobalBusyMessage();
LogManager.Log(ex);
await _notificationProvider.ShowDialog(new InsufficientLiquidQuantityViewVM(ex));
throw ex;
}
+ catch (Exception ex)
+ {
+ _notificationProvider.ReleaseGlobalBusyMessage();
+ LogManager.Log(ex);
+ throw ex;
+ }
#endif
handler.Completed += async (x, e) =>
diff --git a/Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs b/Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs
index fb690eb99..dd9e9a54c 100644
--- a/Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs
+++ b/Software/Visual_Studio/Tango.BL/Builders/CatalogsCollectionBuilder.cs
@@ -37,5 +37,36 @@ namespace Tango.BL.Builders
}
});
}
+
+ public virtual CatalogsCollectionBuilder WithGroups()
+ {
+ return AddQueryStep(2, (query) =>
+ {
+ return query.Include(x => x.ColorCatalogsGroups);
+ });
+ }
+
+ public virtual CatalogsCollectionBuilder WithItems()
+ {
+ return AddQueryStep(3, (query) =>
+ {
+ return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems));
+ });
+ }
+
+ public virtual CatalogsCollectionBuilder WithRecipes(Rml rml = null)
+ {
+ return AddQueryStep(4, (query) =>
+ {
+ if (rml != null)
+ {
+ return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems.Select(z => z.ColorCatalogsItemsRecipes.Where(r => r.RmlGuid == rml.Guid))));
+ }
+ else
+ {
+ return query.Include(x => x.ColorCatalogsGroups.Select(y => y.ColorCatalogsItems.Select(z => z.ColorCatalogsItemsRecipes)));
+ }
+ });
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs
index 4ad21d4cd..9f47aca05 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/BrushStop.cs
@@ -164,7 +164,24 @@ namespace Tango.BL.Entities
[JsonIgnore]
public Color Color
{
- get { return Color.FromRgb((byte)_red, (byte)_green, (byte)_blue); }
+ get
+ {
+ if (ColorSpace != null && BrushColorSpace == ColorSpaces.Catalog)
+ {
+ if (ColorCatalogsItem != null)
+ {
+ return Color.FromRgb((byte)ColorCatalogsItem.Red, (byte)ColorCatalogsItem.Green, (byte)ColorCatalogsItem.Blue);
+ }
+ else
+ {
+ return Colors.White;
+ }
+ }
+ else
+ {
+ return Color.FromRgb((byte)_red, (byte)_green, (byte)_blue);
+ }
+ }
set
{
Rgb rgb = new Rgb(value.R, value.G, value.B);
@@ -555,12 +572,6 @@ namespace Tango.BL.Entities
Rgb rgb = new Rgb(Red, Green, Blue);
Cmyk cmyk = new Cmyk(Cyan, Magenta, Yellow, Black);
Lab lab = new Lab(L, A, B);
- Rgb rgb_catalog = new Rgb(255, 255, 255);
-
- if (ColorCatalogsItem != null)
- {
- rgb_catalog = new Rgb(ColorCatalogsItem.Red, ColorCatalogsItem.Green, ColorCatalogsItem.Blue);
- }
switch ((ColorSpaces)ColorSpace.Code)
{
@@ -577,9 +588,35 @@ namespace Tango.BL.Entities
cmyk = lab.To<Cmyk>();
break;
case ColorSpaces.Catalog:
- cmyk = rgb_catalog.To<Cmyk>();
- lab = rgb_catalog.To<Lab>();
- rgb = rgb_catalog;
+
+ if (ColorCatalogsItem != null)
+ {
+ rgb = new Rgb(ColorCatalogsItem.Red, ColorCatalogsItem.Green, ColorCatalogsItem.Blue);
+ lab = new Lab(ColorCatalogsItem.L, ColorCatalogsItem.A, ColorCatalogsItem.B);
+ cmyk = new Cmyk(ColorCatalogsItem.Cyan, ColorCatalogsItem.Magenta, ColorCatalogsItem.Yellow, ColorCatalogsItem.Black);
+
+ try
+ {
+ if (LiquidVolumes != null)
+ {
+ var cyan = LiquidVolumes.FirstOrDefault(x => x.LiquidType == LiquidTypes.Cyan);
+ if (cyan != null) cyan.Volume = ColorCatalogsItem.Cyan;
+
+ var magenta = LiquidVolumes.FirstOrDefault(x => x.LiquidType == LiquidTypes.Magenta);
+ if (magenta != null) magenta.Volume = ColorCatalogsItem.Magenta;
+
+ var yellow = LiquidVolumes.FirstOrDefault(x => x.LiquidType == LiquidTypes.Yellow);
+ if (yellow != null) yellow.Volume = ColorCatalogsItem.Yellow;
+
+ var black = LiquidVolumes.FirstOrDefault(x => x.LiquidType == LiquidTypes.Black);
+ if (black != null) black.Volume = ColorCatalogsItem.Black;
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex);
+ }
+ }
Validate(null);
break;
}
@@ -722,6 +759,12 @@ namespace Tango.BL.Entities
Corrected = false;
IsOutOfGamut = false;
}
+
+ _ignorePropChanged = true;
+ RaisePropertyChanged(nameof(Color));
+ RaisePropertyChanged(nameof(Brush));
+ Segment?.RaiseSegmentBrushChanged();
+ _ignorePropChanged = false;
}
#endregion
@@ -770,10 +813,10 @@ namespace Tango.BL.Entities
{
base.OnValidating(context);
- if (BrushColorSpace == ColorSpaces.Catalog && ColorCatalogsItem == null)
- {
- InsertError(nameof(ColorCatalogsItem), "Please specify a color code.");
- }
+ //if (BrushColorSpace == ColorSpaces.Catalog && ColorCatalogsItem == null)
+ //{
+ // InsertError(nameof(ColorCatalogsItem), "Please specify a color code.");
+ //}
}
#endregion
diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalog.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalog.cs
index 82b88f156..9972a0c2d 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalog.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalog.cs
@@ -34,5 +34,25 @@ namespace Tango.BL.Entities
{
get { return ColorCatalogsGroups.OrderBy(x => x.GroupIndex).ToObservableCollection(); }
}
+
+ [JsonIgnore]
+ [NotMapped]
+ public List<ColorCatalogsItem> AllItemsOrdered
+ {
+ get { return ColorCatalogsGroupsOrdered.SelectMany(x => x.ColorCatalogsItemsOrdered).ToList(); }
+ }
+
+ public ColorCatalogsItem GetClosestItem(Color color)
+ {
+ var minDiff = AllItemsOrdered.Select(x => x.Color).Select(n => ColorDiff(n, color)).Min(n => n);
+ return AllItemsOrdered.FirstOrDefault(n => ColorDiff(n.Color, color) == minDiff);
+ }
+
+ private int ColorDiff(Color c1, Color c2)
+ {
+ return (int)Math.Sqrt((c1.R - c2.R) * (c1.R - c2.R)
+ + (c1.G - c2.G) * (c1.G - c2.G)
+ + (c1.B - c2.B) * (c1.B - c2.B));
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsGroup.cs b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsGroup.cs
index 17f6115d1..86d82c634 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsGroup.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/ColorCatalogsGroup.cs
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
@@ -31,6 +32,13 @@ namespace Tango.BL.Entities
}
}
+ [JsonIgnore]
+ [NotMapped]
+ public ObservableCollection<ColorCatalogsItem> ColorCatalogsItemsOrdered
+ {
+ get { return ColorCatalogsItems.OrderBy(x => x.ItemIndex).ToObservableCollection(); }
+ }
+
public override void Delete(ObservablesContext context)
{
base.Delete(context);
diff --git a/Software/Visual_Studio/Tango.BL/ExtensionMethods/ColorCatalogItemsExtensions.cs b/Software/Visual_Studio/Tango.BL/ExtensionMethods/ColorCatalogItemsExtensions.cs
new file mode 100644
index 000000000..2a548371e
--- /dev/null
+++ b/Software/Visual_Studio/Tango.BL/ExtensionMethods/ColorCatalogItemsExtensions.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using Tango.BL.Entities;
+
+public static class ColorCatalogItemsExtensions
+{
+ public static ColorCatalogsItem GetClosestItem(this IEnumerable<ColorCatalogsItem> items, Color color)
+ {
+ var minDiff = items.Select(x => x.Color).Select(n => ColorDiff(n, color)).Min(n => n);
+ return items.FirstOrDefault(n => ColorDiff(n.Color, color) == minDiff);
+ }
+
+ private static int ColorDiff(Color c1, Color c2)
+ {
+ return (int)Math.Sqrt((c1.R - c2.R) * (c1.R - c2.R)
+ + (c1.G - c2.G) * (c1.G - c2.G)
+ + (c1.B - c2.B) * (c1.B - c2.B));
+ }
+}
diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj
index dc817af6e..0fbf6c5ab 100644
--- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj
+++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj
@@ -427,6 +427,7 @@
<Compile Include="Enumerations\PublishedProcedureProjectVisibilities.cs" />
<Compile Include="Enumerations\TangoUpdateStatuses.cs" />
<Compile Include="Enumerations\RmlQualifications.cs" />
+ <Compile Include="ExtensionMethods\ColorCatalogItemsExtensions.cs" />
<Compile Include="IObservableEntityDTO.cs" />
<Compile Include="ObservableDTOPropertyAttribute.cs" />
<Compile Include="ObservableEntityDTO.cs" />
@@ -645,7 +646,7 @@
</Target>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index bce386bfe..ada7a4b73 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -2408,150 +2408,153 @@ namespace Tango.Integration.Operation
/// </summary>
/// <param name="job">The job.</param>
/// <returns></returns>
- public Task<JobHandler> Print(Job job)
+ public async Task<JobHandler> Print(Job job)
{
- IColorConverter converter = new DefaultColorConverter();
-
- var jobSegments = job.OrderedSegments;
+ ProcessParametersTable processParameters = null;
- if (job.Rml == null)
+ await Task.Factory.StartNew(() =>
{
- throw new NullReferenceException("Job RML is null");
- }
+ IColorConverter converter = new DefaultColorConverter();
- var processGroup = job.Rml.ProcessParametersTablesGroups.FirstOrDefault(x => x.Active);
+ var jobSegments = job.OrderedSegments;
- if (processGroup == null)
- {
- throw new NullReferenceException("Could not locate an active process parameters tables group for RML " + job.Rml.Name);
- }
+ if (job.Rml == null)
+ {
+ throw new NullReferenceException("Job RML is null");
+ }
- ProcessParametersTable processParameters = null;
+ var processGroup = job.Rml.ProcessParametersTablesGroups.FirstOrDefault(x => x.Active);
- try
- {
- processParameters = converter.GetRecommendedProcessParameters(job);
- }
- catch (Exception ex)
- {
- throw LogManager.Log(new InvalidOperationException($"An error occurred while trying to resolve the recommended process parameters.\n{ex.Message}"));
- }
+ if (processGroup == null)
+ {
+ throw new NullReferenceException("Could not locate an active process parameters tables group for RML " + job.Rml.Name);
+ }
- if (processParameters == null)
- {
- throw new NullReferenceException("Could not locate any process parameters table in group " + processGroup.Name + " for RML " + job.Rml.Name);
- }
+ try
+ {
+ processParameters = converter.GetRecommendedProcessParameters(job);
+ }
+ catch (Exception ex)
+ {
+ throw LogManager.Log(new InvalidOperationException($"An error occurred while trying to resolve the recommended process parameters.\n{ex.Message}"));
+ }
- //Perform color correction
- foreach (var stop in jobSegments.SelectMany(x => x.BrushStops))
- {
- //if (stop.LiquidVolumes == null || stop.BrushColorSpace == ColorSpaces.Volume)
- //{
- if (stop.BrushColorSpace == ColorSpaces.RGB || stop.BrushColorSpace == ColorSpaces.LAB)
+ if (processParameters == null)
{
- var output = converter.Convert(stop, false);
+ throw new NullReferenceException("Could not locate any process parameters table in group " + processGroup.Name + " for RML " + job.Rml.Name);
+ }
- //TODO: Restore this when Mirta conversion is working as expected.
- //if (suggestions.OutOfGamut)
+ //Perform color correction
+ foreach (var stop in jobSegments.SelectMany(x => x.BrushStops))
+ {
+ //if (stop.LiquidVolumes == null || stop.BrushColorSpace == ColorSpaces.Volume)
//{
- // throw new InvalidOperationException("Cannot print a brush stop which is out of gamut.");
- //}
-
- stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
-
- foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids)
+ if (stop.BrushColorSpace == ColorSpaces.RGB || stop.BrushColorSpace == ColorSpaces.LAB)
{
- var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == outputLiquid.LiquidType.ToInt32());
+ var output = converter.Convert(stop, false);
- if (liquidVolume == null)
- {
- throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + outputLiquid.LiquidType + "'.");
- }
+ //TODO: Restore this when Mirta conversion is working as expected.
+ //if (suggestions.OutOfGamut)
+ //{
+ // throw new InvalidOperationException("Cannot print a brush stop which is out of gamut.");
+ //}
- liquidVolume.Volume = outputLiquid.Volume;
- }
- }
- else if (stop.BrushColorSpace == ColorSpaces.Catalog)
- {
- if (stop.ColorCatalogsItem != null)
- {
stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
+ foreach (var outputLiquid in output.SingleCoordinates.OutputLiquids)
{
- var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Cyan);
+ var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack.LiquidType.Code == outputLiquid.LiquidType.ToInt32());
if (liquidVolume == null)
{
- throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Cyan + "'.");
+ throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + outputLiquid.LiquidType + "'.");
}
- liquidVolume.Volume = stop.ColorCatalogsItem.Cyan;
+ liquidVolume.Volume = outputLiquid.Volume;
}
-
+ }
+ else if (stop.BrushColorSpace == ColorSpaces.Catalog)
+ {
+ if (stop.ColorCatalogsItem != null)
{
- var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Magenta);
+ stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
- if (liquidVolume == null)
{
- throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Magenta + "'.");
- }
+ var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Cyan);
- liquidVolume.Volume = stop.ColorCatalogsItem.Magenta;
- }
+ if (liquidVolume == null)
+ {
+ throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Cyan + "'.");
+ }
- {
- var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Yellow);
+ liquidVolume.Volume = stop.ColorCatalogsItem.Cyan;
+ }
- if (liquidVolume == null)
{
- throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Yellow + "'.");
- }
+ var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Magenta);
- liquidVolume.Volume = stop.ColorCatalogsItem.Yellow;
- }
+ if (liquidVolume == null)
+ {
+ throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Magenta + "'.");
+ }
- {
- var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Black);
+ liquidVolume.Volume = stop.ColorCatalogsItem.Magenta;
+ }
- if (liquidVolume == null)
{
- throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Black + "'.");
+ var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Yellow);
+
+ if (liquidVolume == null)
+ {
+ throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Yellow + "'.");
+ }
+
+ liquidVolume.Volume = stop.ColorCatalogsItem.Yellow;
}
- liquidVolume.Volume = stop.ColorCatalogsItem.Black;
+ {
+ var liquidVolume = stop.LiquidVolumes.SingleOrDefault(x => x.LiquidType == LiquidTypes.Black);
+
+ if (liquidVolume == null)
+ {
+ throw new NullReferenceException("Liquid volume not found for color conversion output liquid '" + LiquidTypes.Black + "'.");
+ }
+
+ liquidVolume.Volume = stop.ColorCatalogsItem.Black;
+ }
+ }
+ else if (!stop.IsTransparent)
+ {
+ throw new InvalidOperationException($"No catalog item specified for segment color.");
+ }
+ else
+ {
+ stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
}
}
- else if (!stop.IsTransparent)
+ else if (stop.BrushColorSpace == ColorSpaces.Volume)
{
- throw new InvalidOperationException($"No catalog item specified for segment color.");
+ stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
}
else
{
- stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
+ throw new InvalidOperationException($"Unsupported color space {stop.BrushColorSpace}.");
}
- }
- else if (stop.BrushColorSpace == ColorSpaces.Volume)
- {
- stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
- }
- else
- {
- throw new InvalidOperationException($"Unsupported color space {stop.BrushColorSpace}.");
- }
- //}
-
- if (job.EnableLubrication)
- {
- var lubricantVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack != null && x.IdsPack.LiquidType != null && x.LiquidType == LiquidTypes.Lubricant);
+ //}
- if (lubricantVolume != null)
+ if (job.EnableLubrication)
{
- lubricantVolume.Volume = 100;
+ var lubricantVolume = stop.LiquidVolumes.SingleOrDefault(x => x.IdsPack != null && x.IdsPack.LiquidType != null && x.LiquidType == LiquidTypes.Lubricant);
+
+ if (lubricantVolume != null)
+ {
+ lubricantVolume.Volume = 100;
+ }
}
}
- }
+ });
- return Print(job, processParameters);
+ return await Print(job, processParameters);
}
/// <summary>
diff --git a/Software/Visual_Studio/Tango.SharedUI/Components/LazyBinding.cs b/Software/Visual_Studio/Tango.SharedUI/Components/LazyBinding.cs
new file mode 100644
index 000000000..e8e22d182
--- /dev/null
+++ b/Software/Visual_Studio/Tango.SharedUI/Components/LazyBinding.cs
@@ -0,0 +1,160 @@
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Tango.SharedUI.Components
+{
+ [MarkupExtensionReturnType(typeof(object))]
+ public class LazyBindingExtension : MarkupExtension
+ {
+ public LazyBindingExtension()
+ { }
+
+ public LazyBindingExtension(PropertyPath path) : this()
+ {
+ Path = path;
+ }
+
+ #region Properties
+
+ public IValueConverter Converter { get; set; }
+ [TypeConverter(typeof(CultureInfoIetfLanguageTagConverter))]
+ public CultureInfo ConverterCulture { get; set; }
+ public object ConverterParamter { get; set; }
+ public string ElementName { get; set; }
+ [ConstructorArgument("path")]
+ public PropertyPath Path { get; set; }
+ public RelativeSource RelativeSource { get; set; }
+ public object Source { get; set; }
+ public UpdateSourceTrigger UpdateSourceTrigger { get; set; }
+ public bool ValidatesOnDataErrors { get; set; }
+ public bool ValidatesOnExceptions { get; set; }
+ public bool ValidatesOnNotifyDataErrors { get; set; }
+
+ private Binding binding;
+ private UIElement bindingTarget;
+ private DependencyProperty bindingTargetProperty;
+
+ #endregion
+
+ #region Init
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ var valueProvider = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;
+ if (valueProvider != null)
+ {
+ bindingTarget = valueProvider.TargetObject as UIElement;
+
+ if (bindingTarget == null)
+ {
+ throw new NotSupportedException($"Target '{valueProvider.TargetObject}' is not valid for a LazyBinding. The LazyBinding target must be a UIElement.");
+ }
+
+ bindingTargetProperty = valueProvider.TargetProperty as DependencyProperty;
+
+ if (bindingTargetProperty == null)
+ {
+ throw new NotSupportedException($"The property '{valueProvider.TargetProperty}' is not valid for a LazyBinding. The LazyBinding target property must be a DependencyProperty.");
+ }
+
+ binding = new Binding
+ {
+ Path = Path,
+ Converter = Converter,
+ ConverterCulture = ConverterCulture,
+ ConverterParameter = ConverterParamter
+ };
+
+ if (ElementName != null)
+ {
+ binding.ElementName = ElementName;
+ }
+
+ if (RelativeSource != null)
+ {
+ binding.RelativeSource = RelativeSource;
+ }
+
+ if (Source != null)
+ {
+ binding.Source = Source;
+ }
+
+ binding.UpdateSourceTrigger = UpdateSourceTrigger;
+ binding.ValidatesOnDataErrors = ValidatesOnDataErrors;
+ binding.ValidatesOnExceptions = ValidatesOnExceptions;
+ binding.ValidatesOnNotifyDataErrors = ValidatesOnNotifyDataErrors;
+
+ return SetBinding();
+ }
+
+ return null;
+ }
+
+ public object SetBinding()
+ {
+ bindingTarget.IsVisibleChanged += UiElement_IsVisibleChanged;
+
+ updateBinding();
+
+ return bindingTarget.GetValue(bindingTargetProperty);
+ }
+
+ #endregion
+
+ #region Event Handlers
+
+ private void UiElement_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
+ {
+ updateBinding();
+ }
+
+ #endregion
+
+ #region Update Binding
+
+ private void updateBinding()
+ {
+ if (bindingTarget.IsVisible)
+ {
+ ConsolidateBinding();
+ }
+ else
+ {
+ ClearBinding();
+ }
+ }
+
+ private bool _isBind;
+
+ private void ConsolidateBinding()
+ {
+ if (_isBind)
+ {
+ return;
+ }
+
+ _isBind = true;
+
+ BindingOperations.SetBinding(bindingTarget, bindingTargetProperty, binding);
+ }
+
+ private void ClearBinding()
+ {
+ if (!_isBind)
+ {
+ return;
+ }
+
+ BindingOperations.ClearBinding(bindingTarget, bindingTargetProperty);
+
+ _isBind = false;
+ }
+
+ #endregion
+ }
+}
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs
index 141fa6e27..07005a0f4 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/FastTextBlock.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text;
@@ -30,6 +31,23 @@ namespace Tango.SharedUI.Controls
public FastTextBlock()
{
Loaded += FastTextBlock_Loaded;
+
+ DependencyPropertyDescriptor fontFamilyPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(FastTextBlock.FontFamilyProperty, typeof(FastTextBlock));
+ fontFamilyPropertyDescriptor.AddValueChanged(this, OnPropertyChangedInit);
+
+ DependencyPropertyDescriptor fontSizePropertyDescriptor = DependencyPropertyDescriptor.FromProperty(FastTextBlock.FontSizeProperty, typeof(FastTextBlock));
+ fontSizePropertyDescriptor.AddValueChanged(this, OnPropertyChangedInit);
+
+ DependencyPropertyDescriptor fontWeightPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(FastTextBlock.FontWeightProperty, typeof(FastTextBlock));
+ fontWeightPropertyDescriptor.AddValueChanged(this, OnPropertyChangedInit);
+
+ DependencyPropertyDescriptor ForegroundPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(FastTextBlock.ForegroundProperty, typeof(FastTextBlock));
+ ForegroundPropertyDescriptor.AddValueChanged(this, OnPropertyChangedInit);
+ }
+
+ private void OnPropertyChangedInit(object sender, EventArgs e)
+ {
+ Init();
}
private void FastTextBlock_Loaded(object sender, RoutedEventArgs e)
diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
index e4dc72746..5d9592a26 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
+++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj
@@ -67,6 +67,7 @@
<Compile Include="Binding\BindingEventArgs.cs" />
<Compile Include="Binding\BindingEventContainer.cs" />
<Compile Include="Binding\BindingProperty.cs" />
+ <Compile Include="Components\LazyBinding.cs" />
<Compile Include="Components\BindingProxy.cs" />
<Compile Include="Components\SelectedObject.cs" />
<Compile Include="Components\SelectedObjectCollection.cs" />
@@ -261,7 +262,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.xaml b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.xaml
index 7cc38666e..e0e8f485c 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.xaml
@@ -25,9 +25,9 @@
<Border x:Name="PART_Border" ClipToBounds="True" Background="Transparent">
<Grid x:Name="PART_Grid_Content" Background="Transparent" VerticalAlignment="Top" Height="{Binding ElementName=stack,Path=ActualHeight,Mode=OneWay}">
<StackPanel x:Name="stack" VerticalAlignment="Top">
- <StackPanel.CacheMode>
+ <!--<StackPanel.CacheMode>
<BitmapCache SnapsToDevicePixels="False" RenderAtScale="1" EnableClearType="False" />
- </StackPanel.CacheMode>
+ </StackPanel.CacheMode>-->
<ContentPresenter x:Name="PART_Content_Presenter" Content="{TemplateBinding Content}" VerticalAlignment="Top" Height="Auto" />
</StackPanel>
</Grid>
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml
index da8580488..b0b78c177 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml
@@ -138,7 +138,7 @@
</Style.Triggers>
</Style>
</Canvas.Style>
- <TextBlock FontWeight="Bold" FontSize="11" Foreground="{StaticResource TangoPrimaryAccentBrush}" Canvas.Top="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*-1'}" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchAutoComplete},Path=Watermark}">
+ <TextBlock FontWeight="Bold" FontSize="11" Foreground="{StaticResource TangoPrimaryAccentBrush}" Canvas.Top="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*-1'}" Text="">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Opacity" Value="0"></Setter>
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml
index f8ee069f0..83163fcd8 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml
@@ -31,7 +31,7 @@
<DataTemplate>
<Border>
<DockPanel>
- <Label VerticalAlignment="Center" Padding="30" Foreground="{StaticResource TangoDarkForegroundBrush}" FontSize="{StaticResource TangoComboBoxItemFontSize}">
+ <Label VerticalAlignment="Center" Padding="30" FontSize="{StaticResource TangoComboBoxItemFontSize}" Foreground="{StaticResource TangoDarkForegroundBrush}">
<Label.Style>
<Style TargetType="Label">
<Setter Property="Background" Value="Transparent"></Setter>
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs
index 2a0caf13e..ccb66d009 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs
@@ -21,7 +21,7 @@ namespace Tango.Touch.Controls
{
private TextBox _text_box;
private bool _prevent_text_change;
- private TextBlock _text_block;
+ private FastTextBlock _text_block;
private double _lastValue;
Regex regex_integer = new Regex(@"^-?[0-9]\d*(\d+)?$");
Regex regex_double = new Regex(@"^-?[0-9]\d*(\.\d+)?$");
@@ -109,12 +109,22 @@ namespace Tango.Touch.Controls
public static readonly DependencyProperty AutoCalculateJogStepProperty =
DependencyProperty.Register("AutoCalculateJogStep", typeof(bool), typeof(TouchNumericTextBox), new PropertyMetadata(true));
+ public bool UpdateBindingOnlyWhenFocused
+ {
+ get { return (bool)GetValue(UpdateBindingOnlyWhenFocusedProperty); }
+ set { SetValue(UpdateBindingOnlyWhenFocusedProperty, value); }
+ }
+ public static readonly DependencyProperty UpdateBindingOnlyWhenFocusedProperty =
+ DependencyProperty.Register("UpdateBindingOnlyWhenFocused", typeof(bool), typeof(TouchNumericTextBox), new PropertyMetadata(false));
+
+
+
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_text_box = GetTemplateChild("PART_TextBox") as TextBox;
- _text_block = GetTemplateChild("PART_TextDisplay") as TextBlock;
+ _text_block = GetTemplateChild("PART_TextDisplay") as FastTextBlock;
_text_box.PreviewTextInput += _text_box_PreviewTextInput;
_text_box.PreviewKeyDown += _text_box_PreviewKeyDown;
_text_box.LostFocus += _text_box_LostFocus;
@@ -222,8 +232,11 @@ namespace Tango.Touch.Controls
_lastValue = Value;
- DoubleValueChangedEventArgs args = new DoubleValueChangedEventArgs(ValueChangedEvent, this, Value);
- RaiseEvent(args);
+ if (!UpdateBindingOnlyWhenFocused || (_text_box != null && _text_box.IsKeyboardFocused))
+ {
+ DoubleValueChangedEventArgs args = new DoubleValueChangedEventArgs(ValueChangedEvent, this, Value);
+ RaiseEvent(args);
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml
index 2710a954f..d347480d6 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.xaml
@@ -10,6 +10,7 @@
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="../Resources/Colors.xaml" />-->
<components:SharedResourceDictionary Source="../Resources/Colors.xaml" />
+ <components:SharedResourceDictionary Source="../Resources/Fonts.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:StringNullOrEmptyToBooleanConverter x:Key="StringNullOrEmptyToBooleanConverter" />
@@ -100,7 +101,7 @@
</Style>
</TextBox.Style>
</TextBox>
- <TextBlock x:Name="PART_TextDisplay" FontSize="{TemplateBinding FontSize}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" IsHitTestVisible="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Foreground="{TemplateBinding Foreground}" Padding="0 0 0 4" FocusVisualStyle="{x:Null}" Visibility="{Binding ElementName=PART_TextBox,Path=IsFocused,Converter={StaticResource BooleanToVisibilityInverseConverter}}"></TextBlock>
+ <controls:FastTextBlock FontFamily="{StaticResource TangoFlexoFontFamily}" x:Name="PART_TextDisplay" FontSize="{TemplateBinding FontSize}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" IsHitTestVisible="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Foreground="{TemplateBinding Foreground}" Padding="0 0 0 4" FocusVisualStyle="{x:Null}" Visibility="{Binding ElementName=PART_TextBox,Path=IsFocused,Converter={StaticResource BooleanToVisibilityInverseConverter}}"></controls:FastTextBlock>
</Grid>
</components:Ripple>
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentReplaceControl.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentReplaceControl.cs
new file mode 100644
index 000000000..802d3f538
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentReplaceControl.cs
@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Markup;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+using Tango.Core.Threading;
+
+namespace Tango.Touch.Controls
+{
+ [ContentProperty(nameof(Content))]
+ public class TouchVirtualizedContentReplaceControl : Control
+ {
+ private LightTouchScrollViewer _scrollViewer;
+ private Border _innerBorder;
+ private ActionTimer _updateTimer;
+ private Point _location;
+ private bool _loaded;
+ private Image _replaceContent;
+ private FrameworkElement _element;
+ private INameScopeDictionary _parentNameScope;
+
+ public DataTemplate Content
+ {
+ get { return (DataTemplate)GetValue(ContentProperty); }
+ set { SetValue(ContentProperty, value); }
+ }
+ public static readonly DependencyProperty ContentProperty =
+ DependencyProperty.Register("Content", typeof(DataTemplate), typeof(TouchVirtualizedContentReplaceControl), new PropertyMetadata(null));
+
+ public bool CanMovePosition
+ {
+ get { return (bool)GetValue(CanMovePositionProperty); }
+ set { SetValue(CanMovePositionProperty, value); }
+ }
+ public static readonly DependencyProperty CanMovePositionProperty =
+ DependencyProperty.Register("CanMovePosition", typeof(bool), typeof(TouchVirtualizedContentReplaceControl), new PropertyMetadata(false));
+
+ public LightTouchDataGrid DataGrid
+ {
+ get { return (LightTouchDataGrid)GetValue(DataGridProperty); }
+ set { SetValue(DataGridProperty, value); }
+ }
+ public static readonly DependencyProperty DataGridProperty =
+ DependencyProperty.Register("DataGrid", typeof(LightTouchDataGrid), typeof(TouchVirtualizedContentReplaceControl), new PropertyMetadata(null));
+
+ public bool Disconnect
+ {
+ get { return (bool)GetValue(DisconnectProperty); }
+ set { SetValue(DisconnectProperty, value); }
+ }
+ public static readonly DependencyProperty DisconnectProperty =
+ DependencyProperty.Register("Disconnect", typeof(bool), typeof(TouchVirtualizedContentReplaceControl), new PropertyMetadata(true));
+
+ static TouchVirtualizedContentReplaceControl()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchVirtualizedContentReplaceControl), new FrameworkPropertyMetadata(typeof(TouchVirtualizedContentReplaceControl)));
+ }
+
+ public TouchVirtualizedContentReplaceControl()
+ {
+ _replaceContent = new Image();
+ _updateTimer = new ActionTimer(TimeSpan.FromMilliseconds(100));
+ Loaded += TouchVirtualizedContentControl_Loaded;
+ }
+
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+ _innerBorder = GetTemplateChild("PART_innerBorder") as Border;
+ _innerBorder.Child = _replaceContent;
+ }
+
+ private void TouchVirtualizedContentControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
+ {
+ _scrollViewer = this.FindAncestor<LightTouchScrollViewer>();
+ _scrollViewer.Scrolling += _scrollViewer_Scrolling;
+
+ _parentNameScope = NameScope.GetNameScope(this.FindAncestor<UserControl>()) as INameScopeDictionary;
+
+ if (DataGrid != null)
+ {
+ DataGrid.SortingChanged += DataGrid_SortingChanged;
+ DataGrid.FilterChanged += DataGrid_FilterChanged;
+ }
+
+ _location = this.TranslatePoint(new Point(0, 0), _scrollViewer.GetContentGrid());
+
+ _scrollViewer.GetContentGrid().SizeChanged += TouchVirtualizedContentControl_SizeChanged;
+
+ ApplyVirtualization();
+ _loaded = true;
+ }
+
+ private void DataGrid_FilterChanged(object sender, EventArgs e)
+ {
+ InvalidateVirtualization();
+ }
+
+ private void DataGrid_SortingChanged(object sender, EventArgs e)
+ {
+ InvalidateVirtualization();
+ }
+
+ private void TouchVirtualizedContentControl_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ InvalidateVirtualization();
+ }
+
+ private void _scrollViewer_Scrolling(object sender, DoubleValueChangedEventArgs e)
+ {
+ if (_loaded)
+ {
+ ApplyVirtualization();
+ }
+ }
+
+ private void InvalidateVirtualization()
+ {
+ _updateTimer.ResetReplace(() =>
+ {
+ Dispatcher.Invoke(new Action(() =>
+ {
+ _location = this.TranslatePoint(new Point(0, 0), _scrollViewer.GetContentGrid());
+ ApplyVirtualization();
+ }));
+ });
+ }
+
+ private void ApplyVirtualization()
+ {
+ if (!Disconnect && _element != null)
+ {
+ _updateTimer.Dispose();
+ return;
+ }
+
+ var _border_viewport = _scrollViewer.GetViewportBorder();
+
+ if (CanMovePosition)
+ {
+ _location = this.TranslatePoint(new Point(0, 0), _scrollViewer.GetContentGrid());
+ }
+
+ Rect bounds = new Rect(_location.X, _location.Y, ActualWidth, ActualHeight);
+ Rect rect = new Rect(0.0, _scrollViewer.GetScrollPosition(), _border_viewport.ActualWidth, _border_viewport.ActualHeight);
+
+ if (_innerBorder != null)
+ {
+ if (bounds.IntersectsWith(rect))
+ {
+ if (Disconnect || _element == null)
+ {
+ if (_innerBorder.Child == _replaceContent || _element == null)
+ {
+ _element = Content.LoadContent() as FrameworkElement;
+
+ if (_parentNameScope != null)
+ {
+ NameScope.SetNameScope(_element, _parentNameScope);
+ }
+
+ _innerBorder.Child = _element;
+ _innerBorder.Height = double.NaN;
+ }
+ }
+ }
+ else
+ {
+ if (Disconnect)
+ {
+ if (_innerBorder.Child == _element)
+ {
+ double height = _element != null ? _element.ActualHeight : MinHeight;
+ _innerBorder.Child = _replaceContent;
+ _innerBorder.Height = height;
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentReplaceControl.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentReplaceControl.xaml
new file mode 100644
index 000000000..c7fe39b76
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentReplaceControl.xaml
@@ -0,0 +1,15 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="clr-namespace:Tango.Touch.Controls">
+
+ <Style TargetType="{x:Type local:TouchVirtualizedContentReplaceControl}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type local:TouchVirtualizedContentReplaceControl}">
+ <Border x:Name="PART_innerBorder"></Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+</ResourceDictionary> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj
index 7dd560a48..8575548c4 100644
--- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj
+++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj
@@ -101,6 +101,7 @@
<Compile Include="Controls\TouchToggleIconButton.cs" />
<Compile Include="Controls\TouchToggleImageButton.cs" />
<Compile Include="Controls\TouchToggleSlider.cs" />
+ <Compile Include="Controls\TouchVirtualizedContentReplaceControl.cs" />
<Compile Include="Controls\TouchVirtualizedContentControl.cs" />
<Compile Include="Converters\BlurRadiusToMarginConverter.cs" />
<Compile Include="Converters\DateTimeToCalendarHeaderConverter.cs" />
@@ -277,6 +278,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Controls\TouchVirtualizedContentReplaceControl.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Controls\TouchVirtualizedContentControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -422,7 +427,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml
index ed0f289b0..47403f56b 100644
--- a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml
@@ -46,6 +46,7 @@
<ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchCalendar.xaml" />
<ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchDatePicker.xaml" />
<ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchVirtualizedContentControl.xaml" />
+ <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchVirtualizedContentReplaceControl.xaml" />
<ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchDropShadowBorder.xaml" />
<ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchSimpleDataGrid.xaml" />
<ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchMultiLineTextBox.xaml" />