protected bool ExportTask(TDLTask task, BulletedMarkdownContainer mdParent, bool root) { // add ourselves mdParent.Append(new RawMarkdown(FormatTaskAttributes(task, root))); // then our subtasks in a container BulletedMarkdownContainer mdSubtasks = new BulletedMarkdownContainer(); TDLTask subtask = task.GetFirstSubtask(); if (subtask.IsValid()) { while (subtask.IsValid()) { ExportTask(subtask, mdSubtasks, false); subtask = subtask.GetNextTask(); } mdParent.Append(mdSubtasks); } return true; }
private bool ProcessTaskUpdate(TDLTask task, TDLUIExtension.UpdateType type, System.Collections.Generic.HashSet<TDLUIExtension.TaskAttribute> attribs) { if (!task.IsValid()) return false; CalendarItem item; if (m_Items.TryGetValue(task.GetID(), out item)) { if (attribs.Contains(TDLUIExtension.TaskAttribute.Title)) item.Title = task.GetTitle(); if (attribs.Contains(TDLUIExtension.TaskAttribute.DoneDate)) item.EndDate = item.OrgEndDate = task.GetDoneDate(); if (attribs.Contains(TDLUIExtension.TaskAttribute.DueDate)) item.EndDate = item.OrgEndDate = task.GetDueDate(); if (attribs.Contains(TDLUIExtension.TaskAttribute.StartDate)) item.StartDate = item.OrgStartDate = task.GetStartDate(); if (attribs.Contains(TDLUIExtension.TaskAttribute.AllocTo)) item.AllocTo = String.Join(", ", task.GetAllocatedTo()); item.TaskTextColor = task.GetTextDrawingColor(); } else { item = new CalendarItem(); item.Title = task.GetTitle(); item.EndDate = item.OrgEndDate = task.GetDueDate(); item.StartDate = item.OrgStartDate = task.GetStartDate(); item.AllocTo = String.Join(", ", task.GetAllocatedTo()); item.Id = task.GetID(); item.IsParent = task.IsParent(); item.TaskTextColor = task.GetTextDrawingColor(); item.DrawBorder = true; } if (item.EndDate > item.StartDate) m_Items[task.GetID()] = item; // Process children TDLTask subtask = task.GetFirstSubtask(); while (subtask.IsValid() && ProcessTaskUpdate(subtask, type, attribs)) subtask = subtask.GetNextTask(); return true; }
private bool ProcessTaskUpdate(TDLTask task, TDLUIExtension.UpdateType type, TDLUIExtension.TaskAttribute attrib) { if (!task.IsValid()) return false; CalendarItem item; if (m_Items.TryGetValue(task.GetID(), out item)) { switch (attrib) { case TDLUIExtension.TaskAttribute.Title: item.Title = task.GetTitle(); break; case TDLUIExtension.TaskAttribute.DoneDate: item.End = ToDateTime(task.GetDoneDate()); break; case TDLUIExtension.TaskAttribute.DueDate: item.End = ToDateTime(task.GetDueDate()); break; case TDLUIExtension.TaskAttribute.StartDate: item.Start = ToDateTime(task.GetStartDate()); break; } } else { item = new CalendarItem(); item.Title = task.GetTitle(); item.End = ToDateTime(task.GetDueDate()); item.Start = ToDateTime(task.GetStartDate()); item.TaskID = task.GetID(); item.IsParent = task.GetFirstSubtask().IsValid(); } m_Items[task.GetID()] = item; // Process children TDLTask subtask = task.GetFirstSubtask(); while (subtask.IsValid() && ProcessTaskUpdate(subtask, type, attrib)) subtask = subtask.GetNextTask(); return true; }