private async Task CleanGoogleCalendarInternal() { if (SelectedProfile.GoogleSettings.GoogleAccount == null || SelectedProfile.GoogleSettings.GoogleCalendar == null) { MessageService.ShowMessageAsync("Please select a Google calendar to wipe"); return; } var task = await MessageService.ShowConfirmMessage( "Are you sure you want to reset events from 10 year past and 10 year future?"); if (task != MessageDialogResult.Affirmative) { return; } var calendarSpecificData = new Dictionary <string, object> { { "TaskListId", SelectedProfile.GoogleSettings.GoogleCalendar.Id }, { "AccountName", SelectedProfile.GoogleSettings.GoogleAccount.Name } }; var result = await GoogleTaskService.ClearCalendar(calendarSpecificData); if (!result) { MessageService.ShowMessageAsync("Reset calendar failed."); } }
private async Task GetGoogleTaskListsInternal() { try { if (SelectedProfile.GoogleSettings.GoogleAccount == null || SelectedProfile.GoogleSettings.GoogleAccount.Name == null) { return; } var calendars = await GoogleTaskService.GetAvailableTaskList( SelectedProfile.GoogleSettings.GoogleAccount.Name); if (calendars.Any()) { if (SelectedProfile.GoogleSettings.GoogleCalendar != null) { SelectedProfile.GoogleSettings.GoogleCalendar = calendars.FirstOrDefault(t => t.Id.Equals(SelectedProfile.GoogleSettings.GoogleCalendar.Id)); } if (SelectedProfile.GoogleSettings.GoogleCalendar == null) { SelectedProfile.GoogleSettings.GoogleCalendar = calendars.First(); } } SelectedProfile.GoogleSettings.GoogleCalendars = calendars; } catch (Exception exception) { MessageService.ShowMessageAsync("Unable to get Google calendars."); Logger.Error(exception); } }