diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.cs | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.cs deleted file mode 100644 index ba2550e25..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -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.Markup; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Threading; -using Tango.SharedUI.Controls; - -namespace Tango.PPC.Common.Controls -{ - [ContentProperty(nameof(Elements))] - public class ImageGalleryControl : Control - { - private NavigationControl _navigationControl; - private DispatcherTimer _timer; - - public int SelectedIndex - { - get { return (int)GetValue(SelectedIndexProperty); } - set { SetValue(SelectedIndexProperty, value); } - } - public static readonly DependencyProperty SelectedIndexProperty = - DependencyProperty.Register("SelectedIndex", typeof(int), typeof(ImageGalleryControl), new PropertyMetadata(0)); - - public ObservableCollection<FrameworkElement> Elements - { - get { return (ObservableCollection<FrameworkElement>)GetValue(ElementsProperty); } - set { SetValue(ElementsProperty, value); } - } - public static readonly DependencyProperty ElementsProperty = - DependencyProperty.Register("Elements", typeof(ObservableCollection<FrameworkElement>), typeof(ImageGalleryControl), new PropertyMetadata(null)); - - public Duration Duration - { - get { return (Duration)GetValue(DurationProperty); } - set { SetValue(DurationProperty, value); } - } - public static readonly DependencyProperty DurationProperty = - DependencyProperty.Register("Duration", typeof(Duration), typeof(ImageGalleryControl), new PropertyMetadata(new Duration(TimeSpan.FromSeconds(2)))); - - - static ImageGalleryControl() - { - DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageGalleryControl), new FrameworkPropertyMetadata(typeof(ImageGalleryControl))); - } - - public ImageGalleryControl() - { - Elements = new ObservableCollection<FrameworkElement>(); - Loaded += ImageGalleryControl_Loaded; - - _timer = new DispatcherTimer(); - _timer.Tick += _timer_Tick; - } - - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); - - _navigationControl = GetTemplateChild("navigationControl") as NavigationControl; - } - - private void ImageGalleryControl_Loaded(object sender, RoutedEventArgs e) - { - if (_navigationControl != null) - { - _navigationControl.Elements = Elements; - - _timer.Interval = Duration.TimeSpan; - - if (!DesignerProperties.GetIsInDesignMode(new DependencyObject())) - { - _timer.Start(); - } - } - } - - private void _timer_Tick(object sender, EventArgs e) - { - if (SelectedIndex < Elements.Count - 1) - { - SelectedIndex++; - } - else - { - SelectedIndex = 0; - } - } - - protected override void OnPreviewMouseDown(MouseButtonEventArgs e) - { - base.OnPreviewMouseDown(e); - _timer.Stop(); - } - - protected override void OnPreviewMouseUp(MouseButtonEventArgs e) - { - base.OnPreviewMouseUp(e); - _timer.Start(); - } - } -} |
