public AppShell(string path) { // Init the XAML LoggingService.Log(LoggingService.LogType.Debug, "Loading Shell XAML"); InitializeComponent(); // Set the accent color TitlebarHelper.UpdateTitlebarStyle(); LoggingService.Log(LoggingService.LogType.Debug, "Attaching Event Handlers"); // When the page is loaded (after the following and xaml init) // we can perform the async work Loaded += async(sender, args) => await PerformAsyncWork(path); // Unload events Unloaded += (sender, args) => Dispose(); var titleBar = CoreApplication.GetCurrentView().TitleBar; titleBar.LayoutMetricsChanged += (s, e) => { AppTitle.Margin = new Thickness(CoreApplication.GetCurrentView().TitleBar.SystemOverlayLeftInset + 12, 8, 0, 0); }; // This is a dirty to show the now playing // bar when a track is played. This method // updates the required layout for the now // playing bar. PlaybackService.Instance.OnTrackChange += InstanceOnOnCurrentTrackChanged; // Create a shell frame shadow for mobile and desktop if (DeviceHelper.IsDesktop) { ShellFrame.CreateElementShadow(new Vector3(4, 0, 0), 40, new Color { A = 82, R = 0, G = 0, B = 0 }, ShellFrameShadow); } // Events for Xbox if (DeviceHelper.IsXbox) { // Make xbox selection easy to see Application.Current.Resources["CircleButtonStyle"] = Application.Current.Resources["XboxCircleButtonStyle"]; } RootFrame.Focus(FocusState.Keyboard); }
public MainShell(string path) { // Init the XAML InitializeComponent(); // Set the accent color TitlebarHelper.UpdateTitlebarStyle(); // When the page is loaded (after the following and xaml init) // we can perform the async work Loaded += async(sender, args) => await PerformAsyncWork(path); // Unload events Unloaded += (sender, args) => Dispose(); // This is a dirty to show the now playing // bar when a track is played. This method // updates the required layout for the now // playing bar. PlaybackService.Instance.PropertyChanged += ServiceOnPropertyChanged; // Create a shell frame shadow for mobile and desktop if (DeviceHelper.IsDesktop || DeviceHelper.IsMobile) { ShellFrame.CreateElementShadow(new Vector3(0, 0, 0), 20, new Color { A = 52, R = 0, G = 0, B = 0 }, ShellFrameShadow); } // Events for Xbox if (DeviceHelper.IsXbox) { // Pane is hidden by default MainSplitView.IsPaneOpen = false; MainSplitView.DisplayMode = SplitViewDisplayMode.CompactOverlay; MainSplitView.Margin = new Thickness(); MainSplitView.LightDismissOverlayMode = LightDismissOverlayMode.On; // Center all navigation icons NavbarScrollViewer.VerticalAlignment = VerticalAlignment.Center; // Show background blur image XboxOnlyGrid.Visibility = Visibility.Visible; ShellFrame.Background = new SolidColorBrush(Colors.Transparent); // Splitview pane gets background SplitViewPaneGrid.Background = Application.Current.Resources["InAppBackgroundBrush"] as CustomAcrylicBrush; // Make xbox selection easy to see Application.Current.Resources["CircleButtonStyle"] = Application.Current.Resources["XboxCircleButtonStyle"]; } // Events for Mobile if (DeviceHelper.IsMobile) { // Splitview pane gets background SplitViewPaneGrid.Background = Application.Current.Resources["MobileBlurHeader"] as CustomAcrylicBrush; // Amoled Magic Application.Current.Resources["ShellBackground"] = new SolidColorBrush(Application.Current.RequestedTheme == ApplicationTheme.Dark ? Colors.Black : Colors.White); MainSplitView.IsPaneOpen = false; MainSplitView.DisplayMode = SplitViewDisplayMode.Overlay; MainSplitView.Margin = new Thickness(0); SplitViewPaneGrid.Margin = new Thickness { Top = 48 }; MobileMenu.Visibility = Visibility.Visible; HamburgerButton.Visibility = Visibility.Collapsed; } if (DeviceHelper.IsDesktop) { MainSplitView.IsPaneOpen = SettingsService.Instance.IsMenuOpen; } // Focus on the root frame RootFrame.Focus(FocusState.Programmatic); }
private void ShellFrame_Navigated(object sender, NavigationEventArgs e) { BlockNavigation = true; // Update the side bar switch (((Frame)sender).SourcePageType.Name) { case "HomeView": HomeTab.IsChecked = true; break; case "DonateView": DonateTab.IsChecked = true; break; case "LikesView": LikesTab.IsChecked = true; break; case "PlaylistsView": SetsTab.IsChecked = true; break; case "NotificationsView": NotificationsTab.IsChecked = true; break; case "HistoryView": HistoryTab.IsChecked = true; break; case "AccountView": AccountTab.IsChecked = true; break; case "AppInfoView": SettingsTab.IsChecked = true; break; default: UnknownTab.IsChecked = true; break; } if (((Frame)sender).SourcePageType == typeof(HomeView) || ((Frame)sender).SourcePageType == typeof(MainShell)) { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } else { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; } // Update the UI depending if we are logged in or not if (SoundByteService.Instance.IsSoundCloudAccountConnected || SoundByteService.Instance.IsFanBurstAccountConnected) { ShowLoginContent(); } else { ShowLogoutContent(); } if (DeviceHelper.IsDesktop) { if (((Frame)sender).SourcePageType == typeof(NowPlayingView)) { SettingsService.Instance.IsMenuOpen = MainSplitView.IsPaneOpen; MainSplitView.IsPaneOpen = false; MainSplitView.CompactPaneLength = 0; HideNowPlayingBar(); MainSplitView.Margin = new Thickness { Bottom = 0, Top = 0 }; } else { MainSplitView.CompactPaneLength = 84; MainSplitView.IsPaneOpen = SettingsService.Instance.IsMenuOpen; if (PlaybackService.Instance.CurrentTrack == null) { HideNowPlayingBar(); } else { ShowNowPlayingBar(); } } } if (DeviceHelper.IsMobile) { MainSplitView.IsPaneOpen = false; } if (DeviceHelper.IsXbox) { if (((Frame)sender).SourcePageType == typeof(NowPlayingView)) { MainSplitView.IsPaneOpen = false; MainSplitView.CompactPaneLength = 0; } else { MainSplitView.IsPaneOpen = false; MainSplitView.CompactPaneLength = 84; } } RootFrame.Focus(FocusState.Programmatic); BlockNavigation = false; }
private void ShellFrame_Navigated(object sender, NavigationEventArgs e) { // Update the side bar switch (((Frame)sender).SourcePageType.Name) { case "SoundCloudStreamView": NavView.SelectedItem = NavigationItemSoundCloudStream; break; case "ExploreView": NavView.SelectedItem = NavigationItemExplore; break; case "PremiumUpgradeView": NavView.SelectedItem = NavigationItemDonations; break; case "MyLikesView": NavView.SelectedItem = NavigationItemLikes; break; case "MyPlaylistsView": NavView.SelectedItem = NavigationItemPlaylists; break; case "HistoryView": NavView.SelectedItem = NavigationItemHistory; break; case "AccountManagerView": NavView.SelectedItem = NavigationItemAccounts; break; case "SettingsView": NavView.SelectedItem = NavigationItemSettings; break; case "MyShowsView": NavView.SelectedItem = NavigationItemShows; break; case "DownloadsView": NavView.SelectedItem = NavigationItemDownloads; break; } if (((Frame)sender).CanGoBack) { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; } else { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } // Update the UI depending if we are logged in or not if (SoundByteV3Service.Current.IsServiceConnected(ServiceType.SoundCloud) || SoundByteV3Service.Current.IsServiceConnected(ServiceType.YouTube) || SoundByteV3Service.Current.IsServiceConnected(ServiceType.Fanburst)) { ShowLoginContent(); } else { ShowLogoutContent(); } if (DeviceHelper.IsDesktop) { if (((Frame)sender).SourcePageType == typeof(NowPlayingView)) { NavView.IsPaneToggleButtonVisible = false; NavView.CompactPaneLength = 0; NavView.OpenPaneLength = 0; HideNowPlayingBar(); } else { NavView.IsPaneToggleButtonVisible = true; NavView.CompactPaneLength = 84; NavView.OpenPaneLength = 350; if (PlaybackService.Instance.CurrentTrack == null) { HideNowPlayingBar(); } else { ShowNowPlayingBar(); } } } RootFrame.Focus(FocusState.Programmatic); }
public MainShell(string path) { // Init the XAML InitializeComponent(); // Set the accent color AccentHelper.UpdateAccentColor(); // Amoled Magic if (App.IsMobile) { Application.Current.Resources["ShellBackground"] = new SolidColorBrush(Application.Current.RequestedTheme == ApplicationTheme.Dark ? Colors.Black : Colors.White); } // Make xbox selection easy to see if (App.IsXbox) { Application.Current.Resources["CircleButtonStyle"] = Application.Current.Resources["XboxCircleButtonStyle"]; } // When the page is loaded (after the following and xaml init) // we can perform the async work Loaded += async(sender, args) => await PerformAsyncWork(path); // This is a dirty to show the now playing // bar when a track is played. This method // updates the required layout for the now // playint bar. Service.PropertyChanged += (sender, args) => { if (args.PropertyName != "CurrentTrack") { return; } if (Service.CurrentTrack == null || !App.IsDesktop || RootFrame.CurrentSourcePageType == typeof(Track)) { HideNowPlayingBar(); } else { ShowNowPlayingBar(); } }; // Create the blur for desktop if (App.IsDesktop) { CreateShellFrameShadow(); } else { HideNowPlayingBar(); } if (App.IsXbox) { // Pane is hidden by default MainSplitView.IsPaneOpen = false; // Show the search bar SearchXboxTab.Visibility = Visibility.Visible; // Center all navigation icons NavbarScrollViewer.VerticalAlignment = VerticalAlignment.Center; // Show background blur image XboxOnlyGrid.Visibility = Visibility.Visible; ShellFrame.Background = new SolidColorBrush(Colors.Transparent); } // Mobile Specific stuff if (App.IsMobile) { RootFrame.Margin = new Thickness { Left = 0, Right = 0, Top = 0, Bottom = 64 }; MainSplitView.IsPaneOpen = false; MainSplitView.CompactPaneLength = 0; MobileNavigation.Visibility = Visibility.Visible; NowPlaying.Visibility = Visibility.Collapsed; } else { MobileNavigation.Visibility = Visibility.Collapsed; } RootFrame.Focus(FocusState.Programmatic); }
private void ShellFrame_Navigated(object sender, NavigationEventArgs e) { BlockNavigation = true; // Update the side bar switch (((Frame)sender).SourcePageType.Name) { case "HomeView": HomeTab.IsChecked = true; MobileHomeTab.IsChecked = true; break; case "Track": UnknownTab.IsChecked = true; NowPlayingTab.IsChecked = true; break; case "DonateView": DonateTab.IsChecked = true; MobileUnkownTab.IsChecked = true; break; case "LikesView": LikesTab.IsChecked = true; MobileUnkownTab.IsChecked = true; break; case "PlaylistsView": SetsTab.IsChecked = true; MobileUnkownTab.IsChecked = true; break; case "NotificationsView": NotificationsTab.IsChecked = true; MobileUnkownTab.IsChecked = true; break; case "HistoryView": HistoryTab.IsChecked = true; MobileUnkownTab.IsChecked = true; break; case "LoginView": LoginTab.IsChecked = true; MobileUnkownTab.IsChecked = true; break; case "SettingsView": SettingsTab.IsChecked = true; MobileUnkownTab.IsChecked = true; break; case "Search": SearchXboxTab.IsChecked = true; MobileSearchTab.IsChecked = true; break; case "AboutView": SettingsTab.IsChecked = true; MobileUnkownTab.IsChecked = true; break; case "MobileNavView": UnknownTab.IsChecked = true; MenuMobileTab.IsChecked = true; break; default: UnknownTab.IsChecked = true; MobileUnkownTab.IsChecked = true; break; } RootFrame.Focus(FocusState.Keyboard); if (((Frame)sender).SourcePageType == typeof(HomeView) || ((Frame)sender).SourcePageType == typeof(MainShell)) { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } else { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; } // Update the UI depending if we are logged in or not if (SoundByteService.Current.IsSoundCloudAccountConnected) { ShowLoginContent(); } else { ShowLogoutContent(); } if (App.IsDesktop) { if (((Frame)sender).SourcePageType.Name == "Track") { MainSplitView.IsPaneOpen = false; MainSplitView.CompactPaneLength = 0; LoadingRing.Margin = new Thickness { Left = 0, Right = 0, Top = 0, Bottom = 0 }; HideNowPlayingBar(); MainSplitView.Margin = new Thickness { Bottom = 0, Top = 0 }; } else { MainSplitView.IsPaneOpen = true; MainSplitView.CompactPaneLength = 84; if (Service.CurrentTrack == null) { LoadingRing.Margin = new Thickness { Left = 350, Right = 0, Top = 32, Bottom = 0 }; HideNowPlayingBar(); } else { LoadingRing.Margin = new Thickness { Left = 350, Right = 0, Top = 32, Bottom = 64 }; ShowNowPlayingBar(); } } } if (App.IsXbox) { if (((Frame)sender).SourcePageType.Name == "Track") { MainSplitView.IsPaneOpen = false; MainSplitView.CompactPaneLength = 0; } else { MainSplitView.IsPaneOpen = false; MainSplitView.CompactPaneLength = 84; } } BlockNavigation = false; }