Пример #1
0
        /// <summary>
        /// Swaps control displaying current photo with the control for the next photo, enabling transition.
        /// </summary>
        private void SwapChildren()
        {
            FacebookImageControl temp = this._currentChild;

            this._currentChild        = this._oldChild;
            this._oldChild            = temp;
            this._currentChild.Width  = double.NaN;
            this._currentChild.Height = double.NaN;
            if (this._photoHost != null)
            {
                this._photoHost.Child = this._currentChild;
            }

            this._oldChild.Effect = null;
        }
Пример #2
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            PhotoImage = this.Template.FindName("PART_PhotoImage", this) as FacebookImageControl;
            Assert.IsNotNull(PhotoImage);

            _frameControl = this.Template.FindName("PART_PhotoFrameControl", this) as ContentControl;
            Assert.IsNotNull(_frameControl);

            _canvas = this.Template.FindName("PART_ManipulationCanvas", this) as Canvas;
            Assert.IsNotNull(_canvas);

            this.FacebookImageControl = PhotoImage;
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the PhotoSlideShowControl class.
        /// </summary>
        public PhotoSlideShowControl()
        {
            _currentChild = new FacebookImageControl
            {
                Style = (Style)Application.Current.Resources["SimpleSlideShowImageControlStyle"]
            };
            _oldChild = new FacebookImageControl
            {
                Style = (Style)Application.Current.Resources["SimpleSlideShowImageControlStyle"]
            };

            _transitionTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(totalAnimationPeriod), DispatcherPriority.Input, this.OnTransitionTimerTick, Dispatcher);
            _transitionTimer.Stop();

            _mousePointerTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(totalAnimationPeriod), DispatcherPriority.Input, this.OnMousePointerTimerTick, Dispatcher);
            _mousePointerTimer.Stop();

            currentAnimationType = AnimationType.None;

            transformGroup     = new TransformGroup();
            translateTransform = new TranslateTransform(transAnimFrom, transAnimFrom);
            scaleTransform     = new ScaleTransform(scaleAnimFrom, scaleAnimFrom);
            transformGroup.Children.Add(this.translateTransform);
            transformGroup.Children.Add(this.scaleTransform);

            this.Loaded   += this.OnLoaded;
            this.Unloaded += this.OnUnloaded;

            this.InputBindings.Add(new InputBinding(MediaCommands.Stop, new KeyGesture(Key.Escape)));
            this.InputBindings.Add(new InputBinding(MediaCommands.NextTrack, new KeyGesture(Key.Right)));
            this.InputBindings.Add(new InputBinding(MediaCommands.PreviousTrack, new KeyGesture(Key.Left)));
            this.CommandBindings.Add(new CommandBinding(System.Windows.Input.MediaCommands.TogglePlayPause, new ExecutedRoutedEventHandler(OnPlayPauseCommandExecuted), new CanExecuteRoutedEventHandler(OnPlayPauseCommandCanExecute)));
            this.CommandBindings.Add(new CommandBinding(System.Windows.Input.MediaCommands.Pause, new ExecutedRoutedEventHandler(OnPauseCommandExecuted), new CanExecuteRoutedEventHandler(OnPauseCommandCanExecute)));
            this.CommandBindings.Add(new CommandBinding(System.Windows.Input.MediaCommands.Play, new ExecutedRoutedEventHandler(OnResumeCommandExecuted), new CanExecuteRoutedEventHandler(OnResumeCommandCanExecute)));
            this.CommandBindings.Add(new CommandBinding(System.Windows.Input.MediaCommands.NextTrack, new ExecutedRoutedEventHandler(OnNextSlideCommandExecuted), new CanExecuteRoutedEventHandler(OnNextSlideCommandCanExecute)));
            this.CommandBindings.Add(new CommandBinding(System.Windows.Input.MediaCommands.PreviousTrack, new ExecutedRoutedEventHandler(OnPreviousSlideCommandExecuted), new CanExecuteRoutedEventHandler(OnPreviousSlideCommandCanExecute)));
            this.CommandBindings.Add(new CommandBinding(System.Windows.Input.MediaCommands.Stop, new ExecutedRoutedEventHandler(OnStopCommandExecuted), new CanExecuteRoutedEventHandler(OnStopCommandCanExecute)));
            this.CommandBindings.Add(new CommandBinding(ToggleShuffleCommand, _OnToggleShuffleCommandExecuted, _OnToggleShuffleCommandCanExecute));
        }