Beispiel #1
0
        static Func <FollowItemInfo, FavoriteItemViewModel> MakeFavItemVMFactory(FollowItemType type)
        {
            Func <FollowItemInfo, FavoriteItemViewModel> fac = null;

            switch (type)
            {
            case FollowItemType.Tag:
                fac = item => new TagFavItemVM(item);
                break;

            case FollowItemType.Mylist:
                fac = item => new MylistFavItemVM(item);
                break;

            case FollowItemType.User:
                fac = item => new UserFavItemVM(item);
                break;

            case FollowItemType.Community:
                fac = item => new CommunityFavItemVM(item);
                break;

            case FollowItemType.Channel:
                fac = item => new ChannelFavItemVM(item);
                break;

            default:
                throw new NotSupportedException();
            }

            return(fac);
        }
Beispiel #2
0
        static Func <FollowItemInfo, FavoriteItemViewModel> MakeFavItemVMFactory(FollowItemType type)
        {
            Func <FollowItemInfo, FavoriteItemViewModel> fac = null;

            switch (type)
            {
            case FollowItemType.Tag:
                fac = item => App.Current.Container.Resolve <TagFavItemVM>(new ParameterOverride("follow", item));
                break;

            case FollowItemType.Mylist:
                fac = item => App.Current.Container.Resolve <MylistFavItemVM>(new ParameterOverride("follow", item));
                break;

            case FollowItemType.User:
                fac = item => App.Current.Container.Resolve <UserFavItemVM>(new ParameterOverride("follow", item));
                break;

            case FollowItemType.Community:
                fac = item => App.Current.Container.Resolve <CommunityFavItemVM>(new ParameterOverride("follow", item));
                break;

            case FollowItemType.Channel:
                fac = item => App.Current.Container.Resolve <ChannelFavItemVM>(new ParameterOverride("follow", item));
                break;

            default:
                throw new NotSupportedException();
            }

            return(fac);
        }
Beispiel #3
0
        public async Task <ContentManageResult> RemoveFollow(FollowItemType itemType, string id)
        {
            var group = _FollowGroupsMap[itemType];

            var result = await group.RemoveFollow(id);

            return(result);
        }
Beispiel #4
0
        public async Task <ContentManageResult> AddFollow(FollowItemType itemType, string id, string name, object token = null)
        {
            var group = _FollowGroupsMap[itemType];

            var result = await group.AddFollow(name, id, token);

            return(result);
        }
Beispiel #5
0
        public async Task <ContentManageResult> RemoveFollow(FollowItemType itemType, string id, object token = null)
        {
            var group = GetFollowInfoGroup(itemType);

            var result = await group.RemoveFollow(id, token);

            return(result);
        }
Beispiel #6
0
        public bool IsFollowItem(FollowItemType itemType, string id)
        {
            var group = _FollowGroupsMap[itemType];

            if (itemType == FollowItemType.Tag)
            {
                id = TagStringHelper.ToEnsureHankakuNumberTagString(id);
            }

            return(group.IsFollowItem(id));
        }
Beispiel #7
0
        public static Database.BookmarkType FollowItemTypeConvertToFeedSourceType(FollowItemType followType)
        {
            switch (followType)
            {
            case FollowItemType.Tag:
                return(Database.BookmarkType.SearchWithTag);

            case FollowItemType.Mylist:
                return(Database.BookmarkType.Mylist);

            case FollowItemType.User:
                return(Database.BookmarkType.User);

            default:
                throw new NotSupportedException(followType.ToString() + " is not support feed group source type.");
            }
        }
Beispiel #8
0
        public Task Sync(FollowItemType itemType)
        {
            switch (itemType)
            {
            case FollowItemType.Tag:
                return(Sync(Tag));

            case FollowItemType.Mylist:
                return(Sync(Mylist));

            case FollowItemType.User:
                return(Sync(User));

            case FollowItemType.Community:
                return(Sync(Community));

            default:
                return(Task.CompletedTask);
            }
        }
Beispiel #9
0
        private IFollowInfoGroup GetFollowInfoGroup(FollowItemType itemType)
        {
            switch (itemType)
            {
            case FollowItemType.Tag:
                return(Tag);

            case FollowItemType.Mylist:
                return(Mylist);

            case FollowItemType.User:
                return(User);

            case FollowItemType.Community:
                return(Community);

            default:
                throw new Exception();
            }
        }
Beispiel #10
0
        public static NiconicoItemType?ToNiconicoItemType(this FollowItemType favorite)
        {
            switch (favorite)
            {
            case FollowItemType.Tag:
                return(null);

            case FollowItemType.Mylist:
                return(NiconicoItemType.Mylist);

            case FollowItemType.User:
                return(NiconicoItemType.User);

            case FollowItemType.Community:
                return(null);

            default:
                throw new NotSupportedException();
            }
        }
Beispiel #11
0
 public FollowItemInfo FindFollowInfo(FollowItemType itemType, string id)
 {
     return(_FollowGroupsMap[itemType].FollowInfoItems.SingleOrDefault(x => x.Id == id));
 }
Beispiel #12
0
 public bool CanMoreAddFollow(FollowItemType itemType)
 {
     return(_FollowGroupsMap[itemType].CanMoreAddFollow());
 }
Beispiel #13
0
		public bool ExistFeedSource(FollowItemType itemType, string id)
		{
			return _FeedSourceList.Any(x => x.FollowItemType == itemType && x.Id == id);
		}
Beispiel #14
0
 public FollowItemInfo FindFollowInfo(FollowItemType itemType, string id)
 {
     return(GetFollowInfoGroup(itemType).FollowInfoItems.SingleOrDefault(x => x.Id == id));
 }
Beispiel #15
0
 public bool CanMoreAddFollow(FollowItemType itemType)
 {
     return(GetFollowInfoGroup(itemType).CanMoreAddFollow());
 }