aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-07-08 17:50:11 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-07-08 17:50:11 +0300
commitc5713f263db2aa8eda95e13c14ed31d1335b6bc0 (patch)
treeefb2685fd1f3296021e74e5b97bf87e83a533451 /Software/Visual_Studio/PPC/Tango.PPC.Common/Controls
parent45a4da6b34d2aedea27e2826931f0705eb05130f (diff)
downloadTango-c5713f263db2aa8eda95e13c14ed31d1335b6bc0.tar.gz
Tango-c5713f263db2aa8eda95e13c14ed31d1335b6bc0.zip
Refactoring of all color catalogs objects !!!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Controls')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/CoatsCatalogControl.xaml145
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/CoatsCatalogControl.xaml.cs112
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs24
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs34
5 files changed, 34 insertions, 291 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/CoatsCatalogControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/CoatsCatalogControl.xaml
deleted file mode 100644
index b9218a483..000000000
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/CoatsCatalogControl.xaml
+++ /dev/null
@@ -1,145 +0,0 @@
-<UserControl x:Class="Tango.PPC.Common.Controls.CoatsCatalogControl"
- 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:local="clr-namespace:Tango.PPC.Common.Controls"
- xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
- xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
- xmlns:catalog="clr-namespace:Tango.BL.Catalogs;assembly=Tango.BL"
- mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=catalog:Catalog, IsDesignTimeCreatable=False}">
- <Grid>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="1*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
-
- <touch:LightTouchScrollViewer x:Name="scrollViewer" ScrollBarVisibility="Collapsed">
- <!--<Border Background="White">-->
- <local:TwineCatalogRenderer x:Name="renderer" Groups="{Binding Groups}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=SelectedItem,Mode=TwoWay}"></local:TwineCatalogRenderer>
- <!--</Border>-->
- </touch:LightTouchScrollViewer>
-
- <!--<touch:TouchListBox ItemsSource="{Binding Groups}" x:Name="list" x:FieldModifier="public" DisableRipple="True" ScrollBarVisibility="Collapsed" SelectionMode="None">
- <touch:TouchListBox.ItemTemplate>
- <DataTemplate>
- <StackPanel Margin="0 0 10 0">
- <TextBlock HorizontalAlignment="Center" Text="{Binding Name,IsAsync=True}" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock>
- <touch:TouchStaticListBox ItemsSource="{Binding Items,IsAsync=True}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=SelectedItem,Mode=TwoWay}" Margin="0 20 0 40">
- <touch:TouchStaticListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </touch:TouchStaticListBox.ItemsPanel>
- <touch:TouchStaticListBox.ItemContainerStyle>
- <Style TargetType="{x:Type touch:TouchStaticListBoxItem}">
- <Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter>
- <Setter Property="RenderTransform">
- <Setter.Value>
- <ScaleTransform ScaleX="1" ScaleY="1" />
- </Setter.Value>
- </Setter>
- -->
- <!--<Setter Property="Effect">
- <Setter.Value>
- <DropShadowEffect Color="{StaticResource TangoDarkForegroundColor}" ShadowDepth="0" BlurRadius="20" Opacity="0" />
- </Setter.Value>
- </Setter>-->
- <!--
- <Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}" Value="True">
- <DataTrigger.EnterActions>
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1.5" Duration="00:00:00" />
- <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1.5" Duration="00:00:00" />
- -->
- <!--<DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="1" Duration="00:00:0.2" />-->
- <!--
- </Storyboard>
- </BeginStoryboard>
- </DataTrigger.EnterActions>
- <DataTrigger.ExitActions>
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:00" />
- <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:00" />
- -->
- <!--<DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="0" Duration="00:00:0.2" />-->
- <!--
- </Storyboard>
- </BeginStoryboard>
- </DataTrigger.ExitActions>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </touch:TouchStaticListBox.ItemContainerStyle>
- <touch:TouchStaticListBox.ItemTemplate>
- <DataTemplate>
- <StackPanel Margin="10" Width="70">
- <Ellipse Width="60" Height="60" Fill="{Binding Brush}" />
- -->
- <!--<controls:FastTextBlock Margin="0 5 0 0" HorizontalAlignment="Center" Text="{Binding Name,IsAsync=True}"></controls:FastTextBlock>-->
- <!--
- </StackPanel>
- </DataTemplate>
- </touch:TouchStaticListBox.ItemTemplate>
- </touch:TouchStaticListBox>
- </StackPanel>
- </DataTemplate>
- </touch:TouchListBox.ItemTemplate>
- </touch:TouchListBox>-->
-
- <Grid Grid.Column="1">
- <!--<Rectangle Stroke="{StaticResource TangoDividerBrush}" HorizontalAlignment="Left" />-->
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
-
- <Border Width="25" CornerRadius="10">
- <Border.Clip>
- <RectangleGeometry RadiusX="10" RadiusY="10">
- <RectangleGeometry.Rect>
- <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}">
- <Binding RelativeSource="{RelativeSource AncestorType=Border}" Path="ActualWidth" />
- <Binding RelativeSource="{RelativeSource AncestorType=Border}" Path="ActualHeight" />
- </MultiBinding>
- </RectangleGeometry.Rect>
- </RectangleGeometry>
- </Border.Clip>
- <ItemsControl ItemsSource="{Binding Groups}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <UniformGrid Columns="1" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Rectangle>
- <Rectangle.Fill>
- <SolidColorBrush Color="{Binding Color}" />
- </Rectangle.Fill>
- </Rectangle>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </Border>
-
- <Grid Grid.Column="1">
- <touch:TouchSlider x:Name="slider" ValueChanged="TouchSlider_ValueChanged" IsSnapToTickEnabled="True" Minimum="0" Maximum="{Binding Groups.Count,Converter={StaticResource MathOperatorConverter},ConverterParameter='-1'}" Orientation="Vertical" Width="40" Height="Auto" IsSelectionRangeEnabled="False">
- <touch:TouchSlider.ThumbTemplate>
- <ControlTemplate>
- <touch:TouchIcon Foreground="{Binding RelativeSource={RelativeSource AncestorType=touch:TouchSlider},Path=Foreground}" Width="40" Height="40" Icon="Water" Angle="-90" />
- </ControlTemplate>
- </touch:TouchSlider.ThumbTemplate>
- </touch:TouchSlider>
- </Grid>
- </Grid>
- </Grid>
- </Grid>
- </Grid>
-</UserControl>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/CoatsCatalogControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/CoatsCatalogControl.xaml.cs
deleted file mode 100644
index f4b764ad0..000000000
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/CoatsCatalogControl.xaml.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-using System;
-using System.Collections.Generic;
-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.BL.Catalogs;
-
-namespace Tango.PPC.Common.Controls
-{
- /// <summary>
- /// Interaction logic for CoatsCatalogControl.xaml
- /// </summary>
- public partial class CoatsCatalogControl : UserControl
- {
- private Catalog _catalog;
- private bool _preventChange;
- private double _lastScrollPosition = 0;
-
- /// <summary>
- /// Gets or sets the selected catalog item.
- /// </summary>
- public CatalogItem SelectedItem
- {
- get { return (CatalogItem)GetValue(SelectedItemProperty); }
- set { SetValue(SelectedItemProperty, value); }
- }
- public static readonly DependencyProperty SelectedItemProperty =
- DependencyProperty.Register("SelectedItem", typeof(CatalogItem), typeof(CoatsCatalogControl), new PropertyMetadata(null));
-
- public CoatsCatalogControl()
- {
- InitializeComponent();
-
- //list.ApplyTemplate();
- //list.Loaded += TwineCatalogControl_Loaded;
- DataContextChanged += (x, y) =>
- {
- _catalog = DataContext as Catalog;
-
- if (scrollViewer != null && _catalog != null)
- {
- scrollViewer.ScrollToTop();
- _preventChange = true;
- slider.Value = _catalog.Groups.Count;
- _preventChange = false;
- }
- };
-
- scrollViewer.Scrolling += ScrollViewer_Scrolling;
- }
-
- /// <summary>
- /// Handles the Scrolling event of the ScrollViewer control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="Touch.Controls.DoubleValueChangedEventArgs"/> instance containing the event data.</param>
- private void ScrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e)
- {
- if (!_preventChange)
- {
- if (e.Value > _lastScrollPosition + 60 || e.Value < _lastScrollPosition - 60)
- {
- var group = renderer.GetVisibleGroup();
-
- if (group != null)
- {
- _preventChange = true;
- slider.Value = slider.Maximum - _catalog.Groups.IndexOf(group);
- _preventChange = false;
- }
-
- _lastScrollPosition = e.Value;
- }
- }
- }
-
- /// <summary>
- /// Handles the ValueChanged event of the TouchSlider control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="RoutedPropertyChangedEventArgs{System.Double}"/> instance containing the event data.</param>
- private void TouchSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
- {
- if (_catalog == null || _catalog.Groups.Count == 0) return;
-
- if (!_preventChange)
- {
- if (_catalog != null)
- {
- _preventChange = true;
- var group = _catalog.Groups.ElementAt(_catalog.Groups.Count - 1 - (int)e.NewValue);
- scrollViewer.ScrollToPosition(renderer.GetGroupPosition(group));
- _preventChange = false;
- }
- }
-
- if (_catalog != null && _catalog.Groups.Count > _catalog.Groups.Count - 1 - (int)e.NewValue && _catalog.Groups.Count - 1 - (int)e.NewValue > -1)
- {
- slider.Foreground = new SolidColorBrush(_catalog.Groups.ElementAt(_catalog.Groups.Count - 1 - (int)e.NewValue).Color);
- }
- }
- }
-}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml
index 65db9818c..4d21de67e 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml
@@ -6,9 +6,9 @@
xmlns:local="clr-namespace:Tango.PPC.Common.Controls"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
- xmlns:catalog="clr-namespace:Tango.BL.Catalogs;assembly=Tango.BL"
+ xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=catalog:Catalog, IsDesignTimeCreatable=False}">
+ d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=entities:ColorCatalog, IsDesignTimeCreatable=False}">
<Grid>
<Grid>
@@ -19,7 +19,7 @@
<touch:LightTouchScrollViewer x:Name="scrollViewer" ScrollBarVisibility="Collapsed">
<!--<Border Background="White">-->
- <local:TwineCatalogRenderer x:Name="renderer" Groups="{Binding Groups}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=SelectedItem,Mode=TwoWay}"></local:TwineCatalogRenderer>
+ <local:TwineCatalogRenderer x:Name="renderer" Groups="{Binding ColorCatalogsGroups}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=SelectedItem,Mode=TwoWay}"></local:TwineCatalogRenderer>
<!--</Border>-->
</touch:LightTouchScrollViewer>
@@ -112,7 +112,7 @@
</RectangleGeometry.Rect>
</RectangleGeometry>
</Border.Clip>
- <ItemsControl ItemsSource="{Binding Groups}">
+ <ItemsControl ItemsSource="{Binding ColorCatalogsGroups}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1" />
@@ -131,7 +131,7 @@
</Border>
<Grid Grid.Column="1">
- <touch:TouchSlider x:Name="slider" ValueChanged="TouchSlider_ValueChanged" IsSnapToTickEnabled="True" Minimum="0" Maximum="{Binding Groups.Count,Converter={StaticResource MathOperatorConverter},ConverterParameter='-1'}" Orientation="Vertical" Width="40" Height="Auto" IsSelectionRangeEnabled="False">
+ <touch:TouchSlider x:Name="slider" ValueChanged="TouchSlider_ValueChanged" IsSnapToTickEnabled="True" Minimum="0" Maximum="{Binding ColorCatalogsGroups.Count,Converter={StaticResource MathOperatorConverter},ConverterParameter='-1'}" Orientation="Vertical" Width="40" Height="Auto" IsSelectionRangeEnabled="False">
<touch:TouchSlider.ThumbTemplate>
<ControlTemplate>
<touch:TouchIcon Foreground="{Binding RelativeSource={RelativeSource AncestorType=touch:TouchSlider},Path=Foreground}" Width="40" Height="40" Icon="Water" Angle="-90" />
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs
index 5985fbd49..2f584740c 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs
@@ -12,7 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
-using Tango.BL.Catalogs;
+using Tango.BL.Entities;
using Tango.Touch.Controls;
namespace Tango.PPC.Common.Controls
@@ -24,20 +24,20 @@ namespace Tango.PPC.Common.Controls
/// <seealso cref="System.Windows.Markup.IComponentConnector" />
public partial class TwineCatalogControl : UserControl
{
- private Catalog _catalog;
+ private ColorCatalog _catalog;
private bool _preventChange;
private double _lastScrollPosition = 0;
/// <summary>
/// Gets or sets the selected catalog item.
/// </summary>
- public CatalogItem SelectedItem
+ public ColorCatalogsItem SelectedItem
{
- get { return (CatalogItem)GetValue(SelectedItemProperty); }
+ get { return (ColorCatalogsItem)GetValue(SelectedItemProperty); }
set { SetValue(SelectedItemProperty, value); }
}
public static readonly DependencyProperty SelectedItemProperty =
- DependencyProperty.Register("SelectedItem", typeof(CatalogItem), typeof(TwineCatalogControl), new PropertyMetadata(null));
+ DependencyProperty.Register("SelectedItem", typeof(ColorCatalogsItem), typeof(TwineCatalogControl), new PropertyMetadata(null));
/// <summary>
/// Initializes a new instance of the <see cref="TwineCatalogControl"/> class.
@@ -50,13 +50,13 @@ namespace Tango.PPC.Common.Controls
//list.Loaded += TwineCatalogControl_Loaded;
DataContextChanged += (x, y) =>
{
- _catalog = DataContext as Catalog;
+ _catalog = DataContext as ColorCatalog;
if (scrollViewer != null && _catalog != null)
{
scrollViewer.ScrollToTop();
_preventChange = true;
- slider.Value = _catalog.Groups.Count;
+ slider.Value = _catalog.ColorCatalogsGroups.Count;
_preventChange = false;
}
};
@@ -80,7 +80,7 @@ namespace Tango.PPC.Common.Controls
if (group != null)
{
_preventChange = true;
- slider.Value = slider.Maximum - _catalog.Groups.IndexOf(group);
+ slider.Value = slider.Maximum - _catalog.ColorCatalogsGroups.IndexOf(group);
_preventChange = false;
}
@@ -96,22 +96,22 @@ namespace Tango.PPC.Common.Controls
/// <param name="e">The <see cref="RoutedPropertyChangedEventArgs{System.Double}"/> instance containing the event data.</param>
private void TouchSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
- if (_catalog == null || _catalog.Groups.Count == 0) return;
+ if (_catalog == null || _catalog.ColorCatalogsGroups.Count == 0) return;
if (!_preventChange)
{
if (_catalog != null)
{
_preventChange = true;
- var group = _catalog.Groups.ElementAt(_catalog.Groups.Count - 1 - (int)e.NewValue);
+ var group = _catalog.ColorCatalogsGroups.ElementAt(_catalog.ColorCatalogsGroups.Count - 1 - (int)e.NewValue);
scrollViewer.ScrollToPosition(renderer.GetGroupPosition(group));
_preventChange = false;
}
}
- if (_catalog != null && _catalog.Groups.Count > _catalog.Groups.Count - 1 - (int)e.NewValue && _catalog.Groups.Count - 1 - (int)e.NewValue > -1)
+ if (_catalog != null && _catalog.ColorCatalogsGroups.Count > _catalog.ColorCatalogsGroups.Count - 1 - (int)e.NewValue && _catalog.ColorCatalogsGroups.Count - 1 - (int)e.NewValue > -1)
{
- slider.Foreground = new SolidColorBrush(_catalog.Groups.ElementAt(_catalog.Groups.Count - 1 - (int)e.NewValue).Color);
+ slider.Foreground = new SolidColorBrush(_catalog.ColorCatalogsGroups.ElementAt(_catalog.ColorCatalogsGroups.Count - 1 - (int)e.NewValue).Color);
}
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs
index 7a8ddbb46..eafef2847 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogRenderer.cs
@@ -9,7 +9,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
-using Tango.BL.Catalogs;
+using Tango.BL.Entities;
using Tango.Touch.Controls;
namespace Tango.PPC.Common.Controls
@@ -19,14 +19,14 @@ namespace Tango.PPC.Common.Controls
private class ItemContainer
{
public DrawingVisual Visual { get; set; }
- public CatalogItem Item { get; set; }
+ public ColorCatalogsItem Item { get; set; }
public double PositionY { get; set; }
}
private class GroupContainer
{
public DrawingVisual Visual { get; set; }
- public CatalogGroup Group { get; set; }
+ public ColorCatalogsGroup Group { get; set; }
public double PositionY { get; set; }
public List<ItemContainer> Items { get; set; }
@@ -49,21 +49,21 @@ namespace Tango.PPC.Common.Controls
private bool selectedFromClick;
private LightTouchScrollViewer _scrollViewer;
- public List<CatalogGroup> Groups
+ public IEnumerable<ColorCatalogsGroup> Groups
{
- get { return (List<CatalogGroup>)GetValue(GroupsProperty); }
+ get { return (IEnumerable<ColorCatalogsGroup>)GetValue(GroupsProperty); }
set { SetValue(GroupsProperty, value); }
}
public static readonly DependencyProperty GroupsProperty =
- DependencyProperty.Register("Groups", typeof(List<CatalogGroup>), typeof(TwineCatalogRenderer), new PropertyMetadata(null, (d, e) => { (d as TwineCatalogRenderer).OnCatalogChanged(); }));
+ DependencyProperty.Register("Groups", typeof(IEnumerable<ColorCatalogsGroup>), typeof(TwineCatalogRenderer), new PropertyMetadata(null, (d, e) => { (d as TwineCatalogRenderer).OnCatalogChanged(); }));
- public CatalogItem SelectedItem
+ public ColorCatalogsItem SelectedItem
{
- get { return (CatalogItem)GetValue(SelectedItemProperty); }
+ get { return (ColorCatalogsItem)GetValue(SelectedItemProperty); }
set { SetValue(SelectedItemProperty, value); }
}
public static readonly DependencyProperty SelectedItemProperty =
- DependencyProperty.Register("SelectedItem", typeof(CatalogItem), typeof(TwineCatalogRenderer), new PropertyMetadata(null, (d, e) => (d as TwineCatalogRenderer).OnSelectedItemChanged(e.OldValue, e.NewValue)));
+ DependencyProperty.Register("SelectedItem", typeof(ColorCatalogsItem), typeof(TwineCatalogRenderer), new PropertyMetadata(null, (d, e) => (d as TwineCatalogRenderer).OnSelectedItemChanged(e.OldValue, e.NewValue)));
public Brush Foreground
{
@@ -99,7 +99,7 @@ namespace Tango.PPC.Common.Controls
_scrollViewer = this.FindAncestor<LightTouchScrollViewer>();
}
- public CatalogGroup GetVisibleGroup()
+ public ColorCatalogsGroup GetVisibleGroup()
{
double currentPosition = _scrollViewer.GetScrollPosition();
@@ -118,7 +118,7 @@ namespace Tango.PPC.Common.Controls
return null;
}
- public double GetGroupPosition(CatalogGroup group)
+ public double GetGroupPosition(ColorCatalogsGroup group)
{
return _groupItems.Single(x => x.Group == group).PositionY;
}
@@ -153,7 +153,7 @@ namespace Tango.PPC.Common.Controls
{
var container = _catalogItems.SingleOrDefault(x => x.Visual == visual);
- if (container != null && container.Item is CatalogItem)
+ if (container != null && container.Item is ColorCatalogsItem)
{
selectedFromClick = true;
SelectedItem = container.Item;
@@ -189,7 +189,7 @@ namespace Tango.PPC.Common.Controls
}
}
- private ItemContainer AddCatalogItem(DrawingVisual visual, CatalogItem item, double y)
+ private ItemContainer AddCatalogItem(DrawingVisual visual, ColorCatalogsItem item, double y)
{
_children.Add(visual);
@@ -205,7 +205,7 @@ namespace Tango.PPC.Common.Controls
return container;
}
- private GroupContainer AddGroupItem(DrawingVisual visual, CatalogGroup group, double y)
+ private GroupContainer AddGroupItem(DrawingVisual visual, ColorCatalogsGroup group, double y)
{
_children.Add(visual);
@@ -240,7 +240,7 @@ namespace Tango.PPC.Common.Controls
position_y += ellipseMargin;
- foreach (var item in group.Items)
+ foreach (var item in group.ColorCatalogsItems)
{
double x = position_x + ellipseMargin;
@@ -265,12 +265,12 @@ namespace Tango.PPC.Common.Controls
//InvalidateVisual();
}
- private DrawingVisual CreateItem(CatalogItem item, double x, double y)
+ private DrawingVisual CreateItem(ColorCatalogsItem item, double x, double y)
{
DrawingVisual drawingVisual = new DrawingVisual();
DrawingContext drawingContext = drawingVisual.RenderOpen();
- drawingContext.DrawEllipse(item.Brush, null, new Point(x + ellipseWidth / 2, y + ellipseHeight / 2), ellipseWidth / 2, ellipseHeight / 2);
+ drawingContext.DrawEllipse(new SolidColorBrush(item.Color), null, new Point(x + ellipseWidth / 2, y + ellipseHeight / 2), ellipseWidth / 2, ellipseHeight / 2);
var formattedText = new FormattedText(item.Name,
CultureInfo.GetCultureInfo("en-us"),