示例#1
0
 void OnTaskAdded(object sender, TaskAddedEventArgs e)
 {
     if (e.NewTask.IsActive)
     {
         RefreshTasksAfterModification();
     }
 }
示例#2
0
        /// <summary>
        /// Updates the all tasks cached query results when a task is added
        /// </summary>
        void AllTasksOnTaskAdded(object sender, TaskAddedEventArgs e)
        {
            QueryCacheItem cachedQuery = _appInfo.GlobalQueryCache.GetCacheItem(Constants.AllTasksCacheItem);

            if (cachedQuery != null)
            {
                // add the added item to the cached query results
                List <Data.Task> allTasks  = (List <Data.Task>)cachedQuery.Value;
                Data.Task        addedTask = _appInfo.GcContext.Tasks.FirstOrDefault(t => t.TaskID == e.NewTask.TaskId);
                if (addedTask != null)
                {
                    allTasks.Add(addedTask);
                    allTasks = SortList(allTasks);
                    _appInfo.GlobalQueryCache.UpdateCacheItem(Constants.AllTasksCacheItem, allTasks);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Updates the active tasks cached query results when a task is added
        /// </summary>
        void ActiveTasksOnTaskAdded(object sender, TaskAddedEventArgs e)
        {
            QueryCacheItem cachedQuery = _appInfo.GlobalQueryCache.GetCacheItem(Constants.ActiveTasksCacheItem);

            if (cachedQuery != null)
            {
                // check if the added item satisfies the filter term and is active
                if (e.NewTask.IsActive)
                {
                    // add the added item to the cached query results
                    List <Data.Task> activeTasks = (List <Data.Task>)cachedQuery.Value;
                    Data.Task        addedTask   = _appInfo.GcContext.Tasks.FirstOrDefault(t => t.TaskID == e.NewTask.TaskId);
                    if (addedTask != null)
                    {
                        activeTasks.Add(addedTask);
                        activeTasks = SortList(activeTasks, new SortableProperty()
                        {
                            Description = "Sort Order", Name = "SortOrder"
                        });
                        _appInfo.GlobalQueryCache.UpdateCacheItem(Constants.ActiveTasksCacheItem, activeTasks);
                    }
                }
            }
        }
        void OnTaskAdded(object sender, TaskAddedEventArgs e)
        {
            var viewModel = new TaskViewModel(e.NewTask, _taskData);

            this.ChildTasks.Add(viewModel);
        }