private static async Task <AgendaViewItemsGroup> CreateLoadStandalone(Guid localAccountId, ViewItemSemester semester, DateTime today) { var answer = new AgendaViewItemsGroup(localAccountId, semester, today, trackChanges: false); await Task.Run(answer.LoadBlocking); return(answer); }
///// <summary> ///// Eliminates any items that have become expired (like events that have expired) ///// </summary> //private void Refilter() //{ // // Beware - can't do this from a background thread or else it would crash things // // Hence we actually need to only do this from a UI thread and also ensure to put it in the // // lock so that background threads using cached item don't get messed up // Guid[] classIdentifiers = Classes.Select(i => i.Identifier).ToArray(); // DateTime todayAsUtc = DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc); // this.Items.RemoveWhere(i => !ShouldIncludeItem(i.DataItem as DataItemMegaItem, classIdentifiers, todayAsUtc); //} private static async Task <AgendaViewItemsGroup> CreateLoadTask(Guid localAccountId, ViewItemSemester semester, DateTime today) { var answer = new AgendaViewItemsGroup(localAccountId, semester, today, trackChanges: true); SemesterItemsViewGroup cached = SemesterItemsViewGroup.GetCached(semester.Identifier); if (cached != null) { // Can perform this without locks since we already know we're on UI thread right now, // and any modifications to the SemesterItems list would need to be on UI thread to occur await cached.LoadingTask; answer.PrepareFromCached(cached); } else { await Task.Run(answer.LoadBlocking); } return(answer); }