Ejemplo n.º 1
0
        /// <summary>
        /// Saves the new task to the collection.
        /// </summary>
        private async Task AddTask()
        {
            // Create new object
            TaskViewModel task = new TaskViewModel(_dialogService)
            {
                Name        = NewTask.Name,
                Description = "",
                Order       = Tasks.Count + 1,
                Subtasks    = new ObservableCollection <SubtaskViewModel>()
            };

            // Add item to database
            await _repo.AddTask(task, this.Id).ContinueWith(async p =>
            {
                task.Id = await p;
            });

            // Add item to collection
            Tasks.Add(task);

            // Set as the selected task
            SelectedTask = task;

            // Clear new task
            NewTask = new TaskViewModel(_dialogService);

            // Update UI
            UpdateProgress();
        }