コード例 #1
0
ファイル: App.xaml.cs プロジェクト: TaoziDB/Hohoema
        protected override UIElement CreateShell(Frame rootFrame)
        {
            rootFrame.CacheSize = 5;

            rootFrame.Navigating       += RootFrame_Navigating;
            rootFrame.NavigationFailed += RootFrame_NavigationFailed;

            var menuPageBase = new Views.MenuNavigatePageBase();

            menuPageBase.Content = rootFrame;

#if DEBUG
            menuPageBase.FocusEngaged += Container_FocusEngaged;
#endif
            var grid = new Grid();

            grid.Children.Add(menuPageBase);

            var hohoemaInAppNotification = new Views.HohoemaInAppNotification();
            hohoemaInAppNotification.VerticalAlignment = VerticalAlignment.Bottom;
            grid.Children.Add(hohoemaInAppNotification);


            return(grid);
        }
コード例 #2
0
        protected override UIElement CreateShell(Frame rootFrame)
        {
            rootFrame.Navigating       += RootFrame_Navigating;
            rootFrame.NavigationFailed += RootFrame_NavigationFailed;

            var menuPageBase = new Views.MenuNavigatePageBase();

            menuPageBase.Content = rootFrame;

            var container = new Views.PlayerWithPageContainer();

            container.Content = menuPageBase;

#if DEBUG
            container.FocusEngaged += Container_FocusEngaged;
#endif

            return(container);
        }
コード例 #3
0
        protected override UIElement CreateShell(Frame rootFrame)
        {
            rootFrame.CacheSize = 5;

            rootFrame.NavigationFailed += (_, e) =>
            {
                Debug.WriteLine("Page navigation failed!!");
                Debug.WriteLine(e.SourcePageType.AssemblyQualifiedName);
                Debug.WriteLine(e.Exception.ToString());

                _ = OutputErrorFile(e.Exception, e.SourcePageType?.AssemblyQualifiedName);
            };


            // Grid
            //   |- HohoemaInAppNotification
            //   |- PlayerWithPageContainerViewModel
            //   |    |- MenuNavigatePageBaseViewModel
            //   |         |- rootFrame

            var menuPageBase = new Views.MenuNavigatePageBase()
            {
                Content     = rootFrame,
                DataContext = Container.Resolve <ViewModels.MenuNavigatePageBaseViewModel>()
            };


            Views.PlayerWithPageContainer playerWithPageContainer = new Views.PlayerWithPageContainer()
            {
                Content     = menuPageBase,
                DataContext = Container.Resolve <ViewModels.PlayerWithPageContainerViewModel>()
            };

            playerWithPageContainer.ObserveDependencyProperty(Views.PlayerWithPageContainer.FrameProperty)
            .Where(x => x != null)
            .Take(1)
            .Subscribe(async frame =>
            {
                var frameFacade = new FrameFacadeAdapter(playerWithPageContainer.Frame, EventAggregator);

                var sessionStateService = new SessionStateService();
                var ns = new FrameNavigationService(frameFacade
                                                    , (pageToken) =>
                {
                    if (pageToken == nameof(Views.VideoPlayerPage))
                    {
                        return(typeof(Views.VideoPlayerPage));
                    }
                    else if (pageToken == nameof(Views.LivePlayerPage))
                    {
                        return(typeof(Views.LivePlayerPage));
                    }
                    else
                    {
                        return(typeof(Views.BlankPage));
                    }
                }, sessionStateService);

                var name = nameof(PlayerViewManager.PrimaryViewPlayerNavigationService);
                Container.RegisterInstance(name, ns as INavigationService);
            });



            var hohoemaInAppNotification = new Views.HohoemaInAppNotification()
            {
                VerticalAlignment = VerticalAlignment.Bottom
            };

            var grid = new Grid()
            {
                Children =
                {
                    playerWithPageContainer,
                    hohoemaInAppNotification,
                }
            };


#if DEBUG
            menuPageBase.FocusEngaged += (__, args) => Debug.WriteLine("focus engagad: " + args.OriginalSource.ToString());
#endif

            return(grid);
        }
コード例 #4
0
ファイル: App.xaml.cs プロジェクト: willvin313/Hohoema
        UIElement CreateShell(out Frame rootFrame)
        {
            rootFrame           = new Frame();
            rootFrame.CacheSize = 5;

            rootFrame.NavigationFailed += (_, e) =>
            {
                Debug.WriteLine("Page navigation failed!!");
                Debug.WriteLine(e.SourcePageType.AssemblyQualifiedName);
                Debug.WriteLine(e.Exception.ToString());

                _ = OutputErrorFile(e.Exception, e.SourcePageType?.AssemblyQualifiedName);
            };


            rootFrame.Navigating += (_, e) =>
            {
                var pageManager = Container.Resolve <PageManager>();
                pageManager.RefrectNavigating(e);
            };

            rootFrame.Navigated += (_, e) =>
            {
                var pageManager = Container.Resolve <PageManager>();
                pageManager.RefrectNavigationState(e);
            };
            rootFrame.NavigationFailed += (_, e) =>
            {
                var pageManager = Container.Resolve <PageManager>();
                pageManager.RefrectNavigateFailed(e);
            };
            // Grid
            //   |- HohoemaInAppNotification
            //   |- PlayerWithPageContainerViewModel
            //   |    |- MenuNavigatePageBaseViewModel
            //   |         |- rootFrame

            var menuPageBase = new Views.MenuNavigatePageBase()
            {
                Content = rootFrame,
            };


            Views.PlayerWithPageContainer playerWithPageContainer = new Views.PlayerWithPageContainer()
            {
                Content = menuPageBase,
            };

            playerWithPageContainer.ObserveDependencyProperty(Views.PlayerWithPageContainer.FrameProperty)
            .Where(x => x != null)
            .Take(1)
            .Subscribe(async frame =>
            {
                var ns = Prism.Navigation.NavigationService.Create(playerWithPageContainer.Frame);

                var name = nameof(PlayerViewManager.PrimaryViewPlayerNavigationService);
                Container.GetContainer().RegisterInstance(name, ns as INavigationService);
            });



            var hohoemaInAppNotification = new Views.HohoemaInAppNotification()
            {
                VerticalAlignment = VerticalAlignment.Bottom
            };

            var grid = new Grid()
            {
                Children =
                {
                    playerWithPageContainer,
                    hohoemaInAppNotification,
                }
            };


#if DEBUG
            menuPageBase.FocusEngaged += (__, args) => Debug.WriteLine("focus engagad: " + args.OriginalSource.ToString());
#endif

            return(grid);
        }