aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-07-12 09:47:34 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-07-12 09:47:34 +0300
commitf314379a276dea7647facd322674944cc69e5230 (patch)
treedb90b46e467ab58ab9554f84bc62a3386b5f8dc0 /Software/Visual_Studio/MachineStudio/Modules
parent850e4a8273ac2ad0f1f300dcc149807b3b303517 (diff)
parentdec3cd03aec51dca67150e2f6ba76c7eda7f11a4 (diff)
downloadTango-f314379a276dea7647facd322674944cc69e5230.tar.gz
Tango-f314379a276dea7647facd322674944cc69e5230.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs41
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml73
2 files changed, 87 insertions, 27 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs
index 48d16104a..0e9109b28 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs
@@ -13,6 +13,7 @@ using System.Windows.Media;
using Tango.BL;
using Tango.BL.ColorConversion;
using Tango.BL.Entities;
+using Tango.BL.Enumerations;
using Tango.Core.Commands;
using Tango.MachineStudio.Common;
using Tango.MachineStudio.Common.Controls;
@@ -32,6 +33,33 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
#region Properties
+ private bool _isVolumesOutOfRange;
+ /// <summary>
+ /// Gets or sets a value indicating whether the liquid volumes are out of range.
+ /// </summary>
+ public bool IsVolumesOutOfRange
+ {
+ get { return _isVolumesOutOfRange; }
+ set
+ {
+ if (_isVolumesOutOfRange != value)
+ {
+ _isVolumesOutOfRange = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+ }
+
+ private bool _isOutOfGamut;
+ /// <summary>
+ /// Gets or sets a value indicating whether the source color is out of gamut.
+ /// </summary>
+ public bool IsOutOfGamut
+ {
+ get { return _isOutOfGamut; }
+ set { _isOutOfGamut = value; RaisePropertyChangedAuto(); }
+ }
+
private ObservableCollection<Machine> _machines;
/// <summary>
/// Gets or sets the machines.
@@ -280,6 +308,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
var output = TangoColorConverter.GetSuggestions(input);
+ IsOutOfGamut = output.OutOfGamut;
+
HiveSuggestions = TangoColorConverter.CreateHiveSuggestions(output);
});
}
@@ -396,6 +426,17 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
try
{
if (LiquidsCalibrationData == null) return;
+
+ //TODO: This is temporary because of out of range volumes.
+ if (LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > 200)
+ {
+ IsVolumesOutOfRange = true;
+ return;
+ }
+ else
+ {
+ IsVolumesOutOfRange = false;
+ }
ConversionInput input = new ConversionInput();
input.ColorSpace = PMR.ColorLab.ColorSpace.Volume;
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml
index 8b62604d6..d8ef015be 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml
@@ -26,6 +26,7 @@
<converters:ColorToComponentsConverter x:Key="ColorToComponentsConverter" />
<converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter" />
<converters:ObjectToObjectTypeConverter x:Key="ObjectToObjectTypeConverter" />
+ <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</UserControl.Resources>
<Grid>
@@ -163,6 +164,12 @@
</Grid.RowDefinitions>
<StackPanel VerticalAlignment="Center" Grid.Row="1">
+ <StackPanel Height="20">
+ <StackPanel Orientation="Horizontal" Margin="0 0 0 5" Visibility="{Binding IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <materialDesign:PackIcon Kind="Alert" Foreground="#FF6D6D" />
+ <TextBlock Margin="5 0 0 0" Foreground="#FF6D6D">Color is out of gamut</TextBlock>
+ </StackPanel>
+ </StackPanel>
<Border BorderThickness="1" BorderBrush="#545454" Margin="0" Padding="2 2 2 0">
<brushPicker:BrushPicker x:Name="picker" Color="{Binding SourceColor.Color,Mode=TwoWay}" Background="Transparent" BorderThickness="0" Height="150" BrushTypeVisibility="Collapsed"></brushPicker:BrushPicker>
</Border>
@@ -254,30 +261,39 @@
</Grid>
- <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center" MinWidth="420" Grid.Column="4" Grid.Row="3">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <StackPanel>
- <TextBlock HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding Name}" FontSize="10" Margin="0 0 0 5"></TextBlock>
- <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0">
- <ContentControl.Foreground>
- <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush>
- </ContentControl.Foreground>
- <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.00" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center">
- <!--<mahapps:NumericUpDown.Resources>
+ <StackPanel Grid.Column="4" Grid.Row="3">
+ <StackPanel Height="25" Margin="25 0 0 0">
+ <StackPanel Orientation="Horizontal" Margin="0 0 0 0" Visibility="{Binding IsVolumesOutOfRange,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <materialDesign:PackIcon Kind="Alert" Foreground="#FF6D6D" />
+ <TextBlock Margin="5 0 0 0" Foreground="#FF6D6D">Liquid volumes exceeds the maximum range</TextBlock>
+ </StackPanel>
+ </StackPanel>
+
+ <ItemsControl ItemsSource="{Binding LiquidVolumes}" VerticalAlignment="Center" MinWidth="420">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <StackPanel>
+ <TextBlock HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding Name}" FontSize="10" Margin="0 0 0 5"></TextBlock>
+ <ContentControl Focusable="False" Style="{StaticResource numberBorder}" Width="60" Height="60" Margin="10 0 0 0">
+ <ContentControl.Foreground>
+ <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush>
+ </ContentControl.Foreground>
+ <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.00" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center">
+ <!--<mahapps:NumericUpDown.Resources>
<StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource>
</mahapps:NumericUpDown.Resources>-->
- </mahapps:NumericUpDown>
- </ContentControl>
- </StackPanel>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ </mahapps:NumericUpDown>
+ </ContentControl>
+ </StackPanel>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
<Image Source="../Images/arrow-long-Left.png" Grid.Column="2" Grid.Row="3" Width="140" Opacity="0.8"></Image>
@@ -286,11 +302,14 @@
<Grid>
<DockPanel Width="80" HorizontalAlignment="Left">
<TextBlock DockPanel.Dock="Top" FontSize="9" TextAlignment="Center">COMPOSITE</TextBlock>
- <Ellipse Height="70" Margin="0 5 0 0" Stroke="#202020">
- <Ellipse.Fill>
- <SolidColorBrush Color="{Binding TargetColor.Color}"></SolidColorBrush>
- </Ellipse.Fill>
- </Ellipse>
+ <Grid>
+ <Ellipse Height="70" Margin="0 5 0 0" Stroke="#202020">
+ <Ellipse.Fill>
+ <SolidColorBrush Color="{Binding TargetColor.Color}"></SolidColorBrush>
+ </Ellipse.Fill>
+ </Ellipse>
+ <materialDesign:PackIcon Visibility="{Binding IsVolumesOutOfRange,Converter={StaticResource BooleanToVisibilityConverter}}" Kind="Alert" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" Width="24" Height="24" />
+ </Grid>
</DockPanel>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Height="60">