aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs62
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/RgbVM.cs69
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml33
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs2
9 files changed, 158 insertions, 28 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj
index 91bc51933..44e55a12e 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj
@@ -89,6 +89,7 @@
<Compile Include="ViewModels\CalibrationDataVM.cs" />
<Compile Include="ViewModels\LiquidVolumeVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
+ <Compile Include="ViewModels\RgbVM.cs" />
<Compile Include="Views\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
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 8260f000a..c6cc95930 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
@@ -5,15 +5,19 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Media;
using Tango.BL;
using Tango.BL.Entities;
+using Tango.MachineStudio.Common.Controls;
using Tango.SharedUI;
+using Tango.SharedUI.Controls;
namespace Tango.MachineStudio.ColorLab.ViewModels
{
public class MainViewVM : ViewModel
{
private ObservablesContext _dbContext;
+ private HiveComboControl _hiveCombo;
#region Properties
@@ -57,6 +61,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
set
{
_selectedMachine = value; RaisePropertyChangedAuto();
+ OnSelectedMachineChanged();
}
}
@@ -86,7 +91,9 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
}
private ObservableCollection<LiquidVolumeVM> _liquidVolumes;
-
+ /// <summary>
+ /// Gets or sets the liquid volumes.
+ /// </summary>
public ObservableCollection<LiquidVolumeVM> LiquidVolumes
{
get { return _liquidVolumes; }
@@ -94,24 +101,74 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
}
private ObservableCollection<CalibrationDataVM> _liquidsCalibrationData;
-
+ /// <summary>
+ /// Gets or sets the liquids calibration data.
+ /// </summary>
public ObservableCollection<CalibrationDataVM> LiquidsCalibrationData
{
get { return _liquidsCalibrationData; }
set { _liquidsCalibrationData = value; RaisePropertyChangedAuto(); }
}
+ private RgbVM _sourceColor;
+ /// <summary>
+ /// Gets or sets the color of the source.
+ /// </summary>
+ public RgbVM SourceColor
+ {
+ get { return _sourceColor; }
+ set { _sourceColor = value; RaisePropertyChangedAuto(); }
+ }
+
+ private HexagonControl _selectedHexagon;
+ /// <summary>
+ /// Gets or sets the selected hexagon.
+ /// </summary>
+ public HexagonControl SelectedHexagon
+ {
+ get { return _selectedHexagon; }
+ set { _selectedHexagon = value; RaisePropertyChangedAuto(); }
+ }
+
#endregion
public MainViewVM() : base()
{
_dbContext = ObservablesContext.CreateDefault();
+ SourceColor = new RgbVM();
+ SourceColor.ColorChanged += SourceColor_ColorChanged;
Machines = _dbContext.Machines.ToObservableCollection();
ColorSpaces = _dbContext.ColorSpaces.ToObservableCollection();
Rmls = _dbContext.Rmls.ToObservableCollection();
}
+ private void SourceColor_ColorChanged(object sender, Color color)
+ {
+ if (_hiveCombo != null)
+ {
+ _hiveCombo.GenerateDemoModeHiveColors(color);
+ _hiveCombo.SelectHeagon(_hiveCombo.CenterHexagon);
+ }
+ }
+
+ public void PutComboHiveControl(HiveComboControl hiveCombo)
+ {
+ _hiveCombo = hiveCombo;
+ }
+
+ #region Liquid Volumes
+
+ private void OnSelectedMachineChanged()
+ {
+ if (SelectedMachine != null)
+ {
+ LiquidVolumes = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => new LiquidVolumeVM() { Color = x.LiquidType.Color, Name = x.LiquidType.Name }).ToObservableCollection();
+ }
+ }
+
+ #endregion
+
#region RML
private void InvalidateLiquidFactorsAndProcessTables()
@@ -120,7 +177,6 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
{
LiquidTypesRmls = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList();
//RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active);
- LiquidVolumes = SelectedMachine.Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => new LiquidVolumeVM() { Color = x.LiquidType.Color, Name = x.LiquidType.Name }).ToObservableCollection();
LiquidsCalibrationData = new ObservableCollection<CalibrationDataVM>();
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/RgbVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/RgbVM.cs
new file mode 100644
index 000000000..badb238fb
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/RgbVM.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using Tango.SharedUI;
+
+namespace Tango.MachineStudio.ColorLab.ViewModels
+{
+ public class RgbVM : ViewModel
+ {
+ public event EventHandler<Color> ColorChanged;
+
+ public RgbVM()
+ {
+ Color = Colors.DimGray;
+ }
+
+ private double _red;
+ public double Red
+ {
+ get { return _red; }
+ set { _red = value; SynchronizeColor(); RaisePropertyChangedAuto(); }
+ }
+
+ private double _green;
+ public double Green
+ {
+ get { return _green; }
+ set { _green = value; SynchronizeColor(); RaisePropertyChangedAuto(); }
+ }
+
+ private double _blue;
+ public double Blue
+ {
+ get { return _blue; }
+ set { _blue = value; SynchronizeColor(); RaisePropertyChangedAuto(); }
+ }
+
+ private Color _color;
+ public Color Color
+ {
+ get { return _color; }
+ set { _color = value; RaisePropertyChanged(nameof(Color)); SynchronizeComponents(); }
+ }
+
+ private void SynchronizeColor()
+ {
+ _color = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue);
+ RaisePropertyChanged(nameof(Color));
+ ColorChanged?.Invoke(this, _color);
+ }
+
+ private void SynchronizeComponents()
+ {
+ _red = Color.R;
+ _green = Color.G;
+ _blue = Color.B;
+
+ RaisePropertyChanged(nameof(Red));
+ RaisePropertyChanged(nameof(Green));
+ RaisePropertyChanged(nameof(Blue));
+ RaisePropertyChanged(nameof(Color));
+
+ ColorChanged?.Invoke(this, Color);
+ }
+ }
+}
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 92ef15231..72a1bdd4e 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
@@ -8,6 +8,7 @@
xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:vm="clr-namespace:Tango.MachineStudio.ColorLab.ViewModels"
xmlns:brushPicker="clr-namespace:Tango.BrushPicker;assembly=Tango.BrushPicker"
@@ -164,9 +165,9 @@
<Grid Grid.Row="1" Margin="0 40 0 0" HorizontalAlignment="Center">
<Grid>
<Grid.ColumnDefinitions>
- <ColumnDefinition Width="300" />
+ <ColumnDefinition Width="250" />
+ <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="300" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
@@ -179,41 +180,33 @@
<StackPanel VerticalAlignment="Center" Grid.Row="1">
<Border BorderThickness="1" BorderBrush="#545454" Margin="0" Padding="2 2 2 0">
- <brushPicker:BrushPicker x:Name="picker" Background="Transparent" BorderThickness="0" Height="150" BrushTypeVisibility="Collapsed">
- <brushPicker:BrushPicker.Color>
- <MultiBinding Converter="{StaticResource ColorToComponentsConverter}" Mode="TwoWay">
- <Binding ElementName="sliderR" Path="Value" Mode="TwoWay"></Binding>
- <Binding ElementName="sliderG" Path="Value" Mode="TwoWay"></Binding>
- <Binding ElementName="sliderB" Path="Value" Mode="TwoWay"></Binding>
- </MultiBinding>
- </brushPicker:BrushPicker.Color>
- </brushPicker:BrushPicker>
+ <brushPicker:BrushPicker x:Name="picker" Color="{Binding SourceColor.Color,Mode=TwoWay}" Background="Transparent" BorderThickness="0" Height="150" BrushTypeVisibility="Collapsed"></brushPicker:BrushPicker>
</Border>
<DockPanel Margin="0 10 0 0">
<TextBlock DockPanel.Dock="Left" Text="R" VerticalAlignment="Center" />
- <TextBlock DockPanel.Dock="Right" Text="{Binding ElementName=picker,Path=Color.R}"></TextBlock>
- <Slider x:Name="sliderR" Margin="10 0" Maximum="255"></Slider>
+ <TextBlock DockPanel.Dock="Right" Text="{Binding SourceColor.Red}"></TextBlock>
+ <Slider x:Name="sliderR" Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding SourceColor.Red,Mode=TwoWay}"></Slider>
</DockPanel>
<DockPanel Margin="0 10 0 0">
<TextBlock DockPanel.Dock="Left" Text="G" VerticalAlignment="Center" />
- <TextBlock DockPanel.Dock="Right" Text="{Binding ElementName=picker,Path=Color.G}"></TextBlock>
- <Slider x:Name="sliderG" Margin="10 0" Maximum="255"></Slider>
+ <TextBlock DockPanel.Dock="Right" Text="{Binding SourceColor.Green}"></TextBlock>
+ <Slider x:Name="sliderG" Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding SourceColor.Green,Mode=TwoWay}"></Slider>
</DockPanel>
<DockPanel Margin="0 10 0 0">
<TextBlock DockPanel.Dock="Left" Text="B" VerticalAlignment="Center" />
- <TextBlock DockPanel.Dock="Right" Text="{Binding ElementName=picker,Path=Color.B}"></TextBlock>
- <Slider x:Name="sliderB" Margin="10 0" Maximum="255"></Slider>
+ <TextBlock DockPanel.Dock="Right" Text="{Binding SourceColor.Blue}"></TextBlock>
+ <Slider x:Name="sliderB" Margin="10 0" IsSnapToTickEnabled="True" TickFrequency="1" Maximum="255" Value="{Binding SourceColor.Blue,Mode=TwoWay}"></Slider>
</DockPanel>
</StackPanel>
<TextBlock FontStyle="Italic" HorizontalAlignment="Center">SOURCE / INVERSE RGB</TextBlock>
- <TextBlock FontStyle="Italic" HorizontalAlignment="Center" Grid.Column="2">SUGGESTIONS</TextBlock>
+ <TextBlock FontStyle="Italic" HorizontalAlignment="Center" Grid.Column="2" Margin="-120 0 0 0">SUGGESTIONS</TextBlock>
<TextBlock FontStyle="Italic" HorizontalAlignment="Center" Grid.Column="4">LIQUID VOLUMES</TextBlock>
<Image Source="../Images/arrow-long-right.png" Grid.Column="1" Grid.Row="1" Width="140" Opacity="0.8" Margin="20 0 0 0"></Image>
- <controls:HiveControl Width="200" Height="200" Grid.Column="2" Grid.Row="1" />
+ <commonControls:HiveComboControl x:Name="hiveCombo" Grid.Column="2" Grid.Row="1" />
<Image Source="../Images/arrow-long-right.png" Grid.Column="3" Grid.Row="1" Width="140" Opacity="0.8" Margin="0 0 20 0"></Image>
@@ -281,7 +274,7 @@
<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 ElementName=picker,Path=Color}"></SolidColorBrush>
+ <SolidColorBrush Color="{Binding SourceColor.Color}"></SolidColorBrush>
</Ellipse.Fill>
</Ellipse>
</DockPanel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs
index 1a96386f6..d78750050 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml.cs
@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using Tango.MachineStudio.ColorLab.ViewModels;
namespace Tango.MachineStudio.ColorLab.Views
{
@@ -20,9 +21,19 @@ namespace Tango.MachineStudio.ColorLab.Views
/// </summary>
public partial class MainView : UserControl
{
+ private MainViewVM _vm;
+
public MainView()
{
InitializeComponent();
+
+ this.Loaded += MainView_Loaded;
+ }
+
+ private void MainView_Loaded(object sender, RoutedEventArgs e)
+ {
+ _vm = DataContext as MainViewVM;
+ _vm.PutComboHiveControl(hiveCombo);
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
index 566dc7a16..dfaeb7044 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
@@ -1710,7 +1710,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
Red = stop.Color.R,
Green = stop.Color.G,
Blue = stop.Color.B,
- OffsetPercent = stop.Offset,
+ OffsetPercent = stop.Offset * 100d,
ColorSpace = _machineDbContext.ColorSpaces.ToList().SingleOrDefault(x => x.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32()),
});
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml
index 42d0bb106..8d25719e8 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml
@@ -46,7 +46,7 @@
<StackPanel>
<TextBlock Margin="5">Region Brush</TextBlock>
<Border Margin="5" BorderThickness="1" BorderBrush="Silver">
- <brushPicker:BrushPicker Background="White" BorderThickness="0" Brush="{Binding ElementName=editor,Path=SelectedPath.Brush,Mode=TwoWay}" />
+ <brushPicker:BrushPicker Background="White" BorderThickness="0" Brush="{Binding ElementName=editor,Path=SelectedPath.Brush,Mode=TwoWay}" Height="220" />
</Border>
<Border BorderThickness="1" BorderBrush="Silver" Padding="5 0 5 5" Margin="5">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
index 1dea01de7..4c0784d1d 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
@@ -157,13 +157,13 @@
</StackPanel>
</ToggleButton>
<Popup x:Name="Popup" MouseDown="Popup_MouseDown" PopupAnimation="Fade" StaysOpen="False" PlacementTarget="{Binding ElementName=PopupButton}" Placement="Bottom" AllowsTransparency="True">
- <Border Background="#E6FFFFFF" Height="250" Width="550" CornerRadius="5" Margin="10">
+ <Border Background="#E6FFFFFF" CornerRadius="5" Margin="10">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="10" />
</Border.Effect>
<Grid>
<Grid Margin="10">
- <commonControls:HiveColorPickerControl SelectedColorChanged="HiveColorPickerControl_SelectedColorChanged" SelectedColor="{Binding Color,Mode=TwoWay}" DemoMode="True" />
+ <commonControls:HiveColorPickerControl SelectedHiveColorChanged="HiveColorPickerControl_SelectedColorChanged" SelectedColor="{Binding Color,Mode=OneWay}" SelectedHiveColor="{Binding Color,Mode=OneWayToSource}" DemoMode="True" />
</Grid>
</Grid>
</Border>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
index 905caa96d..0c99dfe5f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
@@ -125,7 +125,7 @@ namespace Tango.MachineStudio.Developer.Views
}
- private void HiveColorPickerControl_SelectedColorChanged(object sender, Color e)
+ private void HiveColorPickerControl_SelectedColorChanged(object sender, Color color)
{
UpdateGradientBrushDisplay();
}