コード例 #1
0
        private async void Playback_MediaEndReach()
        {
            switch (PlaybackService.PlayingType)
            {
            case PlayingType.Music:
                break;

            case PlayingType.Video:
                await DispatchHelper.InvokeAsync(CoreDispatcherPriority.Low, () =>
                {
                    if (Locator.VideoPlayerVm.CurrentVideo != null)
                    {
                        Locator.VideoPlayerVm.CurrentVideo.TimeWatchedSeconds = 0;
                    }
                });

                if (Locator.VideoPlayerVm.CurrentVideo != null)
                {
                    await Locator.MediaLibrary.UpdateVideo(Locator.VideoPlayerVm.CurrentVideo).ConfigureAwait(false);
                }
                break;

            case PlayingType.NotPlaying:
                break;

            default:
                break;
            }

            if (!PlaybackService.CanGoNext())
            {
                await DispatchHelper.InvokeAsync(CoreDispatcherPriority.Low, () =>
                {
                    if (PlaybackService.PlayingType == PlayingType.Video)
                    {
                        App.RootPage.StopCompositionAnimationOnSwapChain();
                    }
                    IsPlaying = false;
                    if (!Locator.NavigationService.GoBack_Default())
                    {
                        Locator.NavigationService.Go(Locator.SettingsVM.HomePage);
                    }
                });
            }
        }