private async Task <List <Models.Common.EventBase> > GetGoogleEvents(DateTime datetime, Models.Auth.UserBase user) { var events = new List <Models.Common.EventBase>(); var googleClient = new GoogleClient(user); if (AppGlobalVariables.Colors == null) { AppGlobalVariables.Colors = await googleClient.GetColors(); } if (user.Calendars.Count == 0) { var calendars = await googleClient.GetCalendarList(); var calCache = new CalendarCacheHelper(); await calCache.Init(); foreach (var calendar in calendars.items) { calCache.CheckIfEnabled(calendar); } user.Calendars.AddRange(calendars.items); } if (user.Calendars.Count > 0) { foreach (var item in user.Calendars) { if (item.IsEnabled) { try { var tmp = await googleClient.GetEventList(item, datetime); if (tmp != null) { events.AddRange(tmp.items); } } catch (Exception ex) { Debugger.WriteErrorLog("Error occured while retrieving Google Events. User="******". Calendar=" + item.Name + ".", ex); await new MessageDialog(ex.Message + ". User="******". Calendar=" + item.Name + ". Please consider excluding this calendar.", "Error occured while retrieving Google Events.").ShowAsync(); } } } } return(events); }