Exemplo n.º 1
0
        private async Task <InAppNotificationPayload> SubmitLiveContentSuggestion(string liveId)
        {
            var liveDesc = await NicoLiveProvider.GetLiveInfoAsync(liveId);

            if (liveDesc == null)
            {
                return(null);
            }

            var liveTitle = liveDesc.VideoInfo.Video.Title;

            var payload = new InAppNotificationPayload()
            {
                Content             = "InAppNotification_ContentDetectedFromClipboard".Translate(liveTitle),
                ShowDuration        = DefaultNotificationShowDuration,
                SymbolIcon          = Symbol.Video,
                IsShowDismissButton = true,
                Commands            =
                {
                    new InAppNotificationCommand()
                    {
                        Label   = "WatchLiveStreaming".Translate(),
                        Command = new DelegateCommand(() =>
                        {
                            _eventAggregator.GetEvent <Services.Player.PlayerPlayLiveRequest>()
                            .Publish(new Services.Player.PlayerPlayLiveRequestEventArgs()
                            {
                                LiveId = liveId
                            });

                            NotificationService.DismissInAppNotification();
                        })
                    },
                    new InAppNotificationCommand()
                    {
                        Label   = HohoemaPageType.LiveInfomation.Translate(),
                        Command = new DelegateCommand(() =>
                        {
                            PageManager.OpenPageWithId(HohoemaPageType.LiveInfomation, liveId);

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

            if (liveDesc.VideoInfo.Community != null)
            {
                payload.Commands.Add(new InAppNotificationCommand()
                {
                    Label   = HohoemaPageType.Community.Translate(),
                    Command = new DelegateCommand(() =>
                    {
                        PageManager.OpenPageWithId(HohoemaPageType.Community, liveDesc.VideoInfo.Community.GlobalId);

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

            return(payload);
        }