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


C# Calendar.CalendarService类代码示例

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


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


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