Пример #1
0
        /// <summary>
        /// Add new event in google calendar
        /// </summary>
        /// <param name="event1">added event</param>
        /// <returns>ID of event in google calendar</returns>
        public string CreateEvent(TCGSync.Entities.Event event1)
        {
            var googleEvent = event1.ToGoogleEvent();
            var request     = GService.Events.Insert(googleEvent, user.googleCalendarId);

            Google.Apis.Calendar.v3.Data.Event response = request.Execute();
            return(response.Id);
        }
Пример #2
0
 /// <summary>
 /// Extension method that converse Event to GoogleEvent
 /// </summary>
 /// <param name="event1"></param>
 /// <returns></returns>
 internal static Google.Apis.Calendar.v3.Data.Event ToGoogleEvent(this TCGSync.Entities.Event event1)
 => new Google.Apis.Calendar.v3.Data.Event
 {
     Start = new EventDateTime()
     {
         DateTime = event1.Start
     },
     End = new EventDateTime()
     {
         DateTime = event1.End
     },
     Summary = event1.Description
 };
Пример #3
0
 /// <summary>
 /// Edit Event with the same ID
 /// </summary>
 /// <param name="event1">Event with changes</param>
 public void EditEvent(TCGSync.Entities.Event event1)
 {
     EventsResource.GetRequest          getRequest  = new EventsResource.GetRequest(GService, user.googleCalendarId, event1.GoogleId);
     Google.Apis.Calendar.v3.Data.Event googleEvent = getRequest.Execute();
     googleEvent.Start = new EventDateTime()
     {
         DateTime = event1.Start
     };
     googleEvent.End = new EventDateTime()
     {
         DateTime = event1.End
     };
     googleEvent.Summary = event1.Description;
     EventsResource.UpdateRequest updateRequest = new EventsResource.UpdateRequest(GService, googleEvent, user.googleCalendarId, event1.GoogleId);
     updateRequest.Execute();
 }