private void PlaceholderInteractionGrid_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { if (e.PointerDeviceType != Windows.Devices.Input.PointerDeviceType.Touch) { AppViewHelper.ToggleFullscreen(); } }
void DoKeyboardAction(KeyboardAction keyboardAction) { // determine if it's a combination of keys or not if (virtualKeys[1] == VirtualKey.None && virtualKeys[2] == VirtualKey.None) { // this is a simple shortcut switch (keyboardAction.Action) { case VLCAction.FullscreenToggle: AppViewHelper.ToggleFullscreen(); break; case VLCAction.LeaveFullscreen: AppViewHelper.LeaveFullscreen(); break; case VLCAction.PauseToggle: Locator.MediaPlaybackViewModel.PlaybackService.Pause(); break; case VLCAction.Quit: App.Current.Exit(); break; case VLCAction.Stop: if (Locator.MediaPlaybackViewModel.PlaybackService.PlayingType == PlayingType.Video) { Locator.MediaPlaybackViewModel.GoBack.Execute(null); } break; case VLCAction.Previous: Locator.PlaybackService.Previous(); break; case VLCAction.Next: Locator.PlaybackService.Next(); break; case VLCAction.Faster: Locator.MediaPlaybackViewModel.ChangePlaybackSpeedRateCommand.Execute("faster"); break; case VLCAction.Slow: Locator.MediaPlaybackViewModel.ChangePlaybackSpeedRateCommand.Execute("slower"); break; case VLCAction.NormalRate: Locator.MediaPlaybackViewModel.ChangePlaybackSpeedRateCommand.Execute("reset"); break; case VLCAction.Mute: Locator.MediaPlaybackViewModel.ChangeVolumeCommand.Execute("mute"); break; case VLCAction.Back: Locator.NavigationService.GoBack_Specific(); break; } } else if (virtualKeys[2] == VirtualKey.None) { // two keys shortcut if (virtualKeys[0] == VirtualKey.Control && virtualKeys[1] == keyboardAction.SecondKey) { //two keys shortcut, first key is Ctrl switch (keyboardAction.Action) { case VLCAction.OpenFile: { Locator.MediaPlaybackViewModel.PickMediaCommand.Execute(null); } break; case VLCAction.OpenNetwork: { Locator.MainVM.GoToStreamPanel.Execute(null); } break; case VLCAction.VolumeUp: Locator.MediaPlaybackViewModel.ChangeVolumeCommand.Execute("higher"); break; case VLCAction.VolumeDown: Locator.MediaPlaybackViewModel.ChangeVolumeCommand.Execute("lower"); break; case VLCAction.TabNext: var pivotIndex = Locator.MainVM.Panels.IndexOf(Locator.MainVM.CurrentPanel); pivotIndex = (pivotIndex < Locator.MainVM.Panels.Count - 1) ? ++pivotIndex : 0; Locator.NavigationService.Go(Locator.MainVM.Panels[pivotIndex].Target); break; } } } }
private void FullscreenToggle_Click(object sender, RoutedEventArgs e) { AppViewHelper.ToggleFullscreen(); }
private void PlaceholderInteractionGrid_Loaded(object sender, RoutedEventArgs args) { var menu = new MenuFlyout(); menu.Items.Add(new MenuFlyoutItem() { Name = "PlayPauseItem", Command = new ActionCommand(() => Locator.MediaPlaybackViewModel.PlaybackService.Pause()) }); menu.Items.Add(new MenuFlyoutItem() { Text = Strings.Stop, Command = new ActionCommand(() => Locator.MediaPlaybackViewModel.GoBack.Execute(null)) }); menu.Items.Add(new MenuFlyoutSeparator()); var audioSubItem = new MenuFlyoutSubItem(); audioSubItem.Text = Strings.Audio; audioSubItem.Name = "AudioSubItem"; var audioTracksSubItem = new MenuFlyoutSubItem() { Text = Strings.AudioTracks, Name = "AudioTracksSubItem" }; audioSubItem.Items.Add(audioTracksSubItem); audioSubItem.Items.Add(new MenuFlyoutSeparator()); audioSubItem.Items.Add(new MenuFlyoutItem() { Text = Strings.IncreaseVolume, Command = new ActionCommand(() => Locator.MediaPlaybackViewModel.ChangeVolumeCommand.Execute("higher")) }); audioSubItem.Items.Add(new MenuFlyoutItem() { Text = Strings.DecreaseVolume, Command = new ActionCommand(() => Locator.MediaPlaybackViewModel.ChangeVolumeCommand.Execute("lower")) }); audioSubItem.Items.Add(new MenuFlyoutItem() { Text = Strings.Mute, Command = new ActionCommand(() => Locator.MediaPlaybackViewModel.ChangeVolumeCommand.Execute("mute")) }); menu.Items.Add(audioSubItem); var videoSubItem = new MenuFlyoutSubItem(); videoSubItem.Text = Strings.Video; videoSubItem.Name = "VideoSubItem"; videoSubItem.Items.Add(new MenuFlyoutItem() { Text = "Fullscreen toggle", Command = new ActionCommand(() => AppViewHelper.ToggleFullscreen()) }); videoSubItem.Items.Add(new MenuFlyoutItem() { Text = Strings.Zoom, Command = new ActionCommand(() => Locator.VideoPlayerVm.ToggleIsVideoPlayerOptionsPanelVisible.Execute(null)) }); videoSubItem.Items.Add(new MenuFlyoutSeparator()); var subtitlesSubItem = new MenuFlyoutSubItem() { Text = Strings.Subtitles, Name = "SubtitlesSubItem" }; videoSubItem.Items.Add(subtitlesSubItem); menu.Items.Add(videoSubItem); var playbackSubItem = new MenuFlyoutSubItem(); playbackSubItem.Text = Strings.Playback; playbackSubItem.Items.Add(new MenuFlyoutItem() { Text = Strings.Chapters, Command = new ActionCommand(() => Locator.VideoPlayerVm.ToggleIsVideoPlayerOptionsPanelVisible.Execute(null)) }); playbackSubItem.Items.Add(new MenuFlyoutSeparator()); playbackSubItem.Items.Add(new MenuFlyoutItem() { Text = Strings.IncreaseSpeed, Command = new ActionCommand(() => Locator.MediaPlaybackViewModel.ChangePlaybackSpeedRateCommand.Execute("faster")) }); playbackSubItem.Items.Add(new MenuFlyoutItem() { Text = Strings.DecreaseSpeed, Command = new ActionCommand(() => Locator.MediaPlaybackViewModel.ChangePlaybackSpeedRateCommand.Execute("slower")) }); playbackSubItem.Items.Add(new MenuFlyoutItem() { Text = Strings.ResetSpeed, Command = new ActionCommand(() => Locator.MediaPlaybackViewModel.ChangePlaybackSpeedRateCommand.Execute("reset")) }); menu.Items.Add(playbackSubItem); menu.Opened += (s, e) => { ((MenuFlyoutItem)menu.Items.FirstOrDefault(x => x.Name == "PlayPauseItem")).Text = Strings.Play + " " + Strings.Dash + " " + Strings.Pause; var videoSubItemMenu = (MenuFlyoutSubItem)menu.Items.FirstOrDefault(x => x.Name == "VideoSubItem"); var subtitlesSubItemMenu = (MenuFlyoutSubItem)videoSubItemMenu.Items.FirstOrDefault(x => x.Name == "SubtitlesSubItem"); subtitlesSubItemMenu.Items.Clear(); foreach (var sub in Locator.MediaPlaybackViewModel.Subtitles) { videoSubItemMenu.Items.Add(new MenuFlyoutItem() { Text = sub.Name, }); } if (!Locator.MediaPlaybackViewModel.Subtitles.Any()) { subtitlesSubItemMenu.IsEnabled = false; } var audioSubItemMenu = (MenuFlyoutSubItem)menu.Items.FirstOrDefault(x => x.Name == "AudioSubItem"); var audioTracksSubItemMenu = (MenuFlyoutSubItem)audioSubItemMenu.Items.FirstOrDefault(x => x.Name == "AudioTracksSubItem"); audioTracksSubItemMenu.Items.Clear(); foreach (var audTrack in Locator.MediaPlaybackViewModel.AudioTracks) { audioTracksSubItemMenu.Items.Add(new MenuFlyoutItem() { Text = audTrack.Name, Command = new ActionCommand(() => { Locator.MediaPlaybackViewModel.CurrentAudioTrack = audTrack; }) }); } }; PlaceholderInteractionGrid.ContextFlyout = menu; }