Ejemplo n.º 1
0
        internal void RemoveFeedSrouce(FeedItemSourceListItem feedSourceListItem)
        {
            var feedSource = feedSourceListItem.FeedSource;

            FeedGroup.RemoveUserFeedSource(feedSource);

            switch (feedSource.FollowItemType)
            {
            case FollowItemType.Tag:
                if (TagFeedSources.Remove(feedSourceListItem))
                {
                    var favInfo = HohoemaApp.FollowManager.Tag.FollowInfoItems.SingleOrDefault(x => x.Id == feedSource.Id);
                    if (favInfo != null)
                    {
                        TagFavItems.Add(favInfo);
                    }
                }
                break;

            case FollowItemType.Mylist:
                if (MylistFeedSources.Remove(feedSourceListItem))
                {
                    var favInfo = HohoemaApp.FollowManager.Mylist.FollowInfoItems.SingleOrDefault(x => x.Id == feedSource.Id);
                    if (favInfo != null)
                    {
                        MylistFavItems.Add(favInfo);
                    }
                }
                break;

            case FollowItemType.User:
                if (UserFeedSources.Remove(feedSourceListItem))
                {
                    var favInfo = HohoemaApp.FollowManager.User.FollowInfoItems.SingleOrDefault(x => x.Id == feedSource.Id);
                    if (favInfo != null)
                    {
                        UserFavItems.Add(favInfo);
                    }
                }
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            FeedGroup = null;

            if (e.Parameter is Guid)
            {
                var feedGroupId = (Guid)e.Parameter;

                FeedGroup = HohoemaApp.FeedManager.GetFeedGroup(feedGroupId);
            }
            else if (e.Parameter is string)
            {
                var feedGroupId = Guid.Parse(e.Parameter as string);

                FeedGroup = HohoemaApp.FeedManager.GetFeedGroup(feedGroupId);
            }

            IsDeleted.Value = FeedGroup == null;

            if (FeedGroup != null)
            {
                UpdateTitle(FeedGroup.Label);

                FeedGroupName.Value = FeedGroup.Label;

                MylistFeedSources.Clear();
                foreach (var mylistFeedSrouce in FeedGroup.FeedSourceList.Where(x => x.FollowItemType == FollowItemType.Mylist))
                {
                    MylistFeedSources.Add(new FeedItemSourceListItem(mylistFeedSrouce, this));
                }

                MylistFavItems.Clear();
                foreach (var mylistFavInfo in HohoemaApp.FollowManager.Mylist.FollowInfoItems.Where(x => MylistFeedSources.All(y => x.Id != y.FeedSource.Id)))
                {
                    MylistFavItems.Add(mylistFavInfo);
                }

                TagFeedSources.Clear();
                foreach (var tagFeedSrouce in FeedGroup.FeedSourceList.Where(x => x.FollowItemType == FollowItemType.Tag))
                {
                    TagFeedSources.Add(new FeedItemSourceListItem(tagFeedSrouce, this));
                }

                TagFavItems.Clear();
                foreach (var tagFavInfo in HohoemaApp.FollowManager.Tag.FollowInfoItems.Where(x => TagFeedSources.All(y => x.Id != y.FeedSource.Id)))
                {
                    TagFavItems.Add(tagFavInfo);
                }

                UserFeedSources.Clear();
                foreach (var userFeedSrouce in FeedGroup.FeedSourceList.Where(x => x.FollowItemType == FollowItemType.User))
                {
                    UserFeedSources.Add(new FeedItemSourceListItem(userFeedSrouce, this));
                }

                UserFavItems.Clear();
                foreach (var userFavInfo in HohoemaApp.FollowManager.User.FollowInfoItems.Where(x => UserFeedSources.All(y => x.Id != y.FeedSource.Id)))
                {
                    UserFavItems.Add(userFavInfo);
                }
            }
        }