aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-03-06 18:28:51 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-03-06 18:28:51 +0200
commit4e48c569f1cae820ffade8a786354b2ba79b50b4 (patch)
tree1bfbdf19f8c86cc1f1a1d8b900756b0cc2781d66 /Software
parent7e6c673cc8b04086fa3c78cd1bf5e31085fd8cc8 (diff)
downloadTango-4e48c569f1cae820ffade8a786354b2ba79b50b4.tar.gz
Tango-4e48c569f1cae820ffade8a786354b2ba79b50b4.zip
Some improvements on hive.
Diffstat (limited to 'Software')
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin1048576 -> 1048576 bytes
-rw-r--r--Software/PMR/Messages/ColorLab/ConversionInput.proto2
-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
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml35
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml.cs118
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveComboControl.xaml54
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveComboControl.xaml.cs136
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj11
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/DependencyObjectExtensions.cs2
-rw-r--r--Software/Visual_Studio/Tango.Editors/StringExtensions.cs107
-rw-r--r--Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj9
-rw-r--r--Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs65
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/HiveControl.xaml.cs35
22 files changed, 537 insertions, 223 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index 0b5f81486..2167c8efc 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index c1c265fec..2d60019a5 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
diff --git a/Software/PMR/Messages/ColorLab/ConversionInput.proto b/Software/PMR/Messages/ColorLab/ConversionInput.proto
index 1c0ce472e..89dac5e7c 100644
--- a/Software/PMR/Messages/ColorLab/ConversionInput.proto
+++ b/Software/PMR/Messages/ColorLab/ConversionInput.proto
@@ -16,4 +16,6 @@ message ConversionInput
bytes ForwardData = 6;
bytes InverseData = 7;
double SegmentLength = 8;
+ double DeltaChroma = 9;
+ double DeltaL = 10;
} \ No newline at end of file
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();
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml
index 2aa11c63c..d65bd5d8f 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml
@@ -6,46 +6,19 @@
xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls"
xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI"
xmlns:local="clr-namespace:Tango.MachineStudio.Common.Controls"
mc:Ignorable="d"
- d:DesignHeight="250" d:DesignWidth="550" Background="White">
+ Height="250" Width="650" Background="White">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="235"/>
<ColumnDefinition Width="1*"/>
- <ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
- <colorPicker:ColorCanvas SelectedColor="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=SelectedColor,Mode=TwoWay}" Background="Transparent" BorderThickness="0" UsingAlphaChannel="False" />
+ <colorPicker:ColorCanvas x:Name="colorCanvas" SelectedColor="{x:Null}" SelectedColorChanged="ColorCanvas_SelectedColorChanged" Background="Transparent" BorderThickness="0" UsingAlphaChannel="False" />
- <Viewbox Stretch="Uniform" Grid.Column="1" Margin="5">
- <controls:HiveControl x:Name="hive" Height="250" HexagonSelected="hive_HexagonSelected" MaxSelections="1" Width="250" BorderThickness="1" />
- </Viewbox>
-
- <Grid Grid.Column="2">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="1*"/>
- <RowDefinition Height="45"/>
- <RowDefinition Height="1*"/>
- </Grid.RowDefinitions>
- <Button ToolTip="Increase Delta Resolution" Click="OnResolutionUpClicked" Style="{StaticResource MaterialDesignFlatButton}" Height="50" Padding="0" Foreground="#202020" VerticalAlignment="Bottom">
- <materialDesign:PackIcon Kind="ArrowUp" Width="24" Height="24" />
- </Button>
-
- <Grid Grid.Row="1">
- <shapes:Hexagon Stroke="#202020" StrokeThickness="1" Margin="5" />
- <TextBlock TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontStyle="Italic" FontSize="10">
- <Run Text="&#916;"></Run>
- <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Resolution,FallbackValue=1}"></Run>
- </TextBlock>
- </Grid>
-
- <Button ToolTip="Decrease Delta Resolution" Click="OnResolutionDownClicked" Grid.Row="2" Style="{StaticResource MaterialDesignFlatButton}" Height="50" Padding="0" Foreground="#202020" VerticalAlignment="Top">
- <materialDesign:PackIcon Kind="ArrowDown" Width="24" Height="24" />
- </Button>
- </Grid>
- </Grid>
+ <commonControls:HiveComboControl x:Name="hiveCombo" Grid.Column="1" SelectedHexagonChanged="hiveCombo_SelectedHexagonChanged" />
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml.cs
index 7d1a1dc81..41b362889 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -12,6 +13,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using Tango.SharedUI.Controls;
namespace Tango.MachineStudio.Common.Controls
{
@@ -21,7 +23,12 @@ namespace Tango.MachineStudio.Common.Controls
public partial class HiveColorPickerControl : UserControl
{
public event EventHandler<Color> SelectedColorChanged;
- private bool _preventHiveSelectedColorChange;
+ public event EventHandler<Color> SelectedHiveColorChanged;
+ public event EventHandler<HexagonControl> SelectedHexagonChanged;
+ public event EventHandler<int> LAxisValueChanged;
+ public event EventHandler<int> ResolutionChanged;
+
+ private bool _preventColorCanvasEvent;
public bool DemoMode
{
@@ -39,93 +46,112 @@ namespace Tango.MachineStudio.Common.Controls
public static readonly DependencyProperty ResolutionProperty =
DependencyProperty.Register("Resolution", typeof(int), typeof(HiveColorPickerControl), new PropertyMetadata(1, (d, e) => (d as HiveColorPickerControl).OnResolutionChanged()));
- public Color SelectedColor
+ public Color? SelectedColor
{
- get { return (Color)GetValue(SelectedColorProperty); }
+ get { return (Color?)GetValue(SelectedColorProperty); }
set { SetValue(SelectedColorProperty, value); }
}
public static readonly DependencyProperty SelectedColorProperty =
- DependencyProperty.Register("SelectedColor", typeof(Color), typeof(HiveColorPickerControl), new PropertyMetadata(Colors.Red, (d, e) => (d as HiveColorPickerControl).OnSelectedColorChanged()));
+ DependencyProperty.Register("SelectedColor", typeof(Color?), typeof(HiveColorPickerControl), new PropertyMetadata(null, (d, e) => (d as HiveColorPickerControl).OnSelectedColorChanged()));
+
+ public HexagonControl SelectedHexagon
+ {
+ get { return (HexagonControl)GetValue(SelectedHexagonProperty); }
+ set { SetValue(SelectedHexagonProperty, value); }
+ }
+ public static readonly DependencyProperty SelectedHexagonProperty =
+ DependencyProperty.Register("SelectedHexagon", typeof(HexagonControl), typeof(HiveColorPickerControl), new PropertyMetadata(null, (d, e) => (d as HiveColorPickerControl).OnSelectedHexagonChanged()));
- public Color SelectedHiveColor
+ public Color? SelectedHiveColor
{
- get { return (Color)GetValue(SelectedHiveColorProperty); }
+ get { return (Color?)GetValue(SelectedHiveColorProperty); }
set { SetValue(SelectedHiveColorProperty, value); }
}
public static readonly DependencyProperty SelectedHiveColorProperty =
- DependencyProperty.Register("SelectedHiveColor", typeof(Color), typeof(HiveColorPickerControl), new PropertyMetadata(Colors.Red));
+ DependencyProperty.Register("SelectedHiveColor", typeof(Color?), typeof(HiveColorPickerControl), new PropertyMetadata(null, (d, e) => (d as HiveColorPickerControl).OnSelectedHiveColorChanged()));
+
+ public int LAxisValue
+ {
+ get { return (int)GetValue(LAxisValueProperty); }
+ set { SetValue(LAxisValueProperty, value); }
+ }
+ public static readonly DependencyProperty LAxisValueProperty =
+ DependencyProperty.Register("LAxisValue", typeof(int), typeof(HiveColorPickerControl), new PropertyMetadata(0, (d, e) => (d as HiveColorPickerControl).OnLAxisValueChanged()));
+
public HiveColorPickerControl()
{
InitializeComponent();
- hive.Loaded += Hive_Loaded;
+ this.Bind(ResolutionProperty, hiveCombo, HiveComboControl.ResolutionProperty, BindingMode.TwoWay);
+ this.Bind(SelectedHexagonProperty, hiveCombo, HiveComboControl.SelectedHexagonProperty, BindingMode.OneWay);
+ this.Bind(LAxisValueProperty, hiveCombo, HiveComboControl.LAxisValueProperty, BindingMode.OneWay);
+
+
+ hiveCombo.HiveGenerated += HiveCombo_HiveGenerated;
}
- private void Hive_Loaded(object sender, RoutedEventArgs e)
+ private void HiveCombo_HiveGenerated(object sender, EventArgs e)
{
- OnSelectedColorChanged();
+ hiveCombo.GenerateDemoModeHiveColors(SelectedColor.Value);
+ }
+
+ private void OnSelectedHiveColorChanged()
+ {
+ //_preventColorCanvasEvent = true;
+ //colorCanvas.SelectedColor = SelectedHiveColor;
+ //_preventColorCanvasEvent = false;
+
+ SelectedHiveColorChanged?.Invoke(this, SelectedHiveColor.Value);
}
private void OnSelectedColorChanged()
{
- if (DemoMode)
+ if (SelectedColor != null)
{
- if (!_preventHiveSelectedColorChange)
+ _preventColorCanvasEvent = true;
+ colorCanvas.SelectedColor = SelectedColor;
+ _preventColorCanvasEvent = false;
+
+ if (DemoMode)
{
- GenerateDemoModeHiveColors();
+ hiveCombo.GenerateDemoModeHiveColors(SelectedColor.Value);
}
- SelectedColorChanged?.Invoke(this, SelectedColor);
+
+ SelectedColorChanged?.Invoke(this, SelectedColor.Value);
}
}
- private void hive_HexagonSelected(object sender, SharedUI.Controls.HexagonControl hexagon)
+ private void OnSelectedHexagonChanged()
{
- SelectedHiveColor = (hexagon.Fill as SolidColorBrush).Color;
-
- _preventHiveSelectedColorChange = true;
- SelectedColor = SelectedHiveColor;
- _preventHiveSelectedColorChange = false;
+ SelectedHexagonChanged?.Invoke(this, SelectedHexagon);
+ SelectedHiveColor = (SelectedHexagon.Fill as SolidColorBrush).Color;
}
- private void OnResolutionChanged()
+ private void OnLAxisValueChanged()
{
- GenerateDemoModeHiveColors();
+ LAxisValueChanged?.Invoke(this, LAxisValue);
}
- private void GenerateDemoModeHiveColors()
+ private void OnResolutionChanged()
{
- if (hive.CenterHexagon != null)
- {
- Random rnd = new Random();
-
- (hive.CenterHexagon.Fill as SolidColorBrush).Color = SelectedColor;
-
- int counter = 0;
-
- foreach (var hexagon in hive.Hexagons.Where(x => x != hive.CenterHexagon).OrderBy(x => rnd.Next()))
- {
- (hexagon.Fill as SolidColorBrush).Color = Color.FromRgb((byte)Math.Min(SelectedColor.R + counter++, 255), (byte)Math.Min((SelectedColor.G + counter++), 255), (byte)Math.Min((SelectedColor.B + counter++), 255));
-
- counter += (int)(4d * ((double)Resolution / 4d));
- }
- }
+ hiveCombo.GenerateDemoModeHiveColors(SelectedColor.Value);
}
- private void OnResolutionUpClicked(object sender, RoutedEventArgs e)
+ private void ColorCanvas_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs<Color?> e)
{
- if (Resolution < 10)
+ if (!_preventColorCanvasEvent)
{
- Resolution++;
+ SelectedColor = e.NewValue.Value;
+ hiveCombo.SelectHeagon(hiveCombo.CenterHexagon);
}
}
- private void OnResolutionDownClicked(object sender, RoutedEventArgs e)
+ private void hiveCombo_SelectedHexagonChanged(object sender, HexagonControl e)
{
- if (Resolution > 1)
- {
- Resolution--;
- }
+ SelectedHexagon = e;
+ SelectedHiveColor = (SelectedHexagon.Fill as SolidColorBrush).Color;
+ SelectedHexagonChanged?.Invoke(this, SelectedHexagon);
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveComboControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveComboControl.xaml
new file mode 100644
index 000000000..692b3f818
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveComboControl.xaml
@@ -0,0 +1,54 @@
+<UserControl x:Class="Tango.MachineStudio.Common.Controls.HiveComboControl"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ 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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI"
+ xmlns:local="clr-namespace:Tango.MachineStudio.Common.Controls"
+ mc:Ignorable="d"
+ Height="250" Width="415">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*"/>
+ <ColumnDefinition Width="70"/>
+ <ColumnDefinition Width="50"/>
+ </Grid.ColumnDefinitions>
+
+ <Viewbox Stretch="Uniform" Grid.Column="0" Margin="5">
+ <controls:HiveControl x:Name="hive" x:FieldModifier="public" Height="250" HexagonSelected="OnHexagonSelected" MaxSelections="1" Width="250" BorderThickness="1" />
+ </Viewbox>
+
+ <Grid Grid.Column="1" ClipToBounds="True">
+ <Viewbox Stretch="Fill" Width="160" Height="200" HorizontalAlignment="Right" Margin="0 0 -20 0">
+ <controls:HiveControl Height="290" HexagonSelected="OnRowHiveHexagonSelected" MaxSelections="1" Width="100" Margin="0 0 50 0" HiveWidth="1" HiveHeight="5" BorderThickness="1" />
+ </Viewbox>
+ </Grid>
+
+ <Grid Grid.Column="2">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="1*"/>
+ <RowDefinition Height="45"/>
+ <RowDefinition Height="1*"/>
+ </Grid.RowDefinitions>
+ <Button ToolTip="Increase Delta Resolution" Click="OnResolutionUpClicked" Style="{StaticResource MaterialDesignFlatButton}" Height="50" Padding="0" Foreground="#202020" VerticalAlignment="Bottom">
+ <materialDesign:PackIcon Kind="ArrowUp" Width="24" Height="24" />
+ </Button>
+
+ <Grid Grid.Row="1">
+ <shapes:Hexagon Stroke="#202020" StrokeThickness="1" Margin="5" />
+ <TextBlock TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontStyle="Italic" FontSize="10">
+ <Run Text="&#916;"></Run>
+ <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Resolution,FallbackValue=1}"></Run>
+ </TextBlock>
+ </Grid>
+
+ <Button ToolTip="Decrease Delta Resolution" Click="OnResolutionDownClicked" Grid.Row="2" Style="{StaticResource MaterialDesignFlatButton}" Height="50" Padding="0" Foreground="#202020" VerticalAlignment="Top">
+ <materialDesign:PackIcon Kind="ArrowDown" Width="24" Height="24" />
+ </Button>
+ </Grid>
+ </Grid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveComboControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveComboControl.xaml.cs
new file mode 100644
index 000000000..342a1f1c9
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveComboControl.xaml.cs
@@ -0,0 +1,136 @@
+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.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Tango.Logging;
+using Tango.SharedUI.Controls;
+
+namespace Tango.MachineStudio.Common.Controls
+{
+ /// <summary>
+ /// Interaction logic for HiveComboControl.xaml
+ /// </summary>
+ public partial class HiveComboControl : UserControl
+ {
+ public event EventHandler<Color> SelectedColorChanged;
+ public event EventHandler<HexagonControl> SelectedHexagonChanged;
+ public event EventHandler<int> LAxisValueChanged;
+ public event EventHandler<int> ResolutionChanged;
+ public event EventHandler HiveGenerated;
+
+ public int Resolution
+ {
+ get { return (int)GetValue(ResolutionProperty); }
+ set { SetValue(ResolutionProperty, value); }
+ }
+ public static readonly DependencyProperty ResolutionProperty =
+ DependencyProperty.Register("Resolution", typeof(int), typeof(HiveComboControl), new PropertyMetadata(1, (d, e) => (d as HiveComboControl).OnResolutionChanged()));
+
+ public HexagonControl SelectedHexagon
+ {
+ get { return (HexagonControl)GetValue(SelectedHexagonProperty); }
+ set { SetValue(SelectedHexagonProperty, value); }
+ }
+ public static readonly DependencyProperty SelectedHexagonProperty =
+ DependencyProperty.Register("SelectedHexagon", typeof(HexagonControl), typeof(HiveComboControl), new PropertyMetadata(null, (d, e) => (d as HiveComboControl).OnSelectedHexagonChanged()));
+
+ public int LAxisValue
+ {
+ get { return (int)GetValue(LAxisValueProperty); }
+ set { SetValue(LAxisValueProperty, value); }
+ }
+ public static readonly DependencyProperty LAxisValueProperty =
+ DependencyProperty.Register("LAxisValue", typeof(int), typeof(HiveComboControl), new PropertyMetadata(0, (d, e) => (d as HiveComboControl).OnLAxisValueChanged()));
+
+ public HexagonControl CenterHexagon
+ {
+ get { return hive.CenterHexagon; }
+ }
+
+
+ public HiveComboControl()
+ {
+ InitializeComponent();
+
+ hive.HiveGenerated += (x, e) => HiveGenerated?.Invoke(this, new EventArgs());
+ }
+
+ private void OnLAxisValueChanged()
+ {
+ LAxisValueChanged?.Invoke(this, LAxisValue);
+ }
+
+ private void OnSelectedHexagonChanged()
+ {
+ SelectedHexagonChanged?.Invoke(this, SelectedHexagon);
+ }
+
+ private void OnResolutionChanged()
+ {
+ ResolutionChanged?.Invoke(this, Resolution);
+ }
+
+ public void GenerateDemoModeHiveColors(Color originalColor)
+ {
+ if (hive.CenterHexagon != null)
+ {
+ Random rnd = new Random();
+
+ (hive.CenterHexagon.Fill as SolidColorBrush).Color = originalColor;
+
+ int counter = 0;
+
+ foreach (var hexagon in hive.Hexagons.Where(x => x != hive.CenterHexagon).OrderBy(x => rnd.Next()))
+ {
+ (hexagon.Fill as SolidColorBrush).Color = Color.FromRgb((byte)Math.Min(originalColor.R + counter++, 255), (byte)Math.Min((originalColor.G + counter++), 255), (byte)Math.Min((originalColor.B + counter++), 255));
+
+ counter += (int)(4d * ((double)Resolution / 4d));
+ }
+ }
+ }
+
+ private void OnResolutionUpClicked(object sender, RoutedEventArgs e)
+ {
+ if (Resolution < 10)
+ {
+ Resolution++;
+ }
+ }
+
+ private void OnResolutionDownClicked(object sender, RoutedEventArgs e)
+ {
+ if (Resolution > 1)
+ {
+ Resolution--;
+ }
+ }
+
+ private void OnRowHiveHexagonSelected(object sender, HexagonControl hexagon)
+ {
+ int l = 2 - hexagon.Row;
+ LogManager.Default.Log("L ROW: " + l.ToString());
+ }
+
+ private void OnHexagonSelected(object sender, HexagonControl e)
+ {
+ SelectedHexagon = e;
+ }
+
+ public void SelectHeagon(HexagonControl hexagon)
+ {
+ hive.SelectHexagon(hexagon);
+ SelectedHexagonChanged?.Invoke(this, hexagon);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
index 457646223..2347919d6 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj
@@ -76,6 +76,9 @@
<Compile Include="Controls\HiveColorPickerControl.xaml.cs">
<DependentUpon>HiveColorPickerControl.xaml</DependentUpon>
</Compile>
+ <Compile Include="Controls\HiveComboControl.xaml.cs">
+ <DependentUpon>HiveComboControl.xaml</DependentUpon>
+ </Compile>
<Compile Include="Controls\IRealTimeGraph.cs" />
<Compile Include="Controls\RealTimeGraphMultiControl.xaml.cs">
<DependentUpon>RealTimeGraphMultiControl.xaml</DependentUpon>
@@ -114,6 +117,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Controls\HiveComboControl.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Controls\MdiContainerControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -212,6 +219,10 @@
<Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project>
<Name>Tango.Integration</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj">
+ <Project>{BC932DBD-7CDB-488C-99E4-F02CF441F55E}</Project>
+ <Name>Tango.Logging</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.PMR\Tango.PMR.csproj">
<Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project>
<Name>Tango.PMR</Name>
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/DependencyObjectExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/DependencyObjectExtensions.cs
index 3e7da4cfb..e36fe607c 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/DependencyObjectExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/DependencyObjectExtensions.cs
@@ -55,7 +55,7 @@ public static class DependencyObjectExtensions
/// <param name="mode">Binding mode.</param>
/// <param name="converter">Binding converter.</param>
/// <returns></returns>
- public static Binding Bind(this DependencyObject target, DependencyProperty targetDP, DependencyObject source, DependencyProperty sourceDP, BindingMode mode, IValueConverter converter = null)
+ public static Binding Bind(this DependencyObject target, DependencyProperty targetDP, DependencyObject source, DependencyProperty sourceDP, BindingMode mode, IValueConverter converter)
{
Binding binding = new Binding();
binding.Mode = mode;
diff --git a/Software/Visual_Studio/Tango.Editors/StringExtensions.cs b/Software/Visual_Studio/Tango.Editors/StringExtensions.cs
deleted file mode 100644
index 0f5923512..000000000
--- a/Software/Visual_Studio/Tango.Editors/StringExtensions.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-
-/// <exclude/>
-/// <summary>
-/// A collection of <see cref="String"/> extension methods.
-/// </summary>
-internal static class StringExtensions
-{
- private static Regex titleRegEx;
-
- /// <summary>
- /// Initializes the <see cref="StringExtensions"/> class.
- /// </summary>
- static StringExtensions()
- {
- titleRegEx = new Regex(@"
- (?<=[A-Z])(?=[A-Z][a-z]) |
- (?<=[^A-Z])(?=[A-Z]) |
- (?<=[A-Za-z])(?=[^A-Za-z])", RegexOptions.IgnorePatternWhitespace);
- }
-
- /// <summary>
- /// Returns true if the string is not null or contains white spaces.
- /// </summary>
- /// <param name="str">The string.</param>
- /// <returns></returns>
- internal static bool IsValid(this String str)
- {
- return !String.IsNullOrWhiteSpace(str);
- }
-
- /// <summary>
- /// Determines whether the string contains an existing file path.
- /// </summary>
- /// <param name="path">The path.</param>
- /// <returns></returns>
- internal static bool IsFileExists(this String path)
- {
- return System.IO.File.Exists(path);
- }
-
- /// <summary>
- /// Determines whether the string is valid as a file system path.
- /// </summary>
- /// <param name="path">The path.</param>
- /// <returns></returns>
- internal static bool IsPathValid(this String path)
- {
- return path.IsValid() && path.IndexOfAny(System.IO.Path.GetInvalidPathChars()) == -1;
- }
-
- /// <summary>
- /// Returns a friendly file size of the file path.
- /// </summary>
- /// <param name="filePath">The file path.</param>
- /// <returns></returns>
- internal static String GetFileSizeString(this String filePath)
- {
- FileInfo f = new FileInfo(filePath);
- double length = f.Length;
-
- string[] sizes = { "B", "KB", "MB", "GB" };
- double len = length;
- int order = 0;
- while (len >= 1024 && order + 1 < sizes.Length)
- {
- order++;
- len = len / 1024;
- }
-
- // Adjust the format string to your preferences. For example "{0:0.#}{1}" would
- // show a single decimal place, and no space.
- return String.Format("{0:0.##} {1}", len, sizes[order]);
- }
-
- /// <summary>
- /// If string is a path, returns the file name.
- /// </summary>
- /// <param name="filePath">The file path.</param>
- /// <returns></returns>
- internal static String GetFileName(this String filePath)
- {
- return Path.GetFileName(filePath);
- }
-
- /// <summary>
- /// If string is a path, returns the file extension.
- /// </summary>
- /// <param name="filePath">The file path.</param>
- /// <returns></returns>
- internal static String GetFileExtension(this String filePath)
- {
- return Path.GetExtension(filePath);
- }
-
- internal static String ToTitle(this String str)
- {
- return titleRegEx.Replace(str, " ");
- }
-}
-
diff --git a/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj b/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj
index 217048e63..1eaeddb9c 100644
--- a/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj
+++ b/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj
@@ -76,7 +76,6 @@
<Compile Include="ParameterItem.cs" />
<Compile Include="ParameterItemAttribute.cs" />
<Compile Include="ParameterItemMode.cs" />
- <Compile Include="StringExtensions.cs" />
<Compile Include="UIElementExtension.cs" />
<Compile Include="UIHelper.cs" />
<Compile Include="UndoRedoStatesProviderBase.cs" />
@@ -109,7 +108,7 @@
<Compile Include="Converters\StringFormatConverter.cs" />
<Compile Include="Converters\TransformPointToPointConverter.cs" />
<Compile Include="CustomScrollViewer.cs" />
- <Compile Include="DependencyObjectExtensions.cs" />
+ <None Include="DependencyObjectExtensions.cs" />
<Compile Include="ElementCreationEventArgs.cs" />
<Compile Include="ElementEditor.cs" />
<Compile Include="ElementEditorConfiguration.cs" />
@@ -166,5 +165,11 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Tango.Core\Tango.Core.csproj">
+ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs
index 20f133b7c..9678ca13e 100644
--- a/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs
+++ b/Software/Visual_Studio/Tango.PMR/ColorLab/ConversionInput.cs
@@ -23,18 +23,19 @@ namespace Tango.PMR.ColorLab {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChVDb252ZXJzaW9uSW5wdXQucHJvdG8SElRhbmdvLlBNUi5Db2xvckxhYhoW",
- "SW5wdXRDb29yZGluYXRlcy5wcm90bxoQQ29sb3JTcGFjZS5wcm90byL5AQoP",
+ "SW5wdXRDb29yZGluYXRlcy5wcm90bxoQQ29sb3JTcGFjZS5wcm90byKeAgoP",
"Q29udmVyc2lvbklucHV0Eg8KB1RocmVhZEwYASABKAESDwoHVGhyZWFkQRgC",
"IAEoARIPCgdUaHJlYWRCGAMgASgBEjIKCkNvbG9yU3BhY2UYBCABKA4yHi5U",
"YW5nby5QTVIuQ29sb3JMYWIuQ29sb3JTcGFjZRI+ChBJbnB1dENvb3JkaW5h",
"dGVzGAUgASgLMiQuVGFuZ28uUE1SLkNvbG9yTGFiLklucHV0Q29vcmRpbmF0",
"ZXMSEwoLRm9yd2FyZERhdGEYBiABKAwSEwoLSW52ZXJzZURhdGEYByABKAwS",
- "FQoNU2VnbWVudExlbmd0aBgIIAEoAUIeChxjb20udHdpbmUudGFuZ28ucG1y",
- "LmNvbG9ybGFiYgZwcm90bzM="));
+ "FQoNU2VnbWVudExlbmd0aBgIIAEoARITCgtEZWx0YUNocm9tYRgJIAEoARIO",
+ "CgZEZWx0YUwYCiABKAFCHgocY29tLnR3aW5lLnRhbmdvLnBtci5jb2xvcmxh",
+ "YmIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Tango.PMR.ColorLab.InputCoordinatesReflection.Descriptor, global::Tango.PMR.ColorLab.ColorSpaceReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.ConversionInput), global::Tango.PMR.ColorLab.ConversionInput.Parser, new[]{ "ThreadL", "ThreadA", "ThreadB", "ColorSpace", "InputCoordinates", "ForwardData", "InverseData", "SegmentLength" }, null, null, null)
+ new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.ConversionInput), global::Tango.PMR.ColorLab.ConversionInput.Parser, new[]{ "ThreadL", "ThreadA", "ThreadB", "ColorSpace", "InputCoordinates", "ForwardData", "InverseData", "SegmentLength", "DeltaChroma", "DeltaL" }, null, null, null)
}));
}
#endregion
@@ -73,6 +74,8 @@ namespace Tango.PMR.ColorLab {
forwardData_ = other.forwardData_;
inverseData_ = other.inverseData_;
segmentLength_ = other.segmentLength_;
+ deltaChroma_ = other.deltaChroma_;
+ deltaL_ = other.deltaL_;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -168,6 +171,28 @@ namespace Tango.PMR.ColorLab {
}
}
+ /// <summary>Field number for the "DeltaChroma" field.</summary>
+ public const int DeltaChromaFieldNumber = 9;
+ private double deltaChroma_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public double DeltaChroma {
+ get { return deltaChroma_; }
+ set {
+ deltaChroma_ = value;
+ }
+ }
+
+ /// <summary>Field number for the "DeltaL" field.</summary>
+ public const int DeltaLFieldNumber = 10;
+ private double deltaL_;
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public double DeltaL {
+ get { return deltaL_; }
+ set {
+ deltaL_ = value;
+ }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as ConversionInput);
@@ -189,6 +214,8 @@ namespace Tango.PMR.ColorLab {
if (ForwardData != other.ForwardData) return false;
if (InverseData != other.InverseData) return false;
if (SegmentLength != other.SegmentLength) return false;
+ if (DeltaChroma != other.DeltaChroma) return false;
+ if (DeltaL != other.DeltaL) return false;
return true;
}
@@ -203,6 +230,8 @@ namespace Tango.PMR.ColorLab {
if (ForwardData.Length != 0) hash ^= ForwardData.GetHashCode();
if (InverseData.Length != 0) hash ^= InverseData.GetHashCode();
if (SegmentLength != 0D) hash ^= SegmentLength.GetHashCode();
+ if (DeltaChroma != 0D) hash ^= DeltaChroma.GetHashCode();
+ if (DeltaL != 0D) hash ^= DeltaL.GetHashCode();
return hash;
}
@@ -245,6 +274,14 @@ namespace Tango.PMR.ColorLab {
output.WriteRawTag(65);
output.WriteDouble(SegmentLength);
}
+ if (DeltaChroma != 0D) {
+ output.WriteRawTag(73);
+ output.WriteDouble(DeltaChroma);
+ }
+ if (DeltaL != 0D) {
+ output.WriteRawTag(81);
+ output.WriteDouble(DeltaL);
+ }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -274,6 +311,12 @@ namespace Tango.PMR.ColorLab {
if (SegmentLength != 0D) {
size += 1 + 8;
}
+ if (DeltaChroma != 0D) {
+ size += 1 + 8;
+ }
+ if (DeltaL != 0D) {
+ size += 1 + 8;
+ }
return size;
}
@@ -309,6 +352,12 @@ namespace Tango.PMR.ColorLab {
if (other.SegmentLength != 0D) {
SegmentLength = other.SegmentLength;
}
+ if (other.DeltaChroma != 0D) {
+ DeltaChroma = other.DeltaChroma;
+ }
+ if (other.DeltaL != 0D) {
+ DeltaL = other.DeltaL;
+ }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -354,6 +403,14 @@ namespace Tango.PMR.ColorLab {
SegmentLength = input.ReadDouble();
break;
}
+ case 73: {
+ DeltaChroma = input.ReadDouble();
+ break;
+ }
+ case 81: {
+ DeltaL = input.ReadDouble();
+ break;
+ }
}
}
}
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/HiveControl.xaml.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/HiveControl.xaml.cs
index 81fc1250d..5fba6eaa0 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Controls/HiveControl.xaml.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/HiveControl.xaml.cs
@@ -25,6 +25,8 @@ namespace Tango.SharedUI.Controls
{
public event EventHandler<HexagonControl> HexagonSelected;
+ public event EventHandler HiveGenerated;
+
public ObservableCollection<HexagonControl> Hexagons
{
get { return (ObservableCollection<HexagonControl>)GetValue(HexagonsProperty); }
@@ -65,6 +67,21 @@ namespace Tango.SharedUI.Controls
public static readonly DependencyProperty CenterHexagonProperty =
DependencyProperty.Register("CenterHexagon", typeof(HexagonControl), typeof(HiveControl), new PropertyMetadata(null));
+ public int HiveWidth
+ {
+ get { return (int)GetValue(HiveWidthProperty); }
+ set { SetValue(HiveWidthProperty, value); }
+ }
+ public static readonly DependencyProperty HiveWidthProperty =
+ DependencyProperty.Register("HiveWidth", typeof(int), typeof(HiveControl), new PropertyMetadata(5));
+
+ public int HiveHeight
+ {
+ get { return (int)GetValue(HiveHeightProperty); }
+ set { SetValue(HiveHeightProperty, value); }
+ }
+ public static readonly DependencyProperty HiveHeightProperty =
+ DependencyProperty.Register("HiveHeight", typeof(int), typeof(HiveControl), new PropertyMetadata(5));
public HiveControl()
{
@@ -78,13 +95,10 @@ namespace Tango.SharedUI.Controls
this.Loaded += HiveControl_Loaded;
}
- public int HiveHeight { get; set; }
-
- public int HiveWidth { get; set; }
-
private void HiveControl_Loaded(object sender, RoutedEventArgs e)
{
GenerateHive();
+ HiveGenerated?.Invoke(this,new EventArgs());
}
private void GenerateHive()
@@ -155,7 +169,20 @@ namespace Tango.SharedUI.Controls
private void Hexagon_MouseUp(object sender, MouseButtonEventArgs e)
{
HexagonControl hexagon = sender as HexagonControl;
+ ToggleHexagonSelection(hexagon);
+ }
+ public void SelectHexagon(HexagonControl hexagon)
+ {
+ SelectedHexagons.Clear();
+ SelectedHexagons.Add(hexagon);
+ Hexagons.ToList().ForEach(x => x.IsSelected = false);
+ hexagon.IsSelected = true;
+ HexagonSelected?.Invoke(this, hexagon);
+ }
+
+ private void ToggleHexagonSelection(HexagonControl hexagon)
+ {
bool selected = !hexagon.IsSelected;
if (MaxSelections > Hexagons.Where(x => x.IsSelected).Count())