/// <inheritdoc /> 
        protected override void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
        {
            base.OnViewModelChanged(oldValue, newValue);

            BindingOperations.SetBinding(this, MediaToggleControlBehavior.SetContentProperty, new Binding() { Path = new PropertyPath("SkipBackInterval"), Source = newValue, Converter = new StringFormatConverter() { StringFormat = skipBackPointerOverStringFormat } });
            BindingOperations.SetBinding(this, MediaToggleControlBehavior.UnsetContentProperty, new Binding() { Path = new PropertyPath("Position"), Source = newValue, Converter = ViewModel != null ? ViewModel.TimeFormatConverter : null });
        }
        /// <summary>
        /// Provides notification that the view model has changed.
        /// </summary>
        /// <param name="oldValue">The old view model. Note: this could be null.</param>
        /// <param name="newValue">The new view model. Note: this could be null.</param>
        protected virtual void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
        {
            var vmCommand = command as ViewModelCommand;

            if (vmCommand != null)
            {
                vmCommand.ViewModel = newValue;
            }
        }
        /// <inheritdoc />
        protected override void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
        {
            base.OnViewModelChanged(oldValue, newValue);

            BindingOperations.SetBinding(this, MediaControlBehavior.ContentProperty, new Binding()
            {
                Path = new PropertyPath("TimeRemaining"), Source = newValue, Converter = ViewModel != null ? ViewModel.TimeFormatConverter : null
            });
        }
        /// <inheritdoc />
        protected override void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
        {
            base.OnViewModelChanged(oldValue, newValue);

            BindingOperations.SetBinding(this, MediaToggleControlBehavior.IsSetProperty, new Binding()
            {
                Path = new PropertyPath("Zoom"), Source = newValue
            });
        }
Exemplo n.º 5
0
 /// <summary>
 /// Provides notification that the view model has changed.
 /// </summary>
 /// <param name="oldValue">The old view model. Note: this could be null.</param>
 /// <param name="newValue">The new view model. Note: this could be null.</param>
 protected virtual void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
 {
     if (Slider != null)
     {
         Slider.SetBinding(SeekableSlider.ActualValueProperty, new Binding()
         {
             Path = new PropertyPath("Volume"), Source = ViewModel
         });
     }
 }
Exemplo n.º 6
0
        void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
        {
            if (oldValue != null)
            {
                oldValue.CurrentStateChanged -= CurrentStateChanged;
            }

            UpdateVisualStates();

            if (newValue != null)
            {
                newValue.CurrentStateChanged += CurrentStateChanged;
            }
        }
        void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
        {
            if (oldValue != null)
            {
                oldValue.CurrentStateChanged -= CurrentStateChanged;
            }

            UpdateVisualStates();

            if (newValue != null)
            {
                newValue.CurrentStateChanged += CurrentStateChanged;
            }
        }
Exemplo n.º 8
0
 void UnwireEvents(IInteractiveViewModel viewModel)
 {
     if (viewModel != null)
     {
         viewModel.CurrentStateChanged          -= Player_CurrentStateChanged;
         viewModel.IsStopEnabledChanged         -= Player_IsStopEnabledChanged;
         viewModel.IsRewindEnabledChanged       -= Player_IsRewindEnabledChanged;
         viewModel.IsFastForwardEnabledChanged  -= Player_IsFastForwardEnabledChanged;
         viewModel.IsPlayResumeEnabledChanged   -= Player_IsPlayResumeEnabledChanged;
         viewModel.IsPauseEnabledChanged        -= Player_IsPauseEnabledChanged;
         viewModel.IsSkipNextEnabledChanged     -= Player_IsSkipNextEnabledChanged;
         viewModel.IsSkipPreviousEnabledChanged -= Player_IsSkipPreviousEnabledChanged;
     }
 }
Exemplo n.º 9
0
 void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
 {
     if (oldValue != null)
     {
         UninitializeViewModel(oldValue);
     }
     if (newValue != null)
     {
         if (IsTemplateApplied)
         {
             InitializeViewModel(newValue);
         }
     }
 }
Exemplo n.º 10
0
 void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
 {
     if (oldValue != null)
     {
         UninitializeViewModel(oldValue);
     }
     if (newValue != null)
     {
         if (IsTemplateApplied)
         {
             InitializeViewModel(newValue);
         }
     }
 }
 void UnwireEvents(IInteractiveViewModel viewModel)
 {
     if (viewModel != null)
     {
         viewModel.CurrentStateChanged -= Player_CurrentStateChanged;
         viewModel.IsStopEnabledChanged -= Player_IsStopEnabledChanged;
         viewModel.IsRewindEnabledChanged -= Player_IsRewindEnabledChanged;
         viewModel.IsFastForwardEnabledChanged -= Player_IsFastForwardEnabledChanged;
         viewModel.IsPlayResumeEnabledChanged -= Player_IsPlayResumeEnabledChanged;
         viewModel.IsPauseEnabledChanged -= Player_IsPauseEnabledChanged;
         viewModel.IsSkipNextEnabledChanged -= Player_IsSkipNextEnabledChanged;
         viewModel.IsSkipPreviousEnabledChanged -= Player_IsSkipPreviousEnabledChanged;
     }
 }
Exemplo n.º 12
0
        private void OnClose()
        {
            if (captionSelectorView != null)
            {
                captionSelectorView.SelectedCaptionChanged -= captionSelectorView_SelectedCaptionChanged;
                captionSelectorView.Close     -= captionSelectorView_Close;
                captionSelectorView.Visibility = Visibility.Collapsed;
                vm = null;

                SettingsContainer.Children.Remove(captionSelectorView);
                SettingsContainer.Visibility            = Visibility.Collapsed;
                MediaPlayer.InteractiveDeactivationMode = deactivationMode;
                captionSelectorView = null;
            }
        }
Exemplo n.º 13
0
        /// <inheritdoc />
        protected override void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
        {
            base.OnViewModelChanged(oldValue, newValue);

            BindingOperations.SetBinding(this, MediaToggleControlBehavior.SetContentProperty, new Binding()
            {
                Path = new PropertyPath("SkipBackInterval"), Source = newValue, Converter = new StringFormatConverter()
                {
                    StringFormat = skipBackPointerOverStringFormat
                }
            });
            BindingOperations.SetBinding(this, MediaToggleControlBehavior.UnsetContentProperty, new Binding()
            {
                Path = new PropertyPath("Position"), Source = newValue, Converter = ViewModel != null ? ViewModel.TimeFormatConverter : null
            });
        }
        void MediaPlayer_CaptionsInvoked(object sender, RoutedEventArgs e)
        {
            if (MediaPlayer.AvailableCaptions.Any())
            {
                captionSelectorView = new CaptionSelectorView();
                if (CaptionSelectorViewStyle != null) captionSelectorView.Style = CaptionSelectorViewStyle;

                vm = MediaPlayer.InteractiveViewModel;
                captionSelectorView.AvailableCaptions = vm.AvailableCaptions;
                captionSelectorView.SelectedCaption = vm.SelectedCaption;

                SettingsContainer.Visibility = Visibility.Visible;
                SettingsContainer.Children.Add(captionSelectorView);
                captionSelectorView.Close += captionSelectorView_Close;
                captionSelectorView.SelectedCaptionChanged += captionSelectorView_SelectedCaptionChanged;
                deactivationMode = MediaPlayer.InteractiveDeactivationMode;
                MediaPlayer.InteractiveDeactivationMode = InteractionType.None;
            }
        }
Exemplo n.º 15
0
        void MediaPlayer_CaptionsInvoked(object sender, RoutedEventArgs e)
        {
            if (MediaPlayer.AvailableCaptions.Any())
            {
                captionSelectorView = new CaptionSelectorView();
                if (CaptionSelectorViewStyle != null)
                {
                    captionSelectorView.Style = CaptionSelectorViewStyle;
                }

                vm = MediaPlayer.InteractiveViewModel;
                captionSelectorView.AvailableCaptions = vm.AvailableCaptions;
                captionSelectorView.SelectedCaption   = vm.SelectedCaption;

                SettingsContainer.Visibility = Visibility.Visible;
                SettingsContainer.Children.Add(captionSelectorView);
                captionSelectorView.Close += captionSelectorView_Close;
                captionSelectorView.SelectedCaptionChanged += captionSelectorView_SelectedCaptionChanged;
                deactivationMode = MediaPlayer.InteractiveDeactivationMode;
                MediaPlayer.InteractiveDeactivationMode = InteractionType.None;
            }
        }
Exemplo n.º 16
0
 void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
 {
     InitializeProgressSlider();
 }
 void UninitializeViewModel(IInteractiveViewModel vm)
 {
     vm.CurrentStateChanged -= ViewModel_CurrentStateChanged;
 }
 void UninitializeViewModel(IInteractiveViewModel vm)
 {
     vm.CurrentStateChanged -= ViewModel_CurrentStateChanged;
 }
Exemplo n.º 19
0
 /// <summary>
 /// Provides notification that the view model has changed.
 /// </summary>
 /// <param name="oldValue">The old view model. Note: this could be null.</param>
 /// <param name="newValue">The new view model. Note: this could be null.</param>
 protected virtual void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
 {
     if (Slider != null)
     {
         Slider.SetBinding(SeekableSlider.ActualValueProperty, new Binding() { Path = new PropertyPath("Volume"), Source = ViewModel });
     }
 }
Exemplo n.º 20
0
 void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
 {
     InitializeProgressSlider();
 }
        private void OnClose()
        {
            if (captionSelectorView != null)
            {
                captionSelectorView.SelectedCaptionChanged -= captionSelectorView_SelectedCaptionChanged;
                captionSelectorView.Close -= captionSelectorView_Close;
                captionSelectorView.Visibility = Visibility.Collapsed;
                vm = null;

                SettingsContainer.Children.Remove(captionSelectorView);
                SettingsContainer.Visibility = Visibility.Collapsed;
                MediaPlayer.InteractiveDeactivationMode = deactivationMode;
                captionSelectorView = null;
            }
        }
        /// <inheritdoc /> 
        protected override void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
        {
            base.OnViewModelChanged(oldValue, newValue);

            BindingOperations.SetBinding(this, MediaControlBehavior.ContentProperty, new Binding() { Path = new PropertyPath("TimeRemaining"), Source = newValue, Converter = ViewModel != null ? ViewModel.TimeFormatConverter : null });
        }
        /// <inheritdoc /> 
        protected override void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue)
        {
            base.OnViewModelChanged(oldValue, newValue);

            BindingOperations.SetBinding(this, MediaToggleControlBehavior.IsSetProperty, new Binding() { Path = new PropertyPath("Zoom"), Source = newValue });
        }