/// <summary> /// Update the model to match what is in RTM /// FIXME: This is a lame implementation and needs to be optimized /// </summary> private void UpdateCategories(Lists lists) { Logger.Debug("RtmBackend.UpdateCategories was called"); try { foreach (List list in lists.listCollection) { RtmCategory rtmCategory = new RtmCategory(list); lock (catLock) { Gtk.TreeIter iter; Gtk.Application.Invoke(delegate { if (categories.ContainsKey(rtmCategory.ID)) { iter = categories[rtmCategory.ID].Iter; categoryListStore.SetValue(iter, 0, rtmCategory); } else { iter = categoryListStore.Append(); categoryListStore.SetValue(iter, 0, rtmCategory); rtmCategory.Iter = iter; categories.Add(rtmCategory.ID, rtmCategory); } }); } } } catch (Exception e) { Logger.Debug("Exception in fetch " + e.Message); } Logger.Debug("RtmBackend.UpdateCategories is done"); }
/// <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) { 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> /// Update the model to match what is in RTM /// FIXME: This is a lame implementation and needs to be optimized /// </summary> void UpdateCategories(Lists lists) { Debug.WriteLine ("RtmBackend.UpdateCategories was called"); try { foreach (var list in lists.listCollection) { lock (catLock) { Application.Instance.Dispatcher.Invoke (delegate { RtmCategory rtmCategory; if (!Categories.Any (c => ((RtmCategory)c).ID == list.ID)) { rtmCategory = new RtmCategory (list); Categories.Add (rtmCategory); } }); } } } catch (Exception e) { Debug.WriteLine ("Exception in fetch " + e.Message); } Debug.WriteLine ("RtmBackend.UpdateCategories is done"); }
/// <summary> /// Update the model to match what is in RTM /// FIXME: This is a lame implementation and needs to be optimized /// </summary> private void UpdateCategories(Lists lists) { Logger.Debug("RtmBackend.UpdateCategories was called"); try { foreach(List list in lists.listCollection) { RtmCategory rtmCategory = new RtmCategory(list); lock(catLock) { Gtk.TreeIter iter; Gtk.Application.Invoke ( delegate { if(categories.ContainsKey(rtmCategory.ID)) { iter = categories[rtmCategory.ID].Iter; categoryListStore.SetValue (iter, 0, rtmCategory); } else { iter = categoryListStore.Append(); categoryListStore.SetValue (iter, 0, rtmCategory); rtmCategory.Iter = iter; categories.Add(rtmCategory.ID, rtmCategory); } }); } } } catch (Exception e) { Logger.Debug("Exception in fetch " + e.Message); } Logger.Debug("RtmBackend.UpdateCategories is done"); }