/// <summary> /// Updates the all goals cached query results when a goal is added /// </summary> void AllGoalsOnGoalAdded(object sender, GoalAddedEventArgs e) { QueryCacheItem cachedQuery = _appInfo.GlobalQueryCache.GetCacheItem(Constants.AllGoalsCacheItem); if (cachedQuery != null) { // add the added item to the cached query results List <Data.Goal> allGoals = (List <Data.Goal>)cachedQuery.Value; Data.Goal addedGoal = _appInfo.GcContext.Goals.FirstOrDefault(g => g.GoalID == e.NewGoal.GoalId); if (addedGoal != null) { allGoals.Add(addedGoal); allGoals = SortList(allGoals); _appInfo.GlobalQueryCache.UpdateCacheItem(Constants.AllGoalsCacheItem, allGoals); } } }
void OnGoalAdded(object sender, GoalAddedEventArgs e) { RefreshGoalsAfterModification(); }