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

C# Calendar.CalendarService类代码示例

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

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



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

示例1: Delete

 public bool Delete(Task task)
 {
     ErrorMessage = String.Empty;
     CalendarService service = new CalendarService("googleCalendar");
     service.setUserCredentials(task.AccountInfo.Username, task.AccountInfo.Password);
     Log.InfoFormat("Fetching google account : [{0}]", task.AccountInfo.ToString());
     string queryUri = String.Format(CultureInfo.InvariantCulture,
                                     "http://www.google.com/calendar/feeds/{0}/private/full",
                                     service.Credentials.Username);
     Log.DebugFormat("Query='{0}'", queryUri);
     EventQuery eventQuery = new EventQuery(queryUri);
     try
     {
         EventFeed eventFeed = service.Query(eventQuery);
         foreach (EventEntry eventEntry in eventFeed.Entries.Cast<EventEntry>())
         {
             if (eventEntry.Times.Count > 0)
             {
                 if (eventEntry.EventId == task.Id)
                 {
                     Log.InfoFormat("Deleting : [{0}]-[{1}]", eventEntry.EventId, eventEntry.Title);
                     eventEntry.Delete();
                     return true;
                 }
             }
         }
     }
     catch (Exception exception)
     {
         Log.ErrorFormat(exception.Message);
         Log.ErrorFormat(exception.ToString());
         ErrorMessage = exception.Message;
     }
     return false;
 }
开发者ID:trippleflux,项目名称:jezatools,代码行数:35,代码来源:GoogleTaskManager.cs


示例2: Insert

 public bool Insert(Task task)
 {
     EventEntry eventEntry = new EventEntry
                             {
                                 Title = {Text = task.Head},
                                 Content = {Content = task.Description,},
                                 Locations = {new Where("", "", task.Location)},
                                 Times = {new When(task.StartDate, task.StopDate)},
                             };
     Log.InfoFormat("Inserting new entry to google : [{0}]", task.ToString());
     CalendarService service = new CalendarService("googleCalendarInsert");
     service.setUserCredentials(task.AccountInfo.Username, task.AccountInfo.Password);
     Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/private/full");
     ErrorMessage = String.Empty;
     try
     {
         EventEntry createdEntry = service.Insert(postUri, eventEntry);
         return createdEntry != null;
     }
     catch (Exception exception)
     {
         Log.ErrorFormat(exception.Message);
         Log.ErrorFormat(exception.ToString());
         ErrorMessage = exception.Message;
     }
     return false;
 }
开发者ID:trippleflux,项目名称:jezatools,代码行数:27,代码来源:GoogleTaskManager.cs


示例3: getService

 private CalendarService getService()
 {
     // Create a CalenderService and authenticate
     CalendarService googleCalendarService = new CalendarService("rpcwc-rpcwcorg-2");
     googleCalendarService.setUserCredentials("[email protected]", "Vert1go");
     return googleCalendarService;
 }
开发者ID:Letractively,项目名称:rpcwc,代码行数:7,代码来源:CalendarDAOGData.cs


示例4: GoogleCalendar

 public GoogleCalendar()
 {
     this.userName = GoogleUsername;
     this.userPassword = GooglePassword;
     calendarService = new CalendarService("webcsm");
     calendarService.setUserCredentials(userName, userPassword);
 }
开发者ID:cizfilip,项目名称:webcsm,代码行数:7,代码来源:GoogleCalendar.cs


示例5: BookThemAllSample

 public BookThemAllSample(string domain, string admin, string password)
 {
     apps = new AppsService(domain, admin, password);
     calendar = new CalendarService("BookThemAll");
     calendar.setUserCredentials(admin, password);
     this.admin = admin;
 }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:7,代码来源:BookThemAll.cs


示例6: CalendarManager

 public CalendarManager(string email, string password)
 {
     _userID = email;
     _password = password;
     _myService = new CalendarService("Bruce's Application");
     _myService.setUserCredentials(_userID, _password);
 }
开发者ID:Chukkii,项目名称:Google-Suite,代码行数:7,代码来源:CalendarManager.cs


示例7: googlecalendarSMSreminder

        public void googlecalendarSMSreminder(string sendstring)
        {
            CalendarService service = new CalendarService("exampleCo-exampleApp-1");
            service.setUserCredentials(UserName.Text, Password.Text);

            EventEntry entry = new EventEntry();

            // Set the title and content of the entry.
            entry.Title.Text = sendstring;
            entry.Content.Content = "Nadpis Test SMS.";
            // Set a location for the event.
            Where eventLocation = new Where();
            eventLocation.ValueString = "Test sms";
            entry.Locations.Add(eventLocation);

            When eventTime = new When(DateTime.Now.AddMinutes(3), DateTime.Now.AddHours(1));
            entry.Times.Add(eventTime);

            //Add SMS Reminder
            Reminder fiftyMinReminder = new Reminder();
            fiftyMinReminder.Minutes = 1;
            fiftyMinReminder.Method = Reminder.ReminderMethod.sms;
            entry.Reminders.Add(fiftyMinReminder);

            Uri postUri = new Uri("http://www.google.com/calendar/feeds/default/private/full");

            // Send the request and receive the response:
            AtomEntry insertedEntry = service.Insert(postUri, entry);
        }
开发者ID:salih18200,项目名称:orcs,代码行数:29,代码来源:Calendar.cs


示例8: GetCalendarEvents

        public static List<CalendarEvent> GetCalendarEvents(Calendar calendar)
        {
            List<CalendarEvent> eventList = new List<CalendarEvent>();

            EventQuery query = new EventQuery();
            CalendarService service = new CalendarService("GoogleCalendarReminder");
            service.SetAuthenticationToken(GetAuthToken());

            //service.setUserCredentials(Account.Default.Username
            //                            , SecureStringUtility.SecureStringToString(Account.Default.Password));

            query.Uri = new Uri(calendar.CalendarUri);
            query.SingleEvents = true;
            query.StartTime = DateTime.Now;
            query.EndTime = DateTime.Today.AddDays(Settings.Default.DayRange);

            EventFeed calFeed;
            try
            {
                calFeed = service.Query(query) as EventFeed;
            }
            catch (Exception)
            {
                return null;
            }

            // now populate the calendar
            while (calFeed != null && calFeed.Entries.Count > 0)
            {
                foreach (EventEntry entry in calFeed.Entries)
                {
                    eventList.Add(new CalendarEvent(entry)
                                        {
                                            Color = calendar.Color
                                        });
                }

                // just query the same query again.
                if (calFeed.NextChunk != null)
                {
                    query.Uri = new Uri(calFeed.NextChunk);

                    try
                    {
                        calFeed = service.Query(query) as EventFeed;
                    }
                    catch (Exception ex)
                    {
                        return null;
                    }
                }
                else
                {
                    calFeed = null;
                }
            }

            return eventList;
        }
开发者ID:cyndilou,项目名称:CalendarReminderApp,代码行数:59,代码来源:GoogleCalendarService.cs


示例9: ClassInit

        public static void ClassInit( TestContext context )
        {
            _creds = GooCalCreds.CreateAndValidate();
            _calendarPurge = (CalendarPurge)CalendarPurgeFactory.Create( _creds );
            _service = _calendarPurge.GoogleCalendarService;

            DeleteAllEvents();
        }
开发者ID:nCubed,项目名称:Google-Calendar-Purge,代码行数:8,代码来源:CalendarPurgeIntegrationTests.cs


示例10: Authenticate

        public void Authenticate(string account, string password)
        {
            _calendarService = new Google.GData.Calendar.CalendarService("");
            _calendarService.setUserCredentials(account, password);

            _calendarUri = new Uri(string.Format("https://www.google.com/calendar/feeds/{0}/private/full", account));
            _isAuthenticated = true;
        }
开发者ID:Rookian,项目名称:GoogleCalendar,代码行数:8,代码来源:CalendarService.cs


示例11: GetPostableEvents

        public PostableEvents GetPostableEvents(string calendarId)
        {
            var result = new PostableEvents();

            var service = new CalendarService("WascherCom.Auto.CalendarToBlog");

            if (!string.IsNullOrWhiteSpace(UserId))
            {
                service.setUserCredentials(UserId, Password);
            }

            var query = new EventQuery
                {
                    Uri = new Uri(string.Format(GOOGLE_URI, calendarId)),
                    StartTime = StartDate.AddDays(-DaysForPastEvents),
                    EndTime = StartDate.AddDays(DaysForCurrentEvents + DaysForFutureEvents)
                };

            var eventFeed = service.Query(query);

            if (eventFeed == null || eventFeed.Entries.Count == 0)
            {
                return result;
            }

            foreach (EventEntry entry in eventFeed.Entries)
            {
                foreach (var time in entry.Times)
                {
                    var calEvent = new CalendarEvent
                        {
                            Title = entry.Title.Text,
                            Description = string.Empty,
                            StartDateTime = time.StartTime,
                            EndDateTime = time.EndTime,
                            IsAllDay = time.AllDay
                        };

                    if (calEvent.StartDateTime < StartDate)
                    {
                        result.PastEvents.Add(calEvent);
                    }
                    else if (calEvent.StartDateTime > StartDate.AddDays(DaysForCurrentEvents))
                    {
                        result.FutureEvents.Add(calEvent);
                    }
                    else
                    {
                        result.CurrentEvents.Add(calEvent);
                    }

                    Console.WriteLine(string.Format("{0}: {1} All Day: {2}", entry.Title.Text, time.StartTime, time.AllDay));
                }
            }

            return result;
        }
开发者ID:chadjriddle,项目名称:WascherCom,代码行数:57,代码来源:CalendarReader.cs


示例12: AuthenticateV2

        public void AuthenticateV2()
        {
            // create an OAuth factory to use
            log.Debug("Authenticating to calendar service using 2-legged OAuth");
            GOAuthRequestFactory requestFactory = new GOAuthRequestFactory("cl", "MyApp");
            requestFactory.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
            requestFactory.ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"];

            service = new CalendarService("MyApp");
            service.RequestFactory = requestFactory;
        }
开发者ID:atosorigin,项目名称:GoogleToExchangeCalendarMigration,代码行数:11,代码来源:GoogleCalendarApi.cs


示例13: Init

        public bool Init(string user, string password)
        {
            service = new CalendarService("GTrello");
            service.setUserCredentials(user, password);

            if (!LoadMapping())
            {
                return false;
            }
            return CollectEntries();
        }
开发者ID:czoper,项目名称:GTrello,代码行数:11,代码来源:Calendar.cs


示例14: SetProxy

 private void SetProxy(CalendarService service)
 {
     var f = (GDataRequestFactory) service.RequestFactory;
     IWebProxy iProxy = WebRequest.DefaultWebProxy;
     var myProxy = new WebProxy(iProxy.GetProxy(new Uri(GOOGLE_CALENDAR_URI)))
                   	{
                   		Credentials = CredentialCache.DefaultCredentials,
                   		UseDefaultCredentials = true
                   	};
     f.Proxy = myProxy;
 }
开发者ID:MrKevHunter,项目名称:Outlook2010GoogleCalendarSync,代码行数:11,代码来源:GoogleCalendarProxiedService.cs


示例15: PrintAllEvents

        /// <summary>
        /// Prints the titles of all events on the specified calendar.
        /// </summary>
        /// <param name="service">The authenticated CalendarService object.</param>
        static void PrintAllEvents(CalendarService service)
        {
            EventQuery myQuery = new EventQuery(feedUri);
            EventFeed myResultsFeed = service.Query(myQuery) as EventFeed;

            Console.WriteLine("All events on your calendar:");
            Console.WriteLine();
            for (int i = 0; i < myResultsFeed.Entries.Count; i++)
            {
                Console.WriteLine(myResultsFeed.Entries[i].Title.Text);
            }
            Console.WriteLine();
        }
开发者ID:mintwans,项目名称:cpsc483,代码行数:17,代码来源:CalendarDemo.cs


示例16: Main

        static void Main(string[] args)
        {
            try
            {
                // create an OAuth factory to use
                GOAuthRequestFactory requestFactory = new GOAuthRequestFactory("cl", "MyApp");
                requestFactory.ConsumerKey = "CONSUMER_KEY";
                requestFactory.ConsumerSecret = "CONSUMER_SECRET";

                // example of performing a query (use OAuthUri or query.OAuthRequestorId)
                Uri calendarUri = new OAuthUri("http://www.google.com/calendar/feeds/default/owncalendars/full", "USER", "DOMAIN");
                // can use plain Uri if setting OAuthRequestorId in the query
                // Uri calendarUri = new Uri("http://www.google.com/calendar/feeds/default/owncalendars/full");

                CalendarQuery query = new CalendarQuery();
                query.Uri = calendarUri;
                query.OAuthRequestorId = "[email protected]"; // can do this instead of using OAuthUri for queries

                CalendarService service = new CalendarService("MyApp");
                service.RequestFactory = requestFactory;
                service.Query(query);
                Console.WriteLine("Query Success!");

                // example with insert (must use OAuthUri)
                Uri contactsUri = new OAuthUri("http://www.google.com/m8/feeds/contacts/default/full", "USER", "DOMAIN");

                ContactEntry entry = new ContactEntry();
                EMail primaryEmail = new EMail("[email protected]");
                primaryEmail.Primary = true;
                primaryEmail.Rel = ContactsRelationships.IsHome;
                entry.Emails.Add(primaryEmail);

                ContactsService contactsService = new ContactsService("MyApp");
                contactsService.RequestFactory = requestFactory;
                contactsService.Insert(contactsUri, entry); // this could throw if contact exists

                Console.WriteLine("Insert Success!");

                // to perform a batch use
                // service.Batch(batchFeed, new OAuthUri(atomFeed.Batch, userName, domain));

                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Fail!");
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
                Console.ReadKey();
            }
        }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:51,代码来源:Program.cs


示例17: createNewCalendar

        private void createNewCalendar(CalendarService service)
        {
            CalendarEntry calendar = new CalendarEntry();
            calendar.Title.Text = textBox1.Text;//"Little League Schedule";
            calendar.Summary.Text = "This calendar contains the practice schedule and game times.";
            calendar.TimeZone = "America/Los_Angeles";
            calendar.Hidden = false;
            calendar.Color = "#2952A3";
            calendar.Location = new  Where("", "", "Oakland");

            Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/owncalendars/full");
            CalendarEntry createdCalendar = (CalendarEntry)service.Insert(postUri, calendar);
            refreshCalendar();
        }
开发者ID:creativepsyco,项目名称:SampleGData,代码行数:14,代码来源:Form1.cs


示例18: FullTextQuery

        /// <summary>
        /// Prints the titles of all events matching a full-text query.
        /// </summary>
        /// <param name="service">The authenticated CalendarService object.</param>
        /// <param name="queryString">The text for which to query.</param>
        static void FullTextQuery(CalendarService service, String queryString)
        {
            EventQuery myQuery = new EventQuery(feedUri);
            myQuery.Query = queryString;

            EventFeed myResultsFeed = service.Query(myQuery) as EventFeed;

            Console.WriteLine("Events matching \"{0}\":", queryString);
            Console.WriteLine();
            for (int i = 0; i < myResultsFeed.Entries.Count; i++)
            {
                Console.WriteLine(myResultsFeed.Entries[i].Title.Text);
            }
            Console.WriteLine();
        }
开发者ID:mintwans,项目名称:cpsc483,代码行数:20,代码来源:CalendarDemo.cs


示例19: PrintUserCalendars

        /// <summary>
        /// Prints a list of the user's calendars.
        /// </summary>
        /// <param name="service">The authenticated CalendarService object.</param>
        static void PrintUserCalendars(CalendarService service)
        {
            FeedQuery query = new FeedQuery();
            query.Uri = new Uri("http://www.google.com/calendar/feeds/default");

            // Tell the service to query:
            AtomFeed calFeed = service.Query(query);

            Console.WriteLine("Your calendars:");
            Console.WriteLine();
            for (int i = 0; i < calFeed.Entries.Count; i++)
            {
                Console.WriteLine(calFeed.Entries[i].Title.Text);
            }
            Console.WriteLine();
        }
开发者ID:mintwans,项目名称:cpsc483,代码行数:20,代码来源:CalendarDemo.cs


示例20: DateRangeQuery

        /// <summary>
        /// Prints the titles of all events in a specified date/time range.
        /// </summary>
        /// <param name="service">The authenticated CalendarService object.</param>
        /// <param name="startTime">Start time (inclusive) of events to print.</param>
        /// <param name="endTime">End time (exclusive) of events to print.</param>
        static void DateRangeQuery(CalendarService service, DateTime startTime, DateTime endTime)
        {
            EventQuery myQuery = new EventQuery(feedUri);
            myQuery.StartTime = startTime;
            myQuery.EndTime = endTime;

            EventFeed myResultsFeed = service.Query(myQuery) as EventFeed;

            Console.WriteLine("Matching events from {0} to {1}:", 
                              startTime.ToShortDateString(),
                              endTime.ToShortDateString());
            Console.WriteLine();
            for (int i = 0; i < myResultsFeed.Entries.Count; i++)
            {
                Console.WriteLine(myResultsFeed.Entries[i].Title.Text);
            }
            Console.WriteLine();
        }
开发者ID:mintwans,项目名称:cpsc483,代码行数:24,代码来源:CalendarDemo.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Client.AtomEntry类代码示例发布时间:2022-05-26
下一篇:
C# v201408.Statement类代码示例发布时间: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