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; }
protected string FormatTaskAttributes(TDLTask task, bool root) { StringBuilder taskAttrib = new StringBuilder(); taskAttrib.Append("**`" + task.GetTitle() + "`**"); taskAttrib.Append(" ").AppendLine().Append("Priority: " + task.GetPriority()); taskAttrib.Append(" ").AppendLine().Append("Allocated to: " + task.GetAllocatedTo(0)); return taskAttrib.AppendLine().ToString(); }
public bool PrepareNewTask(ref TDLTask task) { return false; }
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; }
public bool PrepareNewTask(ref TDLTask task) { // Set the start/due dates to match the current selection if (m_DayView.SelectionStart < m_DayView.SelectionEnd) { task.SetStartDate(m_DayView.SelectionStart); task.SetDueDate(m_DayView.SelectionEnd); } 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; }