void NavigationService_Navigated(object sender, NavigationEventArgs e) { var hasDisplayPreferences = e.NewPage as IHasDisplayPreferences; if (hasDisplayPreferences == null) { MasterCommands.DisplayPreferencesEnabled = false; MasterCommands.SortEnabled = false; } else { MasterCommands.DisplayPreferencesEnabled = true; MasterCommands.SortEnabled = hasDisplayPreferences.HasSortOptions; //Check if remember sort is checked } var isLoginPage = e.NewPage as ILoginPage; if (isLoginPage == null) { ShowSettingsButton = false; } else { ShowSettingsButton = SessionManager.CurrentUser != null; } ShowSearchButton = (e.NewPage as ISupportSearch) != null; }
async void _nav_Navigated(object sender, NavigationEventArgs e) { try { await OnNavigated(e); } catch (Exception ex) { _logger.ErrorException("Error playing theme songs", ex); } }
void _nav_Navigated(object sender, NavigationEventArgs e) { if (e.NewPage is IFullscreenVideoPage) { RemoveWindowHook(); AddGlobalHook(); } else { RemoveGlobalHook(); AddWindowHook(); } }
private async Task OnNavigated(NavigationEventArgs e) { // If something is already playing, and it's not a theme song, leave it alone if (string.IsNullOrEmpty(_currentPlayingOwnerId) && _playback.MediaPlayers.Any(i => i.PlayState != PlayState.Idle)) { return; } var itemPage = e.NewPage as ISupportsItemThemeMedia; if (itemPage == null || _session.LocalUserId == null || string.IsNullOrEmpty(itemPage.ThemeMediaItemId)) { if (!string.IsNullOrEmpty(_currentPlayingOwnerId) && !(e.NewPage is ISupportsThemeMedia)) { _playback.StopAllPlayback(); } return; } var itemId = itemPage.ThemeMediaItemId; var apiClient = _session.ActiveApiClient; var themeMediaResult = await GetThemeMedia(apiClient, itemId).ConfigureAwait(false); if (string.Equals(_currentPlayingOwnerId, themeMediaResult.OwnerId)) { return; } // Don't replay the same one over and over if (string.Equals(_lastPlayedOwnerId, themeMediaResult.OwnerId)) { return; } _lastPlayedOwnerId = null; if (themeMediaResult.Items.Length > 0) { await Play(GetItemsToPlay(themeMediaResult)).ConfigureAwait(false); _currentPlayingOwnerId = themeMediaResult.OwnerId; _lastPlayedOwnerId = themeMediaResult.OwnerId; } else if (!string.IsNullOrEmpty(_currentPlayingOwnerId)) { _playback.StopAllPlayback(); } }
/// <summary> /// Handles the Navigated event of the _nav control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="NavigationEventArgs"/> instance containing the event data.</param> void _nav_Navigated(object sender, NavigationEventArgs e) { var page = e.NewPage; if (!(page is ISupportsBackdrops)) { _presentationManager.ClearBackdrops(); return; } var itemBackdrops = page as ISupportsItemBackdrops; if (itemBackdrops != null) { _presentationManager.SetBackdrops(itemBackdrops.BackdropItem); } }
async void NavigationServiceNavigated(object sender, NavigationEventArgs e) { var itemPage = e.NewPage as IItemPage; if (itemPage != null) { var item = itemPage.PageItem; try { await ApiWebSocket.SendContextMessageAsync(item.Type, item.Id, item.Name, itemPage.ViewType.ToString(), CancellationToken.None).ConfigureAwait(false); } catch (Exception ex) { _logger.ErrorException("Error sending context message", ex); } } }
void NavigationService_Navigated(object sender, NavigationEventArgs e) { IsOnPageWithDisplayPreferences = e.NewPage is IHasDisplayPreferences; RefreshHomeButton(e.NewPage as Page); }
async void _nav_Navigated(object sender, NavigationEventArgs e) { var itemPage = e.NewPage as IItemPage; if (itemPage != null) { var item = itemPage.PageItem; try { await ApiWebSocket.SendContextMessageAsync(item.Type, item.Id, item.Name, itemPage.ViewType.ToString(), CancellationToken.None).ConfigureAwait(false); } catch (Exception ex) { _logger.ErrorException("Error sending context message", ex); } } }
async void NavigationServiceNavigated(object sender, NavigationEventArgs e) { var itemPage = e.NewPage as IItemPage; if (itemPage != null) { var item = itemPage.PageItem; var apiClient = _connectionManager.GetApiClient(item); try { await apiClient.SendContextMessageAsync(item.Type, item.Id, item.Name, itemPage.ViewType.ToString(), CancellationToken.None).ConfigureAwait(false); } catch (Exception ex) { _logger.ErrorException("Error sending context message", ex); } } }
void NavigationManager_Navigated(object sender, NavigationEventArgs e) { App.Instance.HiddenWindow.MouseMove -= _userInput_MouseMove; if (e.NewPage is IFullscreenVideoPage) { App.Instance.HiddenWindow.MouseMove += _userInput_MouseMove; if (IsMouseIdle) { HideCursor(); } } }
void NavigationServiceNavigated(object sender, NavigationEventArgs e) { IsOnHomePage = e.NewPage is IHomePage; IsOnFullscreenVideo = e.NewPage is IFullscreenVideoPage; }
protected virtual void NavigationService_Navigated(object sender, NavigationEventArgs e) { RefreshHomeButton(e.NewPage as Page); }
void _nav_Navigated(object sender, NavigationEventArgs e) { if (e.NewPage is IFullscreenVideoPage) { AddirectPlayWindowHook(); } else { RemoveDirectPlayWindowHook(); } }