private async void MiniPlayerWindow_Loaded(object sender, RoutedEventArgs e) { this.SizeChanged += MiniPlayerWindow_SizeChanged; this.Unloaded += MiniPlayerWindow_Unloaded; Initialize(); Responsive(); AppViewHelper.ResizeWindow(false, 400, 80); await AppViewHelper.SetAppView(true); AppViewHelper.SetTitleBar(DraggableGrid); App.SplitShell.FooterVisibility = AppBarClosedDisplayMode.Hidden; }
protected override async void OnNavigatedTo(NavigationEventArgs e) { await AppViewHelper.SetAppView(true); App.SplitShell.FlyoutAsHeader = true; base.OnNavigatedTo(e); if (Locator.SettingsVM.ExtraMargin) { var extraMargin = Locator.SettingsVM.ExtraMarginValue; Margin = new Thickness(Margin.Left + extraMargin, Margin.Top + extraMargin, +Margin.Right + extraMargin, Margin.Bottom + extraMargin); } PanelsListView.ItemsSource = Locator.MainVM.Panels; PanelsListView.SelectedItem = Locator.MainVM.CurrentPanel; }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); MyGrid.Children.Clear(); if (Locator.SettingsVM.MediaCenterMode) { MyGrid.Children.Add(new HomePageController()); } else { MyGrid.Children.Add(new DesktopHomePageController()); await AppViewHelper.SetAppView(true); } }
private async Task LaunchTheApp() { Dispatcher = Window.Current.Dispatcher; Window.Current.Content = new MainPage(); await SplitShell.TemplateApplied.Task; #if WINDOWS_PHONE_APP StatusBarHelper.Initialize(); #else AppViewHelper.SetAppView(); #endif Locator.MainVM.DropTablesIfNeeded(); ApplicationFrame.Navigated += this.RootFrame_FirstNavigated; Window.Current.Activate(); }
async Task UpdateCurrentVideo(VideoItem video) { await DispatchHelper.InvokeInUIThread(CoreDispatcherPriority.Normal, () => { Locator.VideoPlayerVm.CurrentVideo = video; if (video != null) { AppViewHelper.SetTitleBarTitle(video.Name); } }); if (video != null) { await TryUseSubtitleFromFolder(); } }
public static void SetShellDecoration(bool freshtheme) { var forcecolor = AppSettings.Instance.AccentColor; var currenttheme = AppSettings.Instance.CurrentTheme; Current.Resources["AppForceBackgroudColorBrush"] = new SolidColorBrush() { Color = forcecolor }; if (freshtheme) { AppViewHelper.FrameFresh(MainFrame, currenttheme); } MainFrame.RequestedTheme = currenttheme; // MainFrame.Navigate(typeof (MainPage)); // AttachBackButton(); // 主页Frame设置 var mainpage = MainFrame.Content as MainPage; if (mainpage != null) { if (freshtheme) { AppViewHelper.FrameFresh(mainpage.RootFrame, currenttheme); } mainpage.RootFrame.RequestedTheme = currenttheme; } //设置标题栏 AppViewHelper.SetAppView(AppSettings.Instance.AccentColor); // var titleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar; //AppViewHelper.SetTitleBar(true); //Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = AppSettings.Instance.IsAccentColorTitleBar; //int count = Current.Resources.ThemeDictionaries.Count; //var theme = Current.Resources.ThemeDictionaries.Values.ToList()[0] as ResourceDictionary; //var thmedata = Current.Resources.ThemeDictionaries["ApplicationPageBackgroundThemeBrush"] as SolidColorBrush; //thmedata = new SolidColorBrush() {Color =Colors.DarkRed}; //var resoure = Current.Resources.MergedDictionaries[0]; //var data = resoure["PumpkinColorBrush"]; }
static void ToggleMediaCenterMode() { if (Locator.SettingsVM.MediaCenterMode) { Locator.MainVM.CurrentPanel = Locator.MainVM.Panels.FirstOrDefault(x => x.Target == Locator.SettingsVM.HomePage); Locator.MainVM.GoToHomePageMediaCenterCommand.Execute(null); AppViewHelper.EnterFullscreen(); SplitShell.FooterContent = null; } else { Locator.MainVM.CurrentPanel = Locator.MainVM.Panels.FirstOrDefault(x => x.Target == Locator.SettingsVM.HomePage); AppViewHelper.LeaveFullscreen(); SplitShell.FooterContent = new CommandBarBottom(); } Locator.NavigationService.RefreshCurrentPage(); }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); AppViewHelper.SetTitleBarTitle(); App.RootPage.SwapChainPanel.Visibility = Visibility.Collapsed; Locator.NavigationService.CloseVideoFlyouts(); Locator.VideoPlayerVm.OnNavigatedFrom(); Locator.VideoPlayerVm.PlayerControlVisibilityChangeRequested -= VideoPlayerVm_PlayerControlVisibilityChangeRequested; OnPlayerControlVisibilityChanged -= Locator.VideoPlayerVm.OnPlayerControlVisibilityChanged; AppViewHelper.LeaveFullscreen(); this.SizeChanged -= OnSizeChanged; Locator.MediaPlaybackViewModel.MouseService.Stop(); Locator.MediaPlaybackViewModel.MouseService.OnMoved -= ShowControlPanel; controlsTimer.Tick -= ControlsTimer_Tick; controlsTimer.Stop(); Locator.MediaPlaybackViewModel.MouseService.ShowCursor(); }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); AppViewHelper.SetTitleBarTitle(); App.RootPage.SwapChainPanel.Visibility = Visibility.Collapsed; Locator.NavigationService.CloseVideoFlyouts(); Locator.VideoPlayerVm.OnNavigatedFrom(); Locator.VideoPlayerVm.PlayerControlVisibilityChangeRequested -= VideoPlayerVm_PlayerControlVisibilityChangeRequested; Locator.VideoPlayerVm.PlayerControlVisibilityExtendCurrentRequested -= VideoPlayerVmOnPlayerControlVisibilityExtendCurrentRequested; OnPlayerControlVisibilityChanged -= Locator.VideoPlayerVm.OnPlayerControlVisibilityChanged; AppViewHelper.LeaveCompactOverlay(); AppViewHelper.LeaveFullscreen(); Locator.MediaPlaybackViewModel.PropertyChanged -= MediaPlaybackViewModelOnPropertyChanged; CastButton.Click -= CastButtonOnClick; _viewModel.MouseService.Stop(); _viewModel.MouseService.OnMoved -= ShowControlPanel; RootGrid.Tapped -= RootGrid_Tapped; if (DeviceHelper.GetDeviceType() == DeviceTypeEnum.Tablet) { PointerWheelChanged -= MouseWheelChanged; } controlsTimer.Tick -= ControlsTimer_Tick; controlsTimer.Stop(); _viewModel.MouseService.ShowCursor(); this.SizeChanged -= OnSizeChanged; ControlsBorder.UnregisterPropertyChangedCallback(VisibilityProperty, _borderVisibilityChangedToken); _viewModel.PlaybackService.Playback_MediaStopped -= OnPlaybackStopped; FadeOut.Completed -= FadeOut_Completed; }
private async Task UpdateCurrentVideo(VideoItem video) { await DispatchHelper.InvokeInUIThread(CoreDispatcherPriority.Normal, () => { Locator.VideoPlayerVm.CurrentVideo = video; if (video != null) { AppViewHelper.SetTitleBarTitle(video.Name); } }); if (video != null) { await TryUseSubtitleFromFolder(); var currentVideoTrackid = Locator.PlaybackService.VideotrackId; if (currentVideoTrackid != -1) { var currentMediaTrack = Locator.PlaybackService.CurrentMedia?.tracks()? .FirstOrDefault(t => t.id() == currentVideoTrackid); Is3DVideo = currentMediaTrack?.projection() == Projection.Equirectangular; } } }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); AppViewHelper.SetAppView(false); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); AppViewHelper.SetAppView(true); }
public bool GoBack_Specific() { switch (CurrentPage) { case VLCPage.None: break; case VLCPage.MainPageXBOX: GoBack_HideFlyout(); break; case VLCPage.MainPageVideo: case VLCPage.MainPageMusic: case VLCPage.MainPageNetwork: if (Locator.SettingsVM.MediaCenterMode) { GoBack_Default(); } else { return(false); } break; case VLCPage.MainPageFileExplorer: if (Locator.FileExplorerVM.CurrentStorageVM != null || Locator.FileExplorerVM.CanGoBack) { Locator.FileExplorerVM.GoBackCommand.Execute(null); } else { if (Locator.SettingsVM.MediaCenterMode) { GoBack_Default(); } else { return(false); } } break; case VLCPage.AlbumPage: GoBack_HideFlyout(); break; case VLCPage.ArtistPage: GoBack_Default(); break; case VLCPage.PlaylistPage: GoBack_HideFlyout(); break; case VLCPage.CurrentPlaylistPage: GoBack_HideFlyout(); break; case VLCPage.VideoPlayerPage: if (currentFlyout == VLCPage.VideoPlayerOptionsPanel) { GoBack_HideFlyout(); } Locator.MediaPlaybackViewModel.GoBack.Execute(null); break; case VLCPage.MusicPlayerPage: GoBack_Default(); break; case VLCPage.SpecialThanksPage: GoBack_HideFlyout(); break; case VLCPage.ArtistShowsPage: GoBack_HideFlyout(); break; case VLCPage.AddAlbumToPlaylistDialog: Go(VLCPage.AlbumPage); break; case VLCPage.CreateNewPlaylistDialog: GoBack_HideFlyout(); break; case VLCPage.LicensePage: GoBack_HideFlyout(); break; case VLCPage.MiniPlayerView: AppViewHelper.ResizeWindow(true); GoBack_Default(); break; // Settings pages case VLCPage.SettingsPage: case VLCPage.SearchPage: Go(Locator.SettingsVM.HomePage); break; case VLCPage.SettingsPageUI: Go(VLCPage.SettingsPage); break; case VLCPage.SettingsPageMusic: Go(VLCPage.SettingsPage); break; case VLCPage.SettingsPageVideo: Go(VLCPage.SettingsPage); break; case VLCPage.VideoPlayerOptionsPanel: GoBack_HideFlyout(); break; case VLCPage.TrackEditorPage: GoBack_HideFlyout(); break; case VLCPage.FeedbackPage: GoBack_HideFlyout(); break; case VLCPage.TvShowView: GoBack_HideFlyout(); break; case VLCPage.AboutAppView: GoBack_HideFlyout(); break; default: throw new ArgumentOutOfRangeException(); } return(true); }
public MainPageXBOX() { this.InitializeComponent(); AppViewHelper.SetAppView(true); PanelsListView.Focus(Windows.UI.Xaml.FocusState.Keyboard); }
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(); }
public bool GoBack_Specific() { switch (CurrentPage) { case VLCPage.None: break; case VLCPage.MainPageXBOX: GoBack_HideFlyout(); break; case VLCPage.MainPageVideo: case VLCPage.MainPageMusic: case VLCPage.MainPageNetwork: if (Locator.SettingsVM.MediaCenterMode) { GoBack_Default(); } else { return(false); } break; case VLCPage.MainPageFileExplorer: if (Locator.FileExplorerVM.CurrentStorageVM != null || Locator.FileExplorerVM.CanGoBack) { Locator.FileExplorerVM.GoBackCommand.Execute(null); } else { if (Locator.SettingsVM.MediaCenterMode) { GoBack_Default(); } else { return(false); } } break; case VLCPage.AlbumPage: GoBack_HideFlyout(); break; case VLCPage.PlaylistPage: GoBack_HideFlyout(); break; case VLCPage.CurrentPlaylistPage: GoBack_HideFlyout(); break; case VLCPage.VideoPlayerPage: if (Helpers.DeviceHelper.IsMediaCenterModeCompliant && Locator.VideoPlayerVm.PlayerControlVisibility == true) { Locator.VideoPlayerVm.RequestChangeControlBarVisibility(false); break; } if (currentFlyout == VLCPage.VideoPlayerOptionsPanel || currentFlyout == VLCPage.SubtitlesSettings || currentFlyout == VLCPage.AudioTracksSettings || currentFlyout == VLCPage.ChaptersSettings) { GoBack_HideFlyout(); } Locator.MediaPlaybackViewModel.GoBack.Execute(null); break; case VLCPage.MusicPlayerPage: GoBack_Default(); break; case VLCPage.ArtistShowsPage: GoBack_HideFlyout(); break; case VLCPage.AddAlbumToPlaylistDialog: Go(VLCPage.AlbumPage); break; case VLCPage.CreateNewPlaylistDialog: GoBack_HideFlyout(); break; case VLCPage.MiniPlayerView: AppViewHelper.ResizeWindow(true); GoBack_Default(); break; // Settings pages case VLCPage.SettingsPage: GoBack_HideFlyout(); break; case VLCPage.SearchPage: Go(Locator.SettingsVM.HomePage); break; case VLCPage.SettingsPageUI: Go(VLCPage.SettingsPage); break; case VLCPage.SettingsPageMusic: Go(VLCPage.SettingsPage); break; case VLCPage.SettingsPageVideo: Go(VLCPage.SettingsPage); break; case VLCPage.VideoPlayerOptionsPanel: GoBack_HideFlyout(); break; case VLCPage.SubtitlesSettings: GoBack_HideFlyout(); break; case VLCPage.ChaptersSettings: GoBack_HideFlyout(); break; case VLCPage.AudioTracksSettings: GoBack_HideFlyout(); break; case VLCPage.TrackEditorPage: GoBack_HideFlyout(); break; case VLCPage.TvShowView: GoBack_HideFlyout(); break; case VLCPage.AboutAppView: GoBack_HideFlyout(); break; case VLCPage.ExternalStorageInclude: GoBack_HideFlyout(); break; default: throw new ArgumentOutOfRangeException(); } return(true); }
private void TitleBar_Loaded(object sender, RoutedEventArgs e) { AppViewHelper.SetTitleBar(TitleBar); Responsive(); }
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; }