Exemplo n.º 1
0
 /// <summary>
 /// Добавление новой задачи
 /// </summary>
 /// <param name="newPlan"></param>
 public void ChangeTasks(Plan newPlan)
 {
     if (newPlan.Children.Count == 0)
     {
         SearchTask(newPlan.ParentId, true);
         PlannerTask newTask =
             new PlannerTask(newPlan.Id,
                             newPlan.Title,
                             newPlan.Description);
         Queue.Add(newTask);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Breaks the plan down into small subtasks
 /// </summary>
 /// <param name="tree"></param>
 private void Filter_tree(ObservableCollection <Plan> tree)
 {
     foreach (Plan item in tree)
     {
         if (item.Children.Count == 0)
         {
             PlannerTask exe = new PlannerTask(item.Id, item.Title, item.Description);
             Queue.Add(exe);
         }
         else
         {
             Filter_tree(item.Children);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Поиск задачи по идентификатору, и удаление из очереди
        /// </summary>
        /// <param name="_id"></param>
        /// <param name="_delete">Удалять или нет</param>
        /// <returns></returns>
        public PlannerTask SearchTask(Guid _id, bool _delete = false)
        {
            PlannerTask output = null;

            foreach (PlannerTask task in this.Queue)
            {
                if (task.Id == _id)
                {
                    output = task;
                }
            }

            if (_delete)
            {
                if (output != null)
                {
                    Queue.Remove(output);
                    Waiting.Remove(output);
                    InProgress.Remove(output);
                    Perfomed.Remove(output);
                }
            }
            return(output);
        }