private Type NavigationLocationToPageType(NavigationLocation location) { switch (location) { case NavigationLocation.AlbumList: return(typeof(AlbumList)); case NavigationLocation.AlbumPage: return(typeof(AlbumPage)); case NavigationLocation.ArtistList: return(typeof(ArtistList)); case NavigationLocation.ArtistPage: return(typeof(ArtistPage)); case NavigationLocation.Home: return(typeof(HomePage)); case NavigationLocation.ManageLibrary: return(typeof(ManageLibrary)); case NavigationLocation.MixList: return(typeof(MixList)); case NavigationLocation.MixPage: return(typeof(MixPage)); case NavigationLocation.PlaylistList: return(typeof(PlaylistList)); case NavigationLocation.PlaylistPage: return(typeof(PlaylistPage)); case NavigationLocation.SearchPage: return(typeof(SearchPage)); case NavigationLocation.SettingsPage: return(typeof(Settings)); case NavigationLocation.SongList: return(typeof(SongList)); case NavigationLocation.Queue: return(typeof(Queue)); case NavigationLocation.NowPlaying: return(typeof(NowPlaying)); case NavigationLocation.NewHome: return(typeof(NewHomePage)); case NavigationLocation.Library: return(typeof(Library)); default: DebugHelper.Alert(new CallerInfo(), "Unexpected NavigationLocation {0}", location); return(typeof(HomePage)); } }
/// <summary> /// /// </summary> /// <param name="navigations">A List or similar containing NavigationInfo's used to setup navigation to different pages.</param> /// <param name="location">Where the navigation bar is located.</param> /// <param name="hidden">Wheather or not to start with the menu shown or not.</param> /// <param name="logger">The logger used to log during setup and when event happen. If non is supplied no logging happens.</param> /// <exception cref="NullReferenceException"></exception> public NavigationPage(IEnumerable <NavigationInfo> navigations, ILoggerManager?logger = default, NavigationLocation location = NavigationLocation.Left, bool hidden = true) : base() { InitializeComponent(); if (location == NavigationLocation.Null) { throw new NullReferenceException($"{nameof(location)} was set to null location which is invalid."); } this.navigations = navigations ?? throw new ArgumentNullException(nameof(navigations)); this.logger = logger; this.location = location; this.hidden = hidden; this.logger?.SetCaller(nameof(NavigationPage)); mainGrid = MainGrid; orderedNavigations = navigations.OrderBy(x => x.Desired); Navigate += NavigationPage_Navigate; BuildWindow(); }
private void ExecuteNavigate(object parameter) { string parameterAsString = DebugHelper.CastAndAssert <string>(parameter); NavigationLocation target = NavigationLocation.Home; DebugHelper.Assert(new CallerInfo(), Enum.TryParse <NavigationLocation>(parameterAsString, out target), "Couldn't find location named {0}", parameterAsString); NavigationManager.Current.Navigate(target); }
private void HandleNavigationRequest(NavigationLocation request) { switch (request) { case NavigationLocation.NewsFeed: this.NavigateToNewsFeedPage(); break; case NavigationLocation.Projects: this.NavigateToProjectsPage(); break; case NavigationLocation.Users: this.NavigateToUsersPage(); break; case NavigationLocation.Logout: this.Logout(); break; } }
void NavigateTo(NavigationLocation location) => navigator.NavigateTo(location);
private NavigationLocation AddLocation( Location location, List<DateTime> chartTimes ) { if ( location != null ) { var navLocation = NavData.Locations.FirstOrDefault( l => l.Id == location.Id ); if ( navLocation == null ) { navLocation = new NavigationLocation( location, chartTimes ); NavData.Locations.Add( navLocation ); } if ( location.ParentLocationId.HasValue ) { navLocation.ParentId = location.ParentLocationId; var parentLocation = NavData.Locations.FirstOrDefault( l => l.Id == location.ParentLocationId ); if ( parentLocation == null ) { parentLocation = AddLocation( location.ParentLocation, chartTimes ); } if ( parentLocation != null ) { parentLocation.ChildLocationIds.Add( navLocation.Id ); } } return navLocation; } return null; }
NavigationDestinations GetDestination(NavigationLocation location) => location switch {
public void NavigateTo(NavigationLocation location) { handler.Handle(GetDestination(location)); }
private Type NavigationLocationToPageType(NavigationLocation location) { switch (location) { case NavigationLocation.AlbumList: return typeof(AlbumList); case NavigationLocation.AlbumPage: return typeof(AlbumPage); case NavigationLocation.ArtistList: return typeof(ArtistList); case NavigationLocation.ArtistPage: return typeof(ArtistPage); case NavigationLocation.Home: return typeof(HomePage); case NavigationLocation.ManageLibrary: return typeof(ManageLibrary); case NavigationLocation.MixList: return typeof(MixList); case NavigationLocation.MixPage: return typeof(MixPage); case NavigationLocation.PlaylistList: return typeof(PlaylistList); case NavigationLocation.PlaylistPage: return typeof(PlaylistPage); case NavigationLocation.SearchPage: return typeof(SearchPage); case NavigationLocation.SettingsPage: return typeof(Settings); case NavigationLocation.SongList: return typeof(SongList); case NavigationLocation.Queue: return typeof(Queue); case NavigationLocation.NowPlaying: return typeof(NowPlaying); case NavigationLocation.NewHome: return typeof(NewHomePage); case NavigationLocation.Library: return typeof(Library); default: DebugHelper.Alert(new CallerInfo(), "Unexpected NavigationLocation {0}", location); return typeof(HomePage); } }
public void Navigate(NavigationLocation type, object parameter = null) { mainNavigationFrame.Navigate(NavigationLocationToPageType(type), parameter); }
SignInUseCase GetUseCase(SignInUseCaseConfig config) { Mock <IValidator <UserLoginModel> > validatorMock = new Mock <IValidator <UserLoginModel> >(); validatorMock.Setup(mock => mock.Validate(It.IsAny <UserLoginModel>())).Returns(config.ValidationResult); Mock <IIdentityProvider> identityProviderMock = new Mock <IIdentityProvider>(); identityProviderMock.Setup(mock => mock.CheckSignInAsync(It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(config.DesiredSignInResult)); config.SignInExecutorMock ??= new Mock <ISignInExecutor>(); Mock <INavigator> navigatorMock = new Mock <INavigator>(); navigatorMock.Setup(mock => mock.NavigateTo(It.IsAny <NavigationLocation>())).Callback <NavigationLocation>((obj) => navigatedLocation = obj); config.ErrorCollectorMock ??= new Mock <IErrorCollector>(); SignInUseCase useCase = new SignInUseCase(validatorMock.Object, identityProviderMock.Object, config.SignInExecutorMock.Object, navigatorMock.Object, config.ErrorCollectorMock.Object, new SignInErrorCreator(new FailedSignInMessageConverter())); return(useCase); }