From 79ffa1774217400bd750f6a85df9f969429580c3 Mon Sep 17 00:00:00 2001 From: Roy Date: Sat, 3 Mar 2018 00:52:22 +0200 Subject: Added Delta Resolution for Hive Color Picker. Implemented Embroidery PMR. Implemented Embroidery Native Adapter. --- .../Controls/HiveColorPickerControl.xaml | 32 ++++++++++++++++++++-- .../Controls/HiveColorPickerControl.xaml.cs | 31 ++++++++++++++++++++- 2 files changed, 60 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls') 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 6a9bf9cc9..2aa11c63c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/HiveColorPickerControl.xaml @@ -4,14 +4,17 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 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: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="500" > + d:DesignHeight="250" d:DesignWidth="550" Background="White"> - + + @@ -19,5 +22,30 @@ + + + + + + + + + + + + + + + + + + + + + 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 9432ae9ef..7d1a1dc81 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 @@ -31,6 +31,14 @@ namespace Tango.MachineStudio.Common.Controls public static readonly DependencyProperty DemoModeProperty = DependencyProperty.Register("DemoMode", typeof(bool), typeof(HiveColorPickerControl), new PropertyMetadata(false)); + public int Resolution + { + get { return (int)GetValue(ResolutionProperty); } + set { SetValue(ResolutionProperty, value); } + } + public static readonly DependencyProperty ResolutionProperty = + DependencyProperty.Register("Resolution", typeof(int), typeof(HiveColorPickerControl), new PropertyMetadata(1, (d, e) => (d as HiveColorPickerControl).OnResolutionChanged())); + public Color SelectedColor { get { return (Color)GetValue(SelectedColorProperty); } @@ -80,6 +88,11 @@ namespace Tango.MachineStudio.Common.Controls _preventHiveSelectedColorChange = false; } + private void OnResolutionChanged() + { + GenerateDemoModeHiveColors(); + } + private void GenerateDemoModeHiveColors() { if (hive.CenterHexagon != null) @@ -94,9 +107,25 @@ namespace Tango.MachineStudio.Common.Controls { (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 += 4; + 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--; + } + } } } -- cgit v1.3.1