Exemplo n.º 1
0
        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();
        }
        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;
        }