コード例 #1
0
        /// <summary>
        /// キャッシュ要求の基本処理を実行します
        /// DividedQualityNicoVideoから呼び出されます
        /// </summary>
        /// <returns></returns>
        internal async Task OnCacheRequested()
        {
            IfVideoDeletedThrowException();

            if (CommentClient != null)
            {
                await CommentClient.GetComments();
            }


            var info = await VideoInfoDb.GetEnsureNicoVideoInfoAsync(RawVideoId);

            info.VideoId   = this.VideoId;
            info.Length    = this.VideoLength;
            info.LowSize   = (uint)this.SizeLow;
            info.HighSize  = (uint)this.SizeHigh;
            info.Title     = this.Title;
            info.UserId    = this.OwnerId;
            info.MovieType = this.ContentType;
            info.PostedAt  = this.PostedAt;
            info.SetTags(this.Tags);
            info.ViewCount    = this.ViewCount;
            info.MylistCount  = this.MylistCount;
            info.CommentCount = this.CommentCount;
            info.ThumbnailUrl = this.ThumbnailUrl;

            await VideoInfoDb.UpdateAsync(info);
        }
コード例 #2
0
        internal async Task NotifyCacheForceDeleted(NicoVideo nicoVideo)
        {
            // キャッシュ登録を削除
            var videoInfo = await VideoInfoDb.GetAsync(nicoVideo.RawVideoId);

            if (videoInfo != null)
            {
                videoInfo.IsDeleted = true;
                await VideoInfoDb.UpdateAsync(videoInfo);
            }

            var toastService = App.Current.Container.Resolve <Views.Service.ToastNotificationService>();

            toastService.ShowText("動画削除:" + nicoVideo.RawVideoId
                                  , $"{nicoVideo.Title} はニコニコ動画サーバーから削除されたため、キャッシュを強制削除しました。"
                                  , Microsoft.Toolkit.Uwp.Notifications.ToastDuration.Long
                                  );
        }