protected override async void Execute(object parameter) { if (parameter is Interfaces.IFollowable) { // TODO: MessageDialogによるフォロー解除の確認 var followManager = HohoemaCommnadHelper.GetHohoemaApp().FollowManager; var followType = GetFollowItemType(parameter as Interfaces.IFollowable); string id; if (parameter is Interfaces.INiconicoContent) { id = (parameter as Interfaces.INiconicoContent).Id; } else if (parameter is Interfaces.ISearchWithtag) { id = (parameter as Interfaces.ISearchWithtag).Tag; } else { throw new NotSupportedException(); } var result = await followManager.RemoveFollow(followType, id); } }
protected override async void Execute(object parameter) { if (parameter is Interfaces.IVideoContent) { var content = parameter as Interfaces.IVideoContent; var mediaManager = HohoemaCommnadHelper.GetHohoemaApp().CacheManager; await mediaManager.RequestCache(content.Id); } }
protected override async void Execute(object parameter) { if (parameter is Interfaces.IVideoContent) { var content = parameter as Interfaces.IVideoContent; var cacheManager = HohoemaCommnadHelper.GetHohoemaApp().CacheManager; var requests = await cacheManager.GetCacheRequest(content.Id); if (requests.Any(x => x.ToCacheState() == NicoVideoCacheState.Cached)) { // キャッシュ済みがある場合は、削除確認を行う var dialog = new MessageDialog( $"{content.Label} の キャッシュデータ(全ての画質)を削除します。この操作は元に戻せません。", "キャッシュの削除確認" ); dialog.Commands.Add(new UICommand() { Label = "キャッシュを削除", Invoked = async(uicommand) => { await cacheManager.CancelCacheRequest(content.Id); } }); dialog.Commands.Add(new UICommand() { Label = "キャンセル", }); dialog.DefaultCommandIndex = 1; await dialog.ShowAsync(); } else { // キャッシュリクエストのみで // キャッシュがいずれも未完了の場合は // 確認無しで削除 foreach (var req in requests) { await cacheManager.CancelCacheRequest(req.RawVideoId, req.Quality); } } } }
protected override async void Execute(object parameter) { if (parameter is Interfaces.IVideoContent) { var content = parameter as Interfaces.IVideoContent; var hohoemaApp = HohoemaCommnadHelper.GetHohoemaApp(); var targetMylist = await hohoemaApp.ChoiceMylist(); if (targetMylist != null) { var result = await hohoemaApp.AddMylistItem(targetMylist, content.Label, content.Id); (App.Current as App).PublishInAppNotification( Models.InAppNotificationPayload.CreateRegistrationResultNotification( result, "マイリスト", targetMylist.Label, content.Label )); } } }
protected override async void Execute(object parameter) { var hohoemaApp = HohoemaCommnadHelper.GetHohoemaApp(); await hohoemaApp.SignOut(); }
protected override async void Execute(object parameter) { if (parameter is Interfaces.IVideoContent) { var content = parameter as Interfaces.IVideoContent; var hohoemaApp = HohoemaCommnadHelper.GetHohoemaApp(); var ownerName = content.OwnerUserName; if (string.IsNullOrEmpty(ownerName)) { if (content.OwnerUserType == Mntone.Nico2.Videos.Thumbnail.UserType.User) { try { var userInfo = await hohoemaApp.ContentProvider.GetUserDetail(content.OwnerUserId); ownerName = userInfo.Nickname; } catch { return; } } else if (content.OwnerUserType == Mntone.Nico2.Videos.Thumbnail.UserType.Channel) { var channelInfo = await hohoemaApp.ContentProvider.GetChannelInfo(content.OwnerUserId); ownerName = channelInfo.Name; var channel = Database.NicoVideoOwnerDb.Get(content.OwnerUserId) ?? new Database.NicoVideoOwner() { OwnerId = channelInfo.ChannelId.ToString(), UserType = Mntone.Nico2.Videos.Thumbnail.UserType.Channel, }; channel.ScreenName = channelInfo.ScreenName ?? channel.ScreenName; Database.NicoVideoOwnerDb.AddOrUpdate(channel); } } var dialog = new MessageDialog( $"この変更は投稿者({ownerName} さん)のアプリ内ユーザー情報ページから取り消すことができます。", $"『{ownerName}』さんの投稿動画を非表示にしますか?" ); dialog.Commands.Add(new UICommand() { Label = "非表示に設定", Invoked = (uicommand) => { hohoemaApp.UserSettings.NGSettings.AddNGVideoOwnerId(content.OwnerUserId.ToString(), ownerName); } }); dialog.Commands.Add(new UICommand() { Label = "キャンセル" }); dialog.DefaultCommandIndex = 0; await dialog.ShowAsync(); } }