Beispiel #1
0
        public async Task NavigationAsync(string pageName, INavigationParameters parameters)
        {
            using (await _playerNavigationLock.LockAsync())
            {
                if (SecondaryCoreAppView == null)
                {
                    await CreateSecondaryView();
                }

                await SecondaryCoreAppView.ExecuteOnUIThreadAsync(async() =>
                {
                    var result = await SecondaryViewPlayerNavigationService.NavigateAsync(pageName, parameters, new DrillInNavigationTransitionInfo());
                    if (result.Success)
                    {
                        var name = ResolveContentName(pageName, parameters);
                        SecondaryAppView.Title = name != null ? $"{name}" : "Hohoema";
                    }
                    else
                    {
                        Debug.WriteLine(result.Exception?.ToString());
                        await CloseAsync();
                        throw result.Exception;
                    }

                    await ApplicationViewSwitcher.TryShowAsStandaloneAsync(this.SecondaryAppView.Id, ViewSizePreference.Default, MainViewId, ViewSizePreference.UseNone);
                });

//                await ShowSecondaryViewAsync();

                IsShowSecondaryView = true;
            }
        }
Beispiel #2
0
        /// <summary>
        /// SecondaryViewを閉じます。
        /// MainViewから呼び出すと別スレッドアクセスでエラーになるはず
        /// </summary>
        public async Task CloseAsync()
        {
            if (!IsShowSecondaryView)
            {
                return;
            }

            await SecondaryCoreAppView.ExecuteOnUIThreadAsync(async() =>
            {
                SecondaryAppView.Title = "Hohoema";

                await ShowMainViewAsync();

                await SecondaryViewPlayerNavigationService.NavigateAsync(nameof(Views.BlankPage), new SuppressNavigationTransitionInfo());

                await SecondaryAppView.TryConsolidateAsync();
            });
        }
Beispiel #3
0
        public async Task ToggleFullScreenAsync()
        {
            if (!IsShowSecondaryView)
            {
                return;
            }

            await SecondaryCoreAppView.ExecuteOnUIThreadAsync(() =>
            {
                if (SecondaryAppView.IsFullScreenMode)
                {
                    SecondaryAppView.ExitFullScreenMode();
                }
                else
                {
                    SecondaryAppView.TryEnterFullScreenMode();
                }
            });
        }
Beispiel #4
0
        //private PlayerViewMode? _PlayerViewMode;
        //public PlayerViewMode PlayerViewMode
        //{
        //    get
        //    {
        //        if (_PlayerViewMode != null) { return _PlayerViewMode.Value; }

        //        var localObjectStorageHelper = new LocalObjectStorageHelper();
        //        _PlayerViewMode = localObjectStorageHelper.Read(nameof(PlayerViewMode), PlayerViewMode.PrimaryView);

        //        return _PlayerViewMode.Value;
        //    }
        //    private set
        //    {
        //        CurrentViewScheduler.Schedule(() =>
        //        {
        //            if (SetProperty(ref _PlayerViewMode, value))
        //            {
        //                var localObjectStorageHelper = new LocalObjectStorageHelper();
        //                localObjectStorageHelper.Save(nameof(PlayerViewMode), _PlayerViewMode.Value);

        //                RaisePropertyChanged(nameof(IsPlayerShowWithPrimaryView));
        //                RaisePropertyChanged(nameof(IsPlayerShowWithSecondaryView));
        //                RaisePropertyChanged(nameof(IsPlayingWithPrimaryView));
        //                RaisePropertyChanged(nameof(IsPlayingWithSecondaryView));

        //                // PlayerViewMode変更後の動画再生を再開
        //                EventAggregator.GetEvent<PlayerViewModeChangeEvent>()
        //                    .Publish(new PlayerViewModeChangeEventArgs()
        //                    {
        //                        ViewMode = _PlayerViewMode.Value
        //                    });
        //            }
        //        });
        //    }
        //}

        //public bool IsPlayerShowWithPrimaryView => PlayerViewMode == PlayerViewMode.PrimaryView;
        //public bool IsPlayerShowWithSecondaryView => PlayerViewMode == PlayerViewMode.SecondaryView;

        //public bool IsPlayingWithPrimaryView => NowPlaying && PlayerViewMode == PlayerViewMode.PrimaryView;
        //public bool IsPlayingWithSecondaryView => NowPlaying && PlayerViewMode == PlayerViewMode.SecondaryView;

        //private bool _IsPlayerSmallWindowModeEnabled;
        //public bool IsPlayerSmallWindowModeEnabled
        //{
        //    get { return _IsPlayerSmallWindowModeEnabled; }
        //    set
        //    {
        //        CurrentViewScheduler.Schedule(() =>
        //        {
        //            if (SetProperty(ref _IsPlayerSmallWindowModeEnabled, value))
        //            {
        //                ToggleFullScreenWhenApplicationViewShowWithStandalone();
        //            }
        //        });
        //    }
        //}

        // メインビューを閉じたらプレイヤービューも閉じる
        private async void MainView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            if (sender.Id == MainViewId)
            {
                if (SecondaryCoreAppView != null)
                {
                    await SecondaryCoreAppView.ExecuteOnUIThreadAsync(async() =>
                    {
                        if (SecondaryAppView != null)
                        {
                            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4))
                            {
                                await SecondaryAppView.TryConsolidateAsync();
                            }
                            else
                            {
                                App.Current.Exit();
                            }
                        }
                    });
                }
            }
        }
Beispiel #5
0
        public async Task ToggleCompactOverlayAsync()
        {
            if (!IsShowSecondaryView)
            {
                return;
            }

            if (!SecondaryAppView.IsViewModeSupported(ApplicationViewMode.CompactOverlay))
            {
                return;
            }

            await SecondaryCoreAppView.ExecuteOnUIThreadAsync(async() =>
            {
                if (SecondaryAppView.ViewMode == ApplicationViewMode.Default)
                {
                    await SecondaryAppView.TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay);
                }
                else
                {
                    await SecondaryAppView.TryEnterViewModeAsync(ApplicationViewMode.Default);
                }
            });
        }