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.Entities;
using Tango.Touch.Components;
namespace Tango.PPC.Jobs.Controls
{
///
/// Represents a twine viewer control.
///
///
///
public partial class TwineCatalogViewer : UserControl
{
private ColorCatalog _originalCatalog;
///
/// Gets or sets the recent catalog items as a catalog.
///
public ColorCatalog Recent
{
get { return (ColorCatalog)GetValue(RecentProperty); }
set { SetValue(RecentProperty, value); }
}
public static readonly DependencyProperty RecentProperty =
DependencyProperty.Register("Recent", typeof(ColorCatalog), typeof(TwineCatalogViewer), new PropertyMetadata(null));
///
/// Gets or sets the catalog.
///
public ColorCatalog Catalog
{
get { return (ColorCatalog)GetValue(CatalogProperty); }
set { SetValue(CatalogProperty, value); }
}
public static readonly DependencyProperty CatalogProperty =
DependencyProperty.Register("Catalog", typeof(ColorCatalog), typeof(TwineCatalogViewer), new PropertyMetadata(null));
///
/// Gets or sets the selected catalog item.
///
public ColorCatalogsItem SelectedItem
{
get { return (ColorCatalogsItem)GetValue(SelectedItemProperty); }
set { SetValue(SelectedItemProperty, value); }
}
public static readonly DependencyProperty SelectedItemProperty =
DependencyProperty.Register("SelectedItem", typeof(ColorCatalogsItem), typeof(TwineCatalogViewer), new PropertyMetadata(null));
///
/// Gets or sets the current catalog filter.
///
public String Filter
{
get { return (String)GetValue(FilterProperty); }
set { SetValue(FilterProperty, value); }
}
public static readonly DependencyProperty FilterProperty =
DependencyProperty.Register("Filter", typeof(String), typeof(TwineCatalogViewer), new PropertyMetadata(null,(d,e) => (d as TwineCatalogViewer).OnFilterChanged()));
///
/// Gets or sets the collection filter.
///
public ICollectionFilter CollectionFilter
{
get { return (ICollectionFilter)GetValue(CollectionFilterProperty); }
set { SetValue(CollectionFilterProperty, value); }
}
public static readonly DependencyProperty CollectionFilterProperty =
DependencyProperty.Register("CollectionFilter", typeof(ICollectionFilter), typeof(TwineCatalogViewer), new PropertyMetadata(null, (d, e) => (d as TwineCatalogViewer).OnCollectionFilterChanged()));
private void OnCollectionFilterChanged()
{
}
///
/// Called when the filter has been changed
///
private void OnFilterChanged()
{
if (Filter == "CATALOG" && _originalCatalog != null)
{
Catalog = _originalCatalog;
_originalCatalog = null;
}
else if (Filter == "RECENT")
{
_originalCatalog = Catalog;
Catalog = Recent;
}
}
///
/// Initializes a new instance of the class.
///
public TwineCatalogViewer()
{
InitializeComponent();
Filter = "CATALOG";
}
}
}