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; } }