Example #1
0
 public static CoverBuilder CreateRole(VideoRole role)
 {
     return new CoverBuilder(role)
     {
         CoverType = CoverType.Role
     };
 }
 public static bool Edit(Window parent, VideoRole role)
 {
     var window = new RoleEditorWindow() { Owner = parent };
     window.ViewModel.ReadFromObject(role);
     if (window.ShowDialog() == true)
     {
         window.ViewModel.WriteToObject(role);
         return true;
     }
     return false;
 }
Example #3
0
        public VideoRoleViewModel(VideoRole source, VideoRoleCollectionViewModel parent, IImdbItem imdbItem, bool isMajor)
            : base(source)
        {
            this.parent = parent;
            this.ImdbItem = imdbItem;
            this.IsMajor = isMajor;

            this.CoverViewModel.AutoGenerateCoverProvider = new AutoGenerateCoverProvider()
            {
                ImdbItem = imdbItem,
                TheTVDBItem = this.ImdbItem as ITheTVDBItem
            };
        }
Example #4
0
 private async Task<bool> TryAutoAddCoverAsync(DataCenter dataCenter, TheTVDBClient client, RemoteId removeId, VideoRole role)
 {
     var theTVDBId = await client.TryGetTheTVDBSeriesIdByRemoteIdAsync(removeId);
     if (theTVDBId == null) return false;
     var actor = await dataCenter.ArtistManager.FindAsync(role.ActorId);
     if (actor == null) return false;
     var actors = (await client.GetActorsBySeriesIdAsync(theTVDBId)).ToArray();
     actors = actors.Where(z => z.Id == actor.TheTVDBId).ToArray();
     if (actors.Length != 1) return false;
     if (!actors[0].HasBanner) return false;
     var url = actors[0].BuildUrl(client);
     var builder = CoverBuilder.CreateRole(role);
     builder.Uri.Add(url);
     return await dataCenter.CoverManager.BuildCoverAsync(builder);
 }
            private void CombineTo(VideoRole source, VideoRole dest)
            {
                Debug.Assert(source != null && dest != null);

                var coverId = (source as ICoverParent).CoverId;
                if (coverId != null)
                {
                    this.RemovedCoverId.Add(coverId);
                }

                if (source.RoleName != null)
                {
                    dest.RoleName = dest.RoleName == null
                        ? source.RoleName.ToList()
                        : source.RoleName.Concat(dest.RoleName).Distinct().ToList();
                }
            }
 private static bool Exchange(VideoRoleCollection source, VideoRoleCollection dest, VideoRole role)
 {
     if (source.MajorRoles?.Contains(role) == true)
     {
         source.MajorRoles.Remove(role);
         (dest.MajorRoles ?? (dest.MajorRoles = new List<VideoRole>())).Add(role);
         return true;
     }
     if (source.MinorRoles?.Contains(role) == true)
     {
         source.MinorRoles.Remove(role);
         (dest.MinorRoles ?? (dest.MinorRoles = new List<VideoRole>())).Add(role);
         return true;
     }
     return false;
 }