예제 #1
0
        public void SaveTaskAction()
        {
            RestClient.UpdateTask(SelectedTask);

            for (int i = 0; i < Categories.Count(); i++)
            {
                if (Categories[i] == SelectedCategory)
                {
                    for (int j = 0; j < Categories[i].Tasks.Count(); j++)
                    {
                        if (Categories[i].Tasks[j].Id == SelectedTask.Id)
                        {
                            Categories[i].Tasks[j] = SelectedTask;
                        }
                        else
                        {
                            for (int k = 0; k < Categories[i].Tasks[j].SubTasks.Count(); k++)
                            {
                                if (Categories[i].Tasks[j].SubTasks[k].Id == SelectedTask.Id)
                                {
                                    Categories[i].Tasks[j].SubTasks[k] = SelectedTask;
                                }
                            }
                        }
                    }
                }
            }

            SelectedCategory.NotifyProperty();
        }
예제 #2
0
        public void ChangeTaskState(int taskId, int newState)
        {
            var task         = AllTasks.Where(t => t.Id == taskId).First();
            var selectedTask = SelectedCategory.Tasks.Where(t => t.Id == taskId).First();

            task.State         = newState;
            selectedTask.State = newState;
            SelectedCategory.NotifyProperty();
            RestClient.UpdateTask(task);
        }
예제 #3
0
        public void AddSubTaskAction(int parentId)
        {
            int id      = AllTasks.Last().Id + 1;
            var newTask = new TaskDto {
                Id = id, Name = "New SubTask", Description = "", State = 3, DeadlineDate = DateTime.Now, ScheduledDate = DateTime.Now, ParentId = SelectedCategory.Id, ParentTaskId = parentId, IsSubTask = true
            };

            //TODO:restclient
            SelectedCategory.Tasks.Where(t => t.Id == parentId).First().SubTasks.Add(newTask);
            SelectedCategory.NotifyProperty();
            AllTasks.Add(newTask);
        }
예제 #4
0
        public void AddTaskAction()
        {
            int id      = AllTasks.Last().Id + 1;
            var newTask = new TaskDto {
                Id = id, Name = "New Task", Description = "", State = 3, DeadlineDate = DateTime.Now, ScheduledDate = DateTime.Now, ParentId = SelectedCategory.Id
            };

            RestClient.AddTask(newTask);
            AllTasks.Add(newTask);
            SelectedCategory.Tasks.Add(newTask);
            SelectedCategory.NotifyProperty();
        }
예제 #5
0
        public void DeleteTaskAction()
        {
            RestClient.DeleteTask(SelectedTask);
            IsPanelActive = false;
            AllTasks.Remove(SelectedTask);

            for (int i = 0; i < Categories.Count(); i++)
            {
                if (Categories[i] == SelectedCategory)
                {
                    for (int j = 0; j < Categories[i].Tasks.Count(); j++)
                    {
                        if (Categories[i].Tasks[j].Id == SelectedTask.Id)
                        {
                            Categories[i].Tasks.RemoveAt(j);
                        }
                    }
                }
            }

            SelectedCategory.NotifyProperty();
        }