void OnTaskDeleted(object sender, TaskDeletedEventArgs e) { if (e.DeletedTask.IsActive) { RefreshTasksAfterModification(); } }
void OnTaskDeleted(object sender, TaskDeletedEventArgs e) { using (var taskVM = this.ChildTasks.FirstOrDefault(t => t.TaskId == e.DeletedTask.TaskId)) { this.ChildTasks.Remove(taskVM); } }
/// <summary> /// Updates the active tasks cached query results when a task is deleted /// </summary> void ActiveTasksOnTaskDeleted(object sender, TaskDeletedEventArgs e) { QueryCacheItem cachedQuery = _appInfo.GlobalQueryCache.GetCacheItem(Constants.ActiveTasksCacheItem); if (cachedQuery != null) { List <Data.Task> activeTasks = (List <Data.Task>)cachedQuery.Value; Data.Task deletedTask = activeTasks.FirstOrDefault(t => t.TaskID == e.DeletedTask.TaskId); if (deletedTask != null) { activeTasks.Remove(deletedTask); _appInfo.GlobalQueryCache.UpdateCacheItem(Constants.ActiveTasksCacheItem, activeTasks); } } }