/// <summary> /// Constructor that is created from an RTM Task Series /// </summary> /// <param name="taskSeries"> /// A <see cref="TaskSeries"/> /// </param> public RtmTask(TaskSeries taskSeries, RtmBackend be, string listID) { this.taskSeries = taskSeries; this.rtmBackend = be; this.category = be.GetCategory(listID); if(CompletionDate == DateTime.MinValue ) state = TaskState.Active; else state = TaskState.Completed; notes = new List<INote>(); if (taskSeries.Notes.NoteCollection != null) { foreach(Note note in taskSeries.Notes.NoteCollection) { RtmNote rtmNote = new RtmNote(note); notes.Add(rtmNote); } } }
/// <summary> /// Constructor that is created from an RTM Task Series /// </summary> /// <param name="taskSeries"> /// A <see cref="TaskSeries"/> /// </param> public RtmTask(TaskSeries taskSeries, RtmBackend be, string listId) : base(taskSeries.Name, TaskNoteSupport.Multiple) { ListID = listId; this.taskSeries = taskSeries; rtmBackend = be; DueDate = taskSeries.Task.Due; CompletionDate = taskSeries.Task.Completed; var priority = TaskPriority.None; switch (taskSeries.Task.Priority) { case "N": priority = TaskPriority.None; break; case "1": priority = TaskPriority.High; break; case "2": priority = TaskPriority.Medium; break; case "3": priority = TaskPriority.Low; break; } Priority = priority; if (taskSeries.Task.Completed == DateTime.MinValue) State = TaskState.Active; else State = TaskState.Completed; if (taskSeries.Notes.NoteCollection != null) { foreach (var note in taskSeries.Notes.NoteCollection) { var rtmNote = new RtmNote (note); AddNote (rtmNote); } } }
void CacheNotes(TaskSeries rtmTaskSeries) { foreach (var rtmNote in rtmTaskSeries.Notes.NoteCollection) { var noteTuple = Notes.SingleOrDefault ( t => t.Item2.Id == rtmNote.ID); INoteCore note; if (noteTuple != null) note = noteTuple.Item2; else { note = backend.Factory.CreateNote (rtmNote.ID); Notes.Add (new Tuple<string, INoteCore> ( rtmTaskSeries.TaskID, note)); } note.Title = rtmNote.Title; note.Text = rtmNote.Text; } }