Esempio n. 1
0
        protected override void Execute(object item)
        {
            try
            {
                if (item is VideoListItemControlViewModel itemVM && itemVM.VideoHiddenInfo != null)
                {
                    return;
                }

                if (item is string contentId)
                {
                    _messenger.Send(VideoPlayRequestMessage.PlayVideo(contentId));
                }
                else if (item is VideoId videoId)
                {
                    _messenger.Send(VideoPlayRequestMessage.PlayVideo(videoId));
                }
                else if (item is IVideoContent videoContent)
                {
                    _messenger.Send(VideoPlayRequestMessage.PlayVideo(videoContent.VideoId));
                }
            }
            catch (Exception e)
            {
                _logger.ZLogError(e, "video play faield");
            }
        }
 void ExecutePlayQueuePlaylistCommand()
 {
     if (_queuePlaylist.Any())
     {
         _messenger.Send(VideoPlayRequestMessage.PlayPlaylist(_queuePlaylist));
     }
 }
Esempio n. 3
0
 protected override void Execute(object parameter)
 {
     if (parameter is IPlaylistItemPlayable playable && playable.PlaylistItemToken is not null and var token)
     {
         if (token.Playlist is ISortablePlaylist)
         {
             _messenger.Send(VideoPlayRequestMessage.PlayPlaylist(token));
         }
     }
 }
Esempio n. 4
0
 protected override void Execute(object parameter)
 {
     if (parameter is IPlaylist playlist)
     {
         _messenger.Send(VideoPlayRequestMessage.PlayPlaylist(playlist));
     }
     else if (parameter is PlaylistToken playlistToken)
     {
         _messenger.Send(VideoPlayRequestMessage.PlayPlaylist(playlistToken));
     }
 }
Esempio n. 5
0
        private async Task <InAppNotificationPayload> SubmitVideoContentSuggestion(VideoId videoId)
        {
            var(res, nicoVideo) = await NicoVideoProvider.GetVideoInfoAsync(videoId);

            if (res.Video.IsDeleted || string.IsNullOrEmpty(nicoVideo.Title))
            {
                return(null);
            }

            return(new InAppNotificationPayload()
            {
                Content = "InAppNotification_ContentDetectedFromClipboard".Translate(nicoVideo.Title),
                ShowDuration = DefaultNotificationShowDuration,
                IsShowDismissButton = true,
                Commands =
                {
                    new InAppNotificationCommand()
                    {
                        Label = "Play".Translate(),
                        Command = new RelayCommand(() =>
                        {
                            _messenger.Send(VideoPlayRequestMessage.PlayVideo(videoId));

                            NotificationService.DismissInAppNotification();
                        })
                    },
                    new InAppNotificationCommand()
                    {
                        Label = "@view".Translate(),
                        Command = new RelayCommand(() =>
                        {
                            _queuePlaylist.Add(nicoVideo);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                    new InAppNotificationCommand()
                    {
                        Label = HohoemaPageType.VideoInfomation.Translate(),
                        Command = new RelayCommand(() =>
                        {
                            PageManager.OpenPageWithId(HohoemaPageType.VideoInfomation, videoId);

                            NotificationService.DismissInAppNotification();
                        })
                    },
                }
            });
        }