当前位置: 首页>>代码示例>>C#>>正文


C# Client.FeedQuery类代码示例

本文整理汇总了C#中Google.GData.Client.FeedQuery的典型用法代码示例。如果您正苦于以下问题:C# FeedQuery类的具体用法?C# FeedQuery怎么用?C# FeedQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FeedQuery类属于Google.GData.Client命名空间,在下文中一共展示了FeedQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SelectUserBlog

        /** Lists the user's blogs and returns the URI for posting new entries
         * to the blog which the user selected.
         */
        static Uri SelectUserBlog(Service service)
        {
            Console.WriteLine("\nPlease select a blog on which to post.");
            FeedQuery query = new FeedQuery();
            // Retrieving a list of blogs
            query.Uri = new Uri("http://www.blogger.com/feeds/default/blogs");
            AtomFeed feed = service.Query(query);

            // Publishing a blog post
            Uri blogPostUri = null;
            if (feed != null)
            {
                foreach (AtomEntry entry in feed.Entries)
                {
                    // Print out the title of the Blog
                    Console.WriteLine("  Blog name: " + entry.Title.Text);
                    Console.Write("  Post to this blog? (y/n): ");
                    if (Console.ReadLine().Equals("y"))
                    {
                        // find the href in the link with a rel pointing to the blog's feed
                        for (int i = 0; i < entry.Links.Count; i++)
                        {
                            if (entry.Links[i].Rel.Equals("http://schemas.google.com/g/2005#post"))
                            {
                                blogPostUri = new Uri(entry.Links[i].HRef.ToString());
                                Console.WriteLine("  Your new posts will be sent to " + blogPostUri.AbsoluteUri.ToString());
                            }
                        }
                        return blogPostUri;
                    }
                }
            }
            return blogPostUri;
        }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:37,代码来源:ConsoleSample.cs

示例2: fetch

        internal CellFeed fetch(string uri)
        {
            try {
                // フィードアドレス設定
                FeedQuery singleQuery = new FeedQuery();
                singleQuery.Uri = new Uri(uri);

                AtomFeed feed;
                SpreadsheetEntry spreadsheet;

                // フィード取得
                feed = service.Query(singleQuery); // 認証エラーはここから
                if (feed.Entries.Count == 0) {
                    return null;
                }
                spreadsheet = (SpreadsheetEntry)feed.Entries[0];
                WorksheetFeed wsFeed = spreadsheet.Worksheets;
                WorksheetEntry worksheet = (WorksheetEntry)wsFeed.Entries[0];
                // Fetch the cell feed of the worksheet.
                CellQuery cellQuery = new CellQuery(worksheet.CellFeedLink);
                cellQuery.MinimumRow = 3;
                cellQuery.MinimumColumn = 2;
                cellQuery.MaximumColumn = 4;

                return service.Query(cellQuery);

            } catch (InvalidCredentialsException) {
                // 認証エラー
                throw;
            } catch (GDataRequestException) {
                // Execution of request failed: {address}
                throw;
            }
        }
开发者ID:jontamasan,项目名称:arma3jp-Downloader,代码行数:34,代码来源:Spreadsheet.cs

示例3: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Suchwort:");
            string searchTerm = Console.ReadLine();

            string uriSearchTerm = HttpUtility.UrlEncode(searchTerm);
            string url = "http://gdata.youtube.com/feeds/videos?q=" + uriSearchTerm;
            
            Console.WriteLine("Connection to YouTube - Searching: " + searchTerm);

            FeedQuery query = new FeedQuery("");
            Service service = new Service("youtube", "sample");
            query.Uri = new Uri(url);
            query.StartIndex = 0;
            query.NumberToRetrieve = 20;
            AtomFeed resultFeed = service.Query(query);

            foreach (AtomEntry entry in resultFeed.Entries)
            {
                Console.WriteLine("Title: " + entry.Title.Text);
                Console.WriteLine("Link: " + entry.AlternateUri.Content);
                Console.WriteLine("Tags:");
                foreach (AtomCategory cat in entry.Categories)
                {
                    Console.Write(cat.Term + ", ");
                }
                Console.WriteLine();
            }

            Console.ReadLine();
        }
开发者ID:davidalmas,项目名称:Samples,代码行数:31,代码来源:Program.cs

示例4: GetAllEntries

        public IList<BlogEntry> GetAllEntries()
        {
            FeedQuery query = new FeedQuery();
            query.Uri = new Uri("http://www.blogger.com/feeds/" + BlogId + "/posts/default");
            query.NumberToRetrieve = 500;

            return MapEntries(Service.Query(query).Entries);
        }
开发者ID:Letractively,项目名称:rpcwc,代码行数:8,代码来源:BloggerDaoGData.cs

示例5: Query

 /// <summary>
 ///  overwritten Query method
 /// </summary>
 /// <param name="feedQuery">The CodeSearchQuery touse</param>
 /// <returns>the retrieved CodeSearchFeed</returns>
 public new CodeSearchFeed Query(FeedQuery feedQuery) 
 {
     Stream feedStream = Query(feedQuery.Uri);
     CodeSearchFeed feed = new CodeSearchFeed(feedQuery.Uri, this);
     feed.Parse(feedStream, AlternativeFormat.Atom);
     feedStream.Close(); 
     return feed;
 }
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:13,代码来源:gcodesearchservice.cs

示例6: GetGoogleCalendar

        public AtomFeed GetGoogleCalendar()
        {
            Service service = new Service();
            FeedQuery query = new FeedQuery();
            query.Uri = new Uri(publicCalendarUrl);
            return service.Query(query);

        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:8,代码来源:CalendarSyncGoogle.cs

示例7: UseSSLTest

 public void UseSSLTest()
 {
     FeedQuery target = new FeedQuery(); // TODO: Initialize to an appropriate value
     bool expected = true; 
     bool actual;
     target.UseSSL = expected;
     actual = target.UseSSL;
     Assert.AreEqual(expected, actual);
 }
开发者ID:saeedesmaeili,项目名称:google-gdata,代码行数:9,代码来源:FeedQueryTest.cs

示例8: FeedCleanup

        //////////////////////////////////////////////////////////////////////
        /// <summary>empty a feed</summary> 
        //////////////////////////////////////////////////////////////////////
        protected void FeedCleanup(String uriToClean, String userName, String pwd)
        {
            Tracing.TraceCall();
            Tracing.TraceCall("Cleaning URI: " + uriToClean);

            if (!this.wipeFeeds)
            {
                Tracing.TraceInfo("Skipped cleaning URI due to configuration.");
                return;
            }

            FeedQuery query = new FeedQuery();
            Service service = new Service();

            if (uriToClean != null)
            {
                if (userName != null)
                {
                    service.Credentials = new GDataCredentials(userName, pwd);
                }

                GDataLoggingRequestFactory factory = (GDataLoggingRequestFactory)this.factory;
                factory.MethodOverride = true;
                service.RequestFactory = this.factory; 

                query.Uri = new Uri(uriToClean);

                Tracing.TraceCall("Querying " + uriToClean);
                AtomFeed feed = service.Query(query);
                Tracing.TraceCall("Queryed " + uriToClean);
                if (feed != null)
                    Tracing.TraceCall("Entries: " + feed.Entries.Count.ToString());

                int iCount = 0; 

                if (feed.Entries.Count > 0)
                {
                    while (feed.Entries.Count > 0)
                    {
                        Tracing.TraceCall("Feed has still " + feed.Entries.Count.ToString() + " entries left.");
                        foreach (AtomEntry entry in feed.Entries)
                        {
                            Tracing.TraceCall("Deleting entry " + iCount);
                            entry.Delete();
                            iCount++; 
                            Tracing.TraceCall("Deleted entry " + iCount);
                        }
                        feed = service.Query(query);
                    }

                    Assert.AreEqual(0, feed.Entries.Count, "Feed should have no more entries, it has: " + feed.Entries.Count); 
                    service.Credentials = null; 
                    factory.MethodOverride = false;
                }
            }
        }
开发者ID:mintwans,项目名称:cpsc483,代码行数:59,代码来源:baselivetestclass.cs

示例9: DefaultHostInsertOneAndDelete

        /////////////////////////////////////////////////////////////////////////////



        //////////////////////////////////////////////////////////////////////
        /// <summary>[Test] creates a new entry, saves and loads it back</summary> 
        //////////////////////////////////////////////////////////////////////
        [Test] public void DefaultHostInsertOneAndDelete()
        {
            Tracing.TraceMsg("Entering DefaultHostInsertOneAndDelete");
            AtomEntry entry = ObjectModelHelper.CreateAtomEntry(1); 
            Service service = new Service();
            FeedQuery query = new FeedQuery();
            service.RequestFactory = this.factory; 

            int iCount=0; 

            string strTitle = "DefaultHostInsertOneAndDelete" + Guid.NewGuid().ToString(); 
            entry.Title.Text = strTitle; 

            query.Uri = new Uri(this.defaultHost);
            AtomFeed returnFeed = service.Query(query);

            iCount = returnFeed.Entries.Count; 


            for (int i = 0; i < this.iIterations; i++)
            {
                Tracing.TraceMsg("DefaultHostInsertOneAndDelete, iteration : " + i); 

                Stream s = service.EntrySend(new Uri(this.defaultHost), entry, GDataRequestType.Insert); 
                s.Close();

                returnFeed = service.Query(query);
                Assert.AreEqual(iCount+1, returnFeed.Entries.Count, "feed should have one more entry now"); 

                AtomEntry returnEntry = null;

                foreach (AtomEntry feedEntry in returnFeed.Entries )
                {
                    if (String.Compare(feedEntry.Title.Text, strTitle) == 0)
                    {
                        // got him
                        returnEntry = feedEntry; 
                        break;
                    }
                }

                Assert.IsTrue(returnEntry != null, "did not find the just inserted entry"); 

                returnEntry.Delete();

                // query again and check count

                returnFeed = service.Query(query);

                Assert.AreEqual(iCount, returnFeed.Entries.Count, "feed has different number of entries as expected"); 
            }
        }
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:59,代码来源:writetest.cs

示例10: ListUserBlogs

 /** Lists the user's blogs. */
 static void ListUserBlogs(Service service)
 {
     Console.WriteLine("\nRetrieving a list of blogs");
     FeedQuery query = new FeedQuery();
     // Retrieving a list of blogs
     query.Uri = new Uri("http://www.blogger.com/feeds/default/blogs");
     AtomFeed feed = null;
     feed = service.Query(query);
     foreach (AtomEntry entry in feed.Entries)
     {
         Console.WriteLine("  Blog title: " + entry.Title.Text);
     }
 }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:14,代码来源:ConsoleSample.cs

示例11: IndexOLD

        public ActionResult IndexOLD(string id)
        {
            string uri;
            bool permalink = false;
            if (string.IsNullOrEmpty(id))
                uri = _baseUri;
            else
            {
                uri = postUri(id);
                permalink = true;
            }

            FeedQuery query = new FeedQuery();
            query.Uri = new Uri(uri);

            if (!permalink)
            {
                query.StartIndex = 0;
                query.NumberToRetrieve = 2;
            }

            AtomFeed feed = null;
            feed = _service.Query(query);

            var bpl = new List<BlogPost>();

            foreach (var e in feed.Entries)
            {
                var bp = new BlogPost()
                    {
                        Title = e.Title.Text,
                        Content = e.Content.Content,
                        Date = e.Published,
                        ID = e.EditUri.Content.Substring(e.EditUri.Content.LastIndexOf('/') + 1)
                    };
                bpl.Add(bp);
            }

            return View(new BlogListData()
                {
                    //SideBarData = new Models.Shared.MainSideBarData(),
                    Posts = bpl
                    //Posts = feed.Entries.Select(e => new BlogPost()
                    //{
                    //    Title = e.Title.Text,
                    //    Content = e.Content.Content,
                    //    Date = e.Published,
                    //    ID = Regex.Replace(e.Links.Single(l => l.Rel == "edit").HRef.ToString(), uri + "/", "")
                    //}).ToList()
                });
        }
开发者ID:getsetcode,项目名称:getsetcode,代码行数:51,代码来源:BlogController.cs

示例12: LoadWebinars

        private IList<Webinar> LoadWebinars()
        {
            var service = new YouTubeService("HibernatingRhinosExercise");
            var query = new FeedQuery(_uri);
            var webinars = new List<Webinar>();

            AtomFeed result = service.Query(query);
            if (result != null)
            {
                webinars = ParseAtomFeed(result);
            }

            return webinars;
        }
开发者ID:seesharpdev,项目名称:HibernatingRhinos,代码行数:14,代码来源:WebinarService.cs

示例13: FindWebinars

        public IList<Webinar> FindWebinars(string keyword)
        {
            var service = new YouTubeService("HibernatingRhinosExercise");
            var query = new FeedQuery("https://gdata.youtube.com/feeds/api/videos?q={0}" + keyword);
            var webinars = new List<Webinar>();

            AtomFeed result = service.Query(query);
            if (result != null)
            {
                webinars = ParseAtomFeed(result);
            }

            return webinars;
        }
开发者ID:seesharpdev,项目名称:HibernatingRhinos,代码行数:14,代码来源:WebinarService.cs

示例14: getActivityFeed

        public void getActivityFeed(String feedUri)
        {
            FeedQuery query = new FeedQuery();
            query.Uri = new Uri(feedUri);
            AtomFeed feed = service.Query(query);

            foreach (AtomEntry entry in feed.Entries)
            {
                Console.WriteLine(String.Format("Page: {0}", entry.Title.Text));

                String actionType = getCategoryLabel(entry.Categories);
                Console.WriteLine(String.Format("  {0} on {1}, by {2}", actionType,
                    entry.Updated.ToShortDateString(), entry.Authors[0].Email));
            }
        }
开发者ID:machshevet,项目名称:gdata-samples,代码行数:15,代码来源:SitesAPIDemo.cs

示例15: GetFeed

        public static AtomFeed GetFeed(string url = "", int start = 0, int num_results = 0)
        {
            FeedQuery query = new FeedQuery("");
            Google.GData.Client.Service service = new Google.GData.Client.Service();
            query.Uri = new Uri(url);
            if (start > 0) {
                query.StartIndex = start;
            }
            if (num_results > 0) {
                query.NumberToRetrieve = num_results;
            }

            AtomFeed feed = service.Query(query);
            return feed;
        }
开发者ID:janiukjf,项目名称:curtmfg,代码行数:15,代码来源:MediaModel.cs


注:本文中的Google.GData.Client.FeedQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。