Пример #1
0
        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));
            }
        }
Пример #2
0
        /// <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();
        }
Пример #3
0
        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);
        }
Пример #4
0
 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;
     }
 }
Пример #5
0
        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;
            }
        }
Пример #6
0
 void NavigateTo(NavigationLocation location) => navigator.NavigateTo(location);
Пример #7
0
        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;
        }
Пример #8
0
 NavigationDestinations GetDestination(NavigationLocation location) =>
 location switch
 {
Пример #9
0
 public void NavigateTo(NavigationLocation location)
 {
     handler.Handle(GetDestination(location));
 }
Пример #10
0
 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);
     }
 }
Пример #11
0
 public void Navigate(NavigationLocation type, object parameter = null)
 {
     mainNavigationFrame.Navigate(NavigationLocationToPageType(type), parameter);
 }
Пример #12
0
 public void Navigate(NavigationLocation type, object parameter = null)
 {
     mainNavigationFrame.Navigate(NavigationLocationToPageType(type), parameter);
 }
Пример #13
0
        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);
        }