public override void OnItemClicked(Graphic item)
        {
            if (item == null)
            {
                return;
            }
            object o = null;

            if (item.Attributes.TryGetValue("Link", out o))
            {
                Uri targetUri = null;
                if (Uri.TryCreate(o.ToString(), UriKind.Absolute, out targetUri))
                {
                    System.Windows.Browser.HtmlPage.Window.Navigate(targetUri, "_blank");
                }
            }
            else if (item.Attributes.TryGetValue("FeedItem", out o))
            {
                System.ServiceModel.Syndication.SyndicationItem feedItem = o as System.ServiceModel.Syndication.SyndicationItem;
                if (feedItem != null)
                {
                    System.Windows.Browser.HtmlPage.Window.Navigate(feedItem.BaseUri, "_blank");
                }
            }
        }
Exemplo n.º 2
0
 public Vest(System.ServiceModel.Syndication.SyndicationItem ajtem)
 {
     Title = ajtem.Title.Text;
     Text  = ajtem.Summary.Text;
     Date  = ajtem.PublishDate;
     URI   = ajtem.Links[0].Uri.AbsoluteUri;
 }
Exemplo n.º 3
0
        public static async Task SubscribeAsync(this DatabaseContextBuilder dbb, ulong gid, ulong cid, string url, string name = null)
        {
            System.ServiceModel.Syndication.SyndicationItem newest = RssService.GetFeedResults(url)?.FirstOrDefault();
            if (newest is null)
            {
                throw new Exception("Can't load the feed entries.");
            }

            using (DatabaseContext db = dbb.CreateContext()) {
                DatabaseRssFeed feed = db.RssFeeds.SingleOrDefault(f => f.Url == url);
                if (feed is null)
                {
                    feed = new DatabaseRssFeed {
                        Url         = url,
                        LastPostUrl = newest.Links[0].Uri.ToString()
                    };
                    db.RssFeeds.Add(feed);
                    await db.SaveChangesAsync();
                }

                db.RssSubscriptions.Add(new DatabaseRssSubscription {
                    ChannelId = cid,
                    GuildId   = gid,
                    Id        = feed.Id,
                    Name      = name ?? url
                });

                await db.SaveChangesAsync();
            }
        }
 public static string GetEnclosureUri(this System.ServiceModel.Syndication.SyndicationItem item)
 {
     for (int i = 0; i < item.Links.Count; i++)
     {
         if (item.Links[i].RelationshipType == "enclosure")
         {
             return(item.Links[i].Uri.AbsoluteUri);
         }
     }
     return("");
 }
Exemplo n.º 5
0
 public NewsFeedPanel(System.ServiceModel.Syndication.SyndicationItem item)
 {
     InitializeComponent();
     newsItem = item;
 }
Exemplo n.º 6
0
 protected SyndicationItem(System.ServiceModel.Syndication.SyndicationItem source)
 {
 }