private async void BeginLoadCover(Action <JryCover> callback) { if (callback == null) { throw new ArgumentNullException(nameof(callback)); } var coverId = this.Source.CoverId; JryCover cover = null; if (coverId != null) { cover = await this.GetManagers().CoverManager.LoadCoverAsync(coverId); } if (cover == null) { var generater = this.AutoGenerateCoverProvider; if (generater == null || !await generater.GenerateAsync(this.GetManagers(), this.Source)) { return; } Debug.Assert(this.Source.CoverId != null); cover = await this.GetManagers().CoverManager.LoadCoverAsync(coverId); Debug.Assert(cover != null); } if (this.IsDelayLoad) { await Task.Yield(); } this.OnLoadCoverEnd(cover); callback(cover); }
public async void BeginUpdateCover() { if (this.Source.CoverId != null || await this.TryAutoAddCoverAsync()) { var coverManager = JryVideoCore.Current.CurrentDataCenter.CoverManager; this.Cover = await coverManager.LoadCoverAsync(this.Source.CoverId); } }
public Task <bool> UpgradeAsync(JryCover item) { item.CoverSourceType = default(int); item.DoubanId = null; item.ImdbId = null; item.SeriesId = null; item.VideoId = null; item.ActorId = null; item.Uri = null; return(Patch0000.TrueTask); }
public JryCover Build(byte[] binaryData) { var cover = new JryCover() { CoverType = this.CoverType, BinaryData = binaryData }; cover.BuildMetaData(); cover.Id = this.Id; return(cover); }
public async Task <bool> UpgradeAsync(DataCenter dataCenter, JryCover cover) { string oldCoverId; switch (cover.CoverType) { case CoverType.Artist: break; case CoverType.Video: if (cover.VideoId == null || cover.VideoId == cover.Id) { return(true); } oldCoverId = cover.Id; cover.Id = cover.VideoId; await dataCenter.CoverManager.Source.InsertOrUpdateAsync(cover); await dataCenter.CoverManager.Source.RemoveAsync(oldCoverId); return(true); case CoverType.Background: if (cover.VideoId == null || JryVideoInfo.CreateBackgroundCoverId(cover.VideoId) == cover.Id) { return(true); } oldCoverId = cover.Id; cover.Id = JryVideoInfo.CreateBackgroundCoverId(cover.VideoId); await dataCenter.CoverManager.Source.InsertOrUpdateAsync(cover); await dataCenter.CoverManager.Source.RemoveAsync(oldCoverId); return(true); case CoverType.Role: break; } // return true to update old item, but we remove old item. return(false); }
public Task<bool> UpgradeAsync(JryCover cover) => TrueTask;
Task <bool> IPatch <JryCover> .UpgradeAsync(JryCover item) { throw new NotImplementedException(); }
protected override void OnLoadCoverEnd(JryCover cover) { this.OpacityData = cover?.Opacity; base.OnLoadCoverEnd(cover); }
protected virtual void OnLoadCoverEnd(JryCover cover) { }
public CoverRef(JryCover obj) : base(obj) { this.CoverType = obj.CoverType; }
private void BuildCover(JryCover cover) => this.covers.Add(cover.Id, new CoverRef(cover));