コード例 #1
0
        public Dictionary <string, NewFeed1> FBListNewFeed2(List <string> Handle, int limit = 25)
        {
            //Dùng tốt
            Dictionary <string, NewFeed1> result = new Dictionary <string, NewFeed1>();
            // Clipboard.SetText(Handle[4]);
            string s = http.Get("https://graph.facebook.com/me/home?fields=id,created_time,message&limit=" + limit + "&access_token=" + Handle[4]).ToString();
            //MessageBox.Show(s);
            NewFeed         nf  = JsonConvert.DeserializeObject <NewFeed>(s);
            List <NewFeed1> lnf = nf.data.ToList();

            for (int i = 0; i < lnf.Count; i++)
            {
                NewFeed1 nf1 = lnf[i];
                nf1.id           = lnf[i].id;
                nf1.created_time = lnf[i].created_time;
                nf1.message      = lnf[i].message;
                if (!result.ContainsKey(lnf[i].id))
                {
                    result.Add(lnf[i].id, nf1);
                }
                // MessageBox.Show(nf1.ToString());
            }

            return(result);
        }
コード例 #2
0
 public async Task ManualRefresh(CurrencyEnum selectedCurrency)
 {
     currencyInfos = CoinMarketDownloader.GetTop10(selectedCurrency).Result;
     NewFeed.Invoke(ProduceDataForListViewItems());
     if (CurrencyInfoFeed != null)
     {
         CurrencyInfoFeed.Invoke();
     }
     await fileSaver.SavaData(currencyInfos);
 }
コード例 #3
0
        public void ChangeSelectedCurrency(CurrencyEnum selectedCurrency)
        {
            this.selectedCurrency = selectedCurrency;
            if ((DateTime.Now - ((CurrencyInfo)currencyInfos.FirstOrDefault()).LastTimeUpdated) >
                new TimeSpan(0, 0, 30))
            {
                if (CurrencyInfoFeed != null)
                {
                    CurrencyInfoFeed.Invoke();
                }

                NewFeed.Invoke(ProduceDataForListViewItems());
            }
        }
コード例 #4
0
 public ActionResult <bool> Post()
 {
     try
     {
         var newFeedOne = new NewFeed {
             Name = "Test", Comment = "Test Comment"
         };
         this.NewFeedCollectionContext.NewFeeds.Add(newFeedOne);
         this.NewFeedCollectionContext.SaveChanges();
         return(true);
     }
     catch (System.Exception e)
     {
         throw;
     }
 }
コード例 #5
0
        public Dictionary <string, string> FBListNewFeed(List <string> Handle)
        {
            Dictionary <string, string> result = new Dictionary <string, string>();
            string s = http.Get("https://graph.facebook.com/me/home?fields=id,created_time,message&access_token=" + Handle[4]).ToString();
            //MessageBox.Show(s);
            NewFeed         nf  = JsonConvert.DeserializeObject <NewFeed>(s);
            List <NewFeed1> lnf = nf.data.ToList();

            for (int i = 0; i < lnf.Count; i++)
            {
                //NewFeed1 nf1 = lnf[i].id;
                //result.Add(n3.id, n3.name);
                if (!result.ContainsKey(lnf[i].id))
                {
                    result.Add(lnf[i].id, lnf[i].message);
                }
                //  MessageBox.Show(lnf[i].id + "|" + lnf[i].message);
            }

            return(result);
        }
コード例 #6
0
        public IActionResult SetRSS(NewFeed model)
        {
            if (model.url.Substring(0, 7) != "http://")
            {
                model.url = "http://" + model.url;
            }
            if (VerifyRSS(model.url) == false)
            {
                ModelState.AddModelError("url", "Invalid feed URL.");
                ViewBag.Feed = _context.Podcasts.FirstOrDefault().Feed;
                return(View("EditRSS"));
            }
            Podcast podcast  = _context.Podcasts.FirstOrDefault();
            bool    updating = true;

            if (podcast == null)
            {
                podcast  = new Podcast();
                updating = false;
            }
            podcast.Feed = model.url;
            XmlDocument doc = new XmlDocument();

            doc.Load(model.url);
            XmlElement root = doc.DocumentElement;

            podcast.Title = root.SelectSingleNode("channel/title").InnerText;
            if (updating)
            {
                _context.Update(podcast);
            }
            else
            {
                _context.Add(podcast);
            }
            _context.SaveChanges();
            return(RedirectToAction("EditRSS"));
        }