示例#1
0
        public static InAppNotificationPayload CreateRegistrationResultNotification(
            Mntone.Nico2.ContentManageResult registrationResult,
            string containerKindLabel,
            string containerTitle,
            string targetTitle,
            params InAppNotificationCommand[] commands
            )
        {
            string notifyContent = null;

            if (registrationResult == Mntone.Nico2.ContentManageResult.Success)
            {
                notifyContent = $"{containerKindLabel}に登録完了\n「{containerTitle}」に「{targetTitle}」を追加しました";
            }
            else if (registrationResult == Mntone.Nico2.ContentManageResult.Exist)
            {
                notifyContent = $"{containerKindLabel}に既に追加済み\n「{containerTitle}」に「{targetTitle}」を追加済みです";
            }
            else
            {
                notifyContent = $"{containerKindLabel}に登録失敗\n「{containerTitle}」に「{targetTitle}」を追加できませんでした";
            }

            return(new InAppNotificationPayload()
            {
                Content = notifyContent,
                ShowDuration = TimeSpan.FromSeconds(7),
                Commands = commands.ToList()
            });
        }
示例#2
0
        protected override async void Execute(object parameter)
        {
            if (parameter is Interfaces.IVideoContent content)
            {
                Mntone.Nico2.ContentManageResult result = Mntone.Nico2.ContentManageResult.Failed;
                var targetMylist = await _playlistSelectDialogService.ChoiceMylist();

                if (targetMylist is LocalPlaylist localPlaylist)
                {
                    localPlaylist.AddPlaylistItem(content);
                    result = Mntone.Nico2.ContentManageResult.Success;
                }
                else if (targetMylist is LoginUserMylistPlaylist loginUserMylist)
                {
                    var addedResult = await loginUserMylist.AddItem(content.Id);

                    result = addedResult.SuccessedItems.Count > 0 ? Mntone.Nico2.ContentManageResult.Success : Mntone.Nico2.ContentManageResult.Failed;
                }

                if (targetMylist != null)
                {
                    NotificationService.ShowInAppNotification(
                        Services.InAppNotificationPayload.CreateRegistrationResultNotification(
                            result,
                            "Mylist".Translate(),
                            targetMylist.Label,
                            content.Label
                            ));
                }
            }
        }
示例#3
0
        public static InAppNotificationPayload CreateRegistrationResultNotification(
            Mntone.Nico2.ContentManageResult registrationResult,
            string containerKindLabel,
            string containerTitle,
            string targetTitle,
            params InAppNotificationCommand[] commands
            )
        {
            string notifyContent = null;

            if (registrationResult == Mntone.Nico2.ContentManageResult.Success)
            {
                notifyContent = "CompleteRegisrationForKind0_AddItem1_ToKindTitle2".Translate(containerKindLabel, containerKindLabel, targetTitle);
            }
            else if (registrationResult == Mntone.Nico2.ContentManageResult.Exist)
            {
                notifyContent = "ExistRegisrationForKind0_AddItem2_ToKindTitle1".Translate(containerKindLabel, containerKindLabel, targetTitle);
            }
            else
            {
                notifyContent = "FailedRegisrationForKind0_AddItem2_ToKindTitle1".Translate(containerKindLabel, containerKindLabel, targetTitle);
            }

            return(new InAppNotificationPayload()
            {
                Content = notifyContent,
                ShowDuration = TimeSpan.FromSeconds(7),
                Commands = commands.ToList()
            });
        }