コード例 #1
0
ファイル: SampleDataSource.cs プロジェクト: ronelsax/Apollo
        public static async Task<bool> AddGroupForFeedAsync(string feedUrl)
        {
            if (SampleDataSource.GetGroup(feedUrl) != null)
            {
                return false;
            }

            var feed = await new SyndicationClient().RetrieveFeedAsync(new Uri(feedUrl));

            var feedGroup = new SampleDataGroup(
                uniqueId: feedUrl,
                title: feed.Title != null ? feed.Title.Text : null,
                subtitle: feed.Subtitle != null ? feed.Subtitle.Text : null,
                imagePath: feed.ImageUri != null ? feed.ImageUri.ToString() : null,
                description: null);

            foreach (var i in feed.Items)
            {
                string imagePath = GetImageFromPostContents(i);
                if (imagePath != null && feedGroup.Image == null)
                    feedGroup.SetImage(imagePath);
                feedGroup.Items.Add(new SampleDataItem(
                    uniqueId: i.Id, title: i.Title.Text, subtitle: null, imagePath: imagePath,
                    description: null, content: i.Summary.Text, @group: feedGroup));
            }

            AllGroups.Add(feedGroup);
            return true;
        }
コード例 #2
0
ファイル: SampleDataSource.cs プロジェクト: ronelsax/Apollo
 public SampleDataItem(String uniqueId, String title, String subtitle, String imagePath, String description, String content, SampleDataGroup group)
     : base(uniqueId, title, subtitle, imagePath, description)
 {
     this._content = content;
     this._group = group;
 }