• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Client.Service类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Index

        public void Index()
        {
            var g = new Service("local", "application");//, "ABQIAAAACPMbozlNv9AIzNvsWUm6vhSvnLMDprvOSMH9Qt_oH5Ww7FTw1hRHT7gTSie1yM34rowNwVfw424XPA");

            Assert.Fail("Need to put password here");
            g.setUserCredentials("[email protected]", "zzz");
            var entry = new AtomEntry();
            entry.Content.ExtensionFactories.Add(new MapsExtension());
            entry.Title.Text = "test";
               entry.Content.Type = "application/vnd.google-earth.kml+xml";
               XmlDocument doc = new XmlDocument();
            doc.LoadXml(@"<Placemark xmlns='http://www.opengis.net/kml/2.2'>
                   <name>Faulkner's Birthplace</name>
                   <description/>
                   <Point>
                     <coordinates>-89.520753,34.360902,0.0</coordinates>
                   </Point>
                 </Placemark>");
            entry.Content.ExtensionElements.Add(new XmlExtension((XmlNode)doc.DocumentElement));
                 //    doc.LoadXml(@"@"<m:Placemark>
                 //  <m:name>Faulkner's Birthplace</m:name>
                 //  <m:description/>
                 //  <m:Point>
                 //    <m:coordinates>-89.520753,34.360902,0.0</m:coordinates>
                 //  </m:Point>
                 //</m:Placemark>";

            //entry.Content.Content = ;
            //entry.AddExtension(new MapsExtension());
            var m = new MemoryStream();
            //var mapStuff = entry.Content.CreateExtension("PlaceMark", "http://www.opengis.net/kml/2.2");

               // entry.Update();
            try
            {
                entry.SaveToXml(m);
            }
            catch (Exception e)
            {
                var s = e.ToString();
                throw;
            }
            m.Position = 0;
            var mm = new StreamReader(m).ReadToEnd();
             var q = g.Insert(new Uri("http://maps.google.com/maps/feeds/features/208433541473729117510/0004779109f86bbabd62d/full"), entry);

            var p = g.Query(new Uri("http://maps.google.com/maps/feeds/maps/default/full"));

            var z = new StreamReader(p).ReadToEnd();

            //// Arrange
            //HomeController controller = new HomeController();

            //// Act
            //ViewResult result = controller.Index() as ViewResult;

            //// Assert
            //ViewDataDictionary viewData = result.ViewData;
            //Assert.AreEqual("Welcome to ASP.NET MVC!", viewData["Message"]);
        }
开发者ID:hankbeasley,项目名称:hoahome,代码行数:60,代码来源:HomeControllerTest.cs


示例2: 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


示例3: PostNewEntry

        /** Creates a new blog entry and sends it to the specified Uri */
        static AtomEntry PostNewEntry(Service service, Uri blogPostUri)
        {
            Console.WriteLine("\nPublishing a blog post");
            AtomEntry createdEntry = null;
            if (blogPostUri != null)
            {
                // construct the new entry
                AtomEntry newPost = new AtomEntry();
                newPost.Title.Text = "Marriage!";
                newPost.Content = new AtomContent();
                newPost.Content.Content = "<div xmlns='http://www.w3.org/1999/xhtml'>" +
                    "<p>Mr. Darcy has <em>proposed marriage</em> to me!</p>" +
                    "<p>He is the last man on earth I would ever desire to marry.</p>" +
                    "<p>Whatever shall I do?</p>" +
                    "</div>";
                newPost.Content.Type = "xhtml";
                newPost.Authors.Add(new AtomPerson());
                newPost.Authors[0].Name = "Elizabeth Bennet";
                newPost.Authors[0].Email = "[email protected]";

                createdEntry = service.Insert(blogPostUri, newPost);
                if (createdEntry != null)
                {
                    Console.WriteLine("  New blog post created with title: " + createdEntry.Title.Text);
                }
            }
            return createdEntry;
        }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:29,代码来源:ConsoleSample.cs


示例4: 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


示例5: 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


示例6: Google2uManualWorkbook

 public Google2uManualWorkbook(WorksheetFeed in_feed, string in_url, string in_name, Service in_service)
 {
     _Service = in_service;
     WorkbookUrl = in_url;
     Workbook = in_feed;
     WorkbookName = in_name;
     Worksheets = new List<Google2uWorksheet>();
 }
开发者ID:joenarus,项目名称:Stressident,代码行数:8,代码来源:Google2uManualWorkbook.cs


示例7: UriTest

 public void UriTest()
 {
     Uri uri = new Uri("http://www.test.com/");
     IService service = new Service();
     ServiceEventArgs target = new ServiceEventArgs(uri, service); // TODO: Initialize to an appropriate value
     Uri actual;
     actual = target.Uri;
     Assert.AreEqual(actual, uri);
 }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:9,代码来源:ServiceEventArgsTest.cs


示例8: GoogleClientLogin

        /// <summary>
        /// allows you to construct the dialog with a given service
        /// </summary>
        /// <param name="serviceToUse">the service object to use</param>
        public GoogleClientLogin(Service serviceToUse)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.service = serviceToUse;
        }
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:13,代码来源:GoogleClientLogin.cs


示例9: RequestFactoryTest

 public void RequestFactoryTest()
 {
     Service target = new Service(); // TODO: Initialize to an appropriate value
     IGDataRequestFactory expected = new GDataGAuthRequestFactory("cl", "test");
     IGDataRequestFactory actual;
     target.RequestFactory = expected;
     actual = target.RequestFactory;
     Assert.AreEqual(expected, actual);
 }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:9,代码来源:ServiceTest.cs


示例10: 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


示例11: 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


示例12: Google2uAccountWorkbook

        public Google2uAccountWorkbook(SpreadsheetEntry in_spreadsheet, Service in_service)
        {
            Workbook = in_spreadsheet;
            WorkbookName = in_spreadsheet.Title.Text;
            _Service = in_service;

            foreach (var link in in_spreadsheet.Links.Where(in_link => in_link.Rel.Equals("alternate", StringComparison.OrdinalIgnoreCase)))
            {
                WorkbookUrl = link.HRef.ToString();
                break;
            }
            Worksheets = new List<Google2uWorksheet>();
        }
开发者ID:DarkRay,项目名称:neverending-story,代码行数:13,代码来源:Google2uAccountWorkbook.cs


示例13: 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


示例14: 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


示例15: PublishNewEntry

        public void PublishNewEntry(BlogDescriptor blogDescriptor, String title, String content)
        {
            if (blogDescriptor == null)
                throw new ArgumentNullException("blogDescriptor");
            if (String.IsNullOrEmpty(blogDescriptor.Username))
                throw new ArgumentException("blogDescriptor.Username cannot be null or an empty string.");

            var entry = new gClient.AtomEntry();
            entry.Content.Content = content;
            entry.Content.Type = "html";
            entry.Title.Text = title;

            var service = new gClient.Service("blogger", GoogleSucks.GetApplicationName());
            service.Credentials = new gClient.GDataCredentials(blogDescriptor.Username, blogDescriptor.Password);
            service.Insert(new Uri(GetFeedUri(blogDescriptor)), entry);
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:16,代码来源:BloggerEngine.cs


示例16: DefaultHostDeleteAll

        //////////////////////////////////////////////////////////////////////
        /// <summary>deletes all entries in defhost feed</summary> 
        //////////////////////////////////////////////////////////////////////
        [Test] public void DefaultHostDeleteAll()
        {
            Tracing.TraceMsg("Entering DefaultHostDeleteAll");

            FeedQuery query = new FeedQuery();
            Service service = new Service();
            service.RequestFactory = this.factory; 
            query.Uri = new Uri(this.defaultHost);

            AtomFeed returnFeed = service.Query(query);

            foreach (AtomEntry entry in returnFeed.Entries )
            {
                entry.Delete();
            }
        }
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:19,代码来源:writetest.cs


示例17: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            Service service = new Service("cl", "companyName-appName-1");
            service.setUserCredentials("[email protected]", "jWH>45bY1");
            EventEntry entry = new EventEntry();
            DataSet ds = new DataSet();
            When eventTimes = new When();
            AtomEntry insertedEntry;

            SqlConnection cn = new SqlConnection();
            try
            {
                cn = DBDevite.DBOpen();

                SqlDataAdapter da = new SqlDataAdapter("SELECT u.Users as userw, c.Name as client, t.Date as date, t.TimeStart as start, t.TimeEnd as endw, t.About as about, t.TaskStatus " +
                                                       "FROM tasks t " +
                                                       "LEFT JOIN users u ON t.userID = u.ID " +
                                                       "LEFT JOIN clients c ON t.clientID = c.ID " +
                                                       "WHERE t.TaskStatus = 'true'", cn);
                SqlCommandBuilder cb = new SqlCommandBuilder(da);
                da.Fill(ds);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DBDevite.DBClose(cn);
            }

            Uri postUri = new Uri("http://www.google.com/calendar/feeds/[email protected]/private/full");
            //запись в EventEntry
            foreach(DataTable thisTable in ds.Tables)
            {
                foreach(DataRow row in thisTable.Rows)
                {
                    entry.Title.Text = row["client"].ToString() + "  " + row["userw"].ToString();
                    entry.Content.Content = row["about"].ToString();

                    eventTimes.StartTime = Convert.ToDateTime(Convert.ToDateTime(row["date"].ToString()).ToString("dd-MM-yyyy") + " " + row["start"].ToString().Trim() + ":00");
                    eventTimes.EndTime = Convert.ToDateTime(Convert.ToDateTime(row["date"].ToString()).ToString("dd-MM-yyyy") + " " + row["endw"].ToString().Trim() + ":00");
                    entry.Times.Add(eventTimes);
                    insertedEntry = service.Insert(postUri, entry);
                }
            }
        }
开发者ID:kos89,项目名称:kos89repository,代码行数:47,代码来源:TasksForm.cs


示例18: BloggerWrapper

        public BloggerWrapper(Settings settings, User user)
        {
            if (settings == null) throw new ArgumentNullException("settings");
            if (user == null) throw new ArgumentNullException("user");

            Settings = settings;
            User = user;
            BloggerService = new Service("blogger", "BlogMyFlickr")
                                 {
                                     Credentials =
                                         new GDataCredentials(settings.BloggerUserName,
                                                              settings.BloggerPassword)
                                 };

            GDataGAuthRequestFactory factory = (GDataGAuthRequestFactory)BloggerService.RequestFactory;
            factory.AccountType = "GOOGLE";
        }
开发者ID:slowmonkey,项目名称:Blog-My-Flickr,代码行数:17,代码来源:BloggerWrapper.cs


示例19: GoogleFinanceLib

        public GoogleFinanceLib()
        {
            Service sFinance = new Service("finance", "StockTicker");//"CCSC-StockTicker-1a");

            /*
             *  Setup credentials.
             */
            sFinance.Credentials = new GDataCredentials(sUsername, sPassword);
            GDataGAuthRequestFactory rfFactory = (GDataGAuthRequestFactory)sFinance.RequestFactory;
            rfFactory.AccountType = "GOOGLE";

            FeedQuery fqQuery = new FeedQuery();
            /*
             *  Need "query" uri.
             */
            fqQuery.Uri = new Uri("http://www.google.com/finance");
            fqQuery.Query = "GOOG";
            /*            AtomFeed afFeed = sFinance.Query(fqQuery);
            */
            //            string s = "";
        }
开发者ID:PaulCurtis,项目名称:Stocks,代码行数:21,代码来源:GoogleFinanceLib.cs


示例20: DefaultHostMassiveInsertAndDelete

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


        //////////////////////////////////////////////////////////////////////
        /// <summary>creates a number or rows and delets them again</summary> 
        //////////////////////////////////////////////////////////////////////
        [Test] public void DefaultHostMassiveInsertAndDelete()
        {
            Tracing.TraceMsg("Entering DefaultHostMassiveInsertAndDelete");

            int iCount=0; 
            FeedQuery query = new FeedQuery();

            Service service = new Service();
            service.RequestFactory = this.factory; 

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


            iCount = returnFeed.Entries.Count; 

            AtomEntryCollection newEntries = new AtomEntryCollection(null); 


            // now we have all we need. 

            for (int i = 0; i < this.iIterations; i++)
            {
                entry = ObjectModelHelper.CreateAtomEntry(i); 
                entry = returnFeed.Insert(entry); 
                newEntries.Add(entry);
            }

            Tracing.TraceMsg("DefaultHostMassiveInsert: inserted lot's of  entries");
            // done doing the inserts...

            // now query the guy again. 

            returnFeed = service.Query(query);
            Assert.AreEqual(iCount+this.iIterations, returnFeed.Entries.Count, "feed should have " + this.iIterations + " more entries now"); 

            // now udpate the 100 entries we have added

            for (int i = 0; i < this.iIterations; i++)
            {
                entry = newEntries[i];
                entry.Title.Text = Guid.NewGuid().ToString(); 
                entry.Update(); 
            }
            Tracing.TraceMsg("DefaultHostMassiveInsert: updated lot's of entries");

            returnFeed = service.Query(query);
            Assert.AreEqual(iCount+this.iIterations, returnFeed.Entries.Count, "feed should have " + this.iIterations + " more entries now"); 

            // let's find them and delete them...
            for (int i = 0; i < this.iIterations; i++)
            {
                entry = newEntries[i];
                foreach (AtomEntry feedEntry in returnFeed.Entries )
                {
                    if (String.Compare(feedEntry.Title.Text, entry.Title.Text) == 0)
                    {
                        // got him
                        Tracing.TraceMsg("trying to delete entry: " + feedEntry.Title.Text +" = " + entry.Title.Text);
                        feedEntry.Delete(); 
                        break;
                    }
                }
            }


            // and a last time
            returnFeed = service.Query(query);
            Assert.AreEqual(iCount, returnFeed.Entries.Count, "feed should have the same number again"); 

            Tracing.TraceMsg("DefaultHostMassiveInsertAndDelete: deleted lot's of entries");

        }
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:80,代码来源:writetest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Spreadsheets.SpreadsheetsService类代码示例发布时间:2022-05-26
下一篇:
C# Client.FeedQuery类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap