Beispiel #1
0
        /// <summary>
        /// Adds a new subtask to the collection.
        /// </summary>
        private async Task AddSubtask()
        {
            // New Subtask
            SubtaskViewModel subtask = new SubtaskViewModel()
            {
                Name = this.NewSubtaskName
            };

            // Subscribe to property changed event for new subtask
            subtask.PropertyChanged += SubtaskViewModel_PropertyChanged;

            // Add subtask to database
            await _repo.AddSubtask(subtask, this.Id).ContinueWith(async p =>
            {
                subtask.Id         = await p;
                subtask.TodoTaskId = this.Id;
            });

            // Add item to view
            Subtasks.Add(subtask);

            subtask.IsCompleted = false;

            // Reset new subtask
            NewSubtaskName  = null;
            NewSubtaskAdded = true;
            NewSubtaskAdded = false;
        }
        public void AddSubtask(TaskItem item)
        {
            if (Subtasks is null)
            {
                Subtasks = new List <TaskItem>();
            }

            Subtasks.Add(item);
        }
Beispiel #3
0
        private void InitialiseProjectSubtasks(ICollection <ProjectSubtask> subtasks)
        {
            foreach (var wrapper in Subtasks)
            {
                wrapper.PropertyChanged -= Wrapper_PropertyChanged;
            }

            Subtasks.Clear();
            foreach (var projectSubtask in subtasks)
            {
                var wrapper = new SubTaskWrapper(projectSubtask);
                Subtasks.Add(wrapper);
                wrapper.PropertyChanged += Wrapper_PropertyChanged;
            }
        }