/// <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 }); }
/// <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 }); } }
void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue) { if (oldValue != null) { oldValue.CurrentStateChanged -= CurrentStateChanged; } UpdateVisualStates(); if (newValue != null) { newValue.CurrentStateChanged += CurrentStateChanged; } }
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; } }
void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue) { if (oldValue != null) { UninitializeViewModel(oldValue); } if (newValue != null) { if (IsTemplateApplied) { InitializeViewModel(newValue); } } }
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; } }
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; } }
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; } }
void OnViewModelChanged(IInteractiveViewModel oldValue, IInteractiveViewModel newValue) { InitializeProgressSlider(); }
void UninitializeViewModel(IInteractiveViewModel vm) { vm.CurrentStateChanged -= ViewModel_CurrentStateChanged; }