コード例 #1
0
 /// <summary>
 /// Reset calendar button, remove all events from Google Calendar
 /// </summary>
 /// <param name="sender">sender object</param>
 /// <param name="e">event arguments</param>
 private void BtnResetCalendar_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtCalendarOwner.Text.Trim()) || string.IsNullOrEmpty((cbCalendarToUpdate.SelectedItem as CalendarListItem).Value.ToString()))
     {
         MessageBox.Show("Cannot Reset Calendar as Owner and Calendar have not been selected.");
     }
     else
     {
         DialogResult answer = MessageBox.Show("Are you sure you wish to clear all events from the Calendar?", "caption", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);
         if (answer == DialogResult.Yes)
         {
             GCalHelper.ClearAllEventsFromCalendar(txtCalendarOwner.Text.Trim(), (cbCalendarToUpdate.SelectedItem as CalendarListItem).Value.ToString(), null);
             GCalHelper.googleCalEvents = null;
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Update the calendar list dropdown from Google Calendar API
        /// </summary>
        private void UpdateCalendarList()
        {
            if (txtCalendarOwner.Text.Trim().Length > 0)
            {
                CalendarListItem[] calendars = GCalHelper.GetCalendars(txtCalendarOwner.Text.Trim());

                if (calendars != null && calendars.Length > 0)
                {
                    cbCalendarToUpdate.Items.Clear();

                    for (int i = 0; i < calendars.Length; i++)
                    {
                        cbCalendarToUpdate.Items.Add(calendars[i]);
                    }
                }
            }
        }