public override FlowDocument Build()
        {
            FlowDocument flowDocument = new FlowDocument();

            flowDocument.Blocks.Add(FlowDocumentHelper.BuildTitle(Title));

            Paragraph criteriaPara = new Paragraph();
            Span      titleSpan    = new Span();

            titleSpan.Inlines.Add("Title: ");
            titleSpan.FontWeight = FontWeights.Bold;
            Span titleValueSpan = new Span();

            titleValueSpan.Inlines.Add(SelectedProject.Title);
            Span dateTitleSpan = new Span();

            dateTitleSpan.Inlines.Add("     Date Created: ");
            dateTitleSpan.FontWeight = FontWeights.Bold;
            Span dateValueSpan = new Span();

            dateValueSpan.Inlines.Add(SelectedProject.CreatedDate.ToShortDateString());
            criteriaPara.Inlines.Add(titleSpan);
            criteriaPara.Inlines.Add(titleValueSpan);
            criteriaPara.Inlines.Add(dateTitleSpan);
            criteriaPara.Inlines.Add(dateValueSpan);
            flowDocument.Blocks.Add(criteriaPara);

            Dictionary <string, Tuple <string, string> > columnDefinitions = new Dictionary <string, Tuple <string, string> >()
            {
                { "Title", new Tuple <string, string>("Task Title", null) },
                { "StatusDescription", new Tuple <string, string>("Status", null) },
                { "PriorityDescription", new Tuple <string, string>("Priority", null) },
                { "CreatedDate", new Tuple <string, string>("Date Created", null) },
                { "CompletedDate", new Tuple <string, string>("Date Completed", null) }
            };

            using (TaskData tData = new TaskData())
            {
                using (ProjectData pData = new ProjectData())
                {
                    List <Task>          childTasks = pData.GetChildTasks(SelectedProject.ProjectId);
                    List <TaskViewModel> rowData    = new List <TaskViewModel>();
                    foreach (Task task in childTasks)
                    {
                        rowData.Add(new TaskViewModel(task, tData));
                    }

                    flowDocument.Blocks.Add(FlowDocumentHelper.BuildTable <TaskViewModel>(columnDefinitions, rowData));

                    foreach (TaskViewModel taskVm in rowData)
                    {
                        taskVm.Dispose();
                    }
                }
            }

            return(flowDocument);
        }
        public ProjectTreeNodeViewModel(Project project, ProjectData projectData, ITreeNodeContainerViewModel parent)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            _project = project;

            List <Task> childTasks = projectData.GetChildTasks(project.ProjectId);

            foreach (Task childTask in childTasks)
            {
                if (!childTask.IsActive)
                {
                    _childNodes.Add(new TaskTreeNodeViewModel(childTask, this));
                }
            }

            _parent = parent;
        }
        public ProjectViewModel(Project project, ProjectData projectData, TaskData taskData)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            if (projectData == null)
            {
                throw new ArgumentNullException("projectData");
            }

            _project           = project;
            _projectData       = projectData;
            _taskData          = taskData;
            _statusOptions     = AppInfo.Instance.StatusList;
            _selectedStatus    = _statusOptions.FirstOrDefault(s => s.StatusID == this.StatusId);
            _isSaved           = true;
            _goalTitle         = _project.ParentGoal == null ? null : _project.ParentGoal.Title;
            _statusDescription = _statusOptions.FirstOrDefault(s => s.StatusID == this.StatusId).Description;
            List <Task> childTasks = _projectData.GetChildTasks(_project.ProjectId);

            foreach (Task childTask in childTasks)
            {
                _childTaskVMs.Add(new TaskViewModel(childTask, taskData));
            }

            _originalStatusId = StatusId;

            // Subscribe for notifications of when a new task is saved.
            _taskData.TaskAdded   += this.OnTaskAdded;
            _taskData.TaskUpdated += this.OnTaskUpdated;
            _taskData.TaskDeleted += this.OnTaskDeleted;

            base.DisplayName  = Properties.Resources.Edit_Project_DisplayName;
            base.DisplayImage = "pack://application:,,,/TaskConqueror;Component/Assets/Images/project.png";
        }