コード例 #1
0
        void UpdateFromGoogleCalendar()
        {
            LockStorageEvents = true;

            CalendarListEntry calendarEntry = this.cbCalendars.SelectedValue as CalendarListEntry;
            Calendar          calendar      = CalendarService.Calendars.Get(calendarEntry.Id).Execute();

            EventsResource.ListRequest listRequest = CalendarService.Events.List(calendarEntry.Id);
            listRequest.MaxResults = 10000;
            Events events = listRequest.Execute();

            Log("Loaded {0} events", events.Items.Count);
            this.schedulerStorage1.Appointments.Items.Clear();
            this.schedulerStorage1.BeginUpdate();
            try {
                CalendarImporter importer = new CalendarImporter(this.schedulerStorage1);
                importer.Import(events.Items);
            } finally {
                this.schedulerStorage1.EndUpdate();
            }
            SetStatus(String.Format("Loaded {0} events", events.Items.Count));
            UpdateFormState();

            LockStorageEvents = false;
        }
        void OnCbCalendarsSelectedValueChanged(object sender, EventArgs e)
        {
            CalendarListEntry calendarEntry = this.cbCalendars.SelectedValue as CalendarListEntry;
            Calendar          calendar      = CalendarService.Calendars.Get(calendarEntry.Id).Execute();
            Events            events        = CalendarService.Events.List(calendarEntry.Id).Execute();

            Log("Loaded {0} events", events.Items.Count);
            this.schedulerStorage1.Appointments.Items.Clear();
            this.schedulerStorage1.BeginUpdate();
            try {
                CalendarImporter importer = new CalendarImporter(this.schedulerStorage1);
                importer.Import(events.Items);
            } finally {
                this.schedulerStorage1.EndUpdate();
            }
            SetStatus(String.Format("Loaded {0} events", events.Items.Count));
            UpdateFormState();
        }