public RtmTask UpdateTaskFromResult(List list) { TaskSeries ts = list.TaskSeriesCollection[0]; if (ts != null) { RtmTask rtmTask = new RtmTask(ts, this, list.ID); lock (taskLock) { Gtk.Application.Invoke(delegate { if (taskIters.ContainsKey(rtmTask.ID)) { Gtk.TreeIter iter = taskIters[rtmTask.ID]; taskStore.SetValue(iter, 0, rtmTask); } else { Gtk.TreeIter iter = taskStore.AppendNode(); taskIters.Add(rtmTask.ID, iter); taskStore.SetValue(iter, 0, rtmTask); } }); } return(rtmTask); } return(null); }
public void DeleteTask(ITask task) { RtmTask rtmTask = task as RtmTask; if (rtm != null) { try { rtm.TasksDelete(timeline, rtmTask.ListID, rtmTask.SeriesTaskID, rtmTask.TaskTaskID); lock (taskLock) { Gtk.Application.Invoke(delegate { if (taskIters.ContainsKey(rtmTask.ID)) { Gtk.TreeIter iter = taskIters[rtmTask.ID]; taskStore.Remove(ref iter); taskIters.Remove(rtmTask.ID); } }); } } catch (Exception e) { Logger.Debug("Unable to delete task: " + task.Name); Logger.Debug(e.ToString()); } } else { throw new Exception("Unable to communicate with Remember The Milk"); } }
/// <summary> /// Update the model to match what is in RTM /// FIXME: This is a lame implementation and needs to be optimized /// </summary> private void UpdateTasks(Lists lists) { Logger.Debug("RtmBackend.UpdateTasks was called"); try { foreach (List list in lists.listCollection) { Tasks tasks = null; try { tasks = rtm.TasksGetList(list.ID); } catch (Exception tglex) { Logger.Debug("Exception calling TasksGetList(list.ListID) " + tglex.Message); } if (tasks != null) { foreach (List tList in tasks.ListCollection) { if (tList.TaskSeriesCollection == null) { continue; } foreach (TaskSeries ts in tList.TaskSeriesCollection) { RtmTask rtmTask = new RtmTask(ts, this, list.ID); lock (taskLock) { Gtk.TreeIter iter; Gtk.Application.Invoke(delegate { if (taskIters.ContainsKey(rtmTask.ID)) { iter = taskIters[rtmTask.ID]; } else { iter = taskStore.AppendNode(); taskIters.Add(rtmTask.ID, iter); } taskStore.SetValue(iter, 0, rtmTask); }); } } } } } } catch (Exception e) { Logger.Debug("Exception in fetch " + e.Message); Logger.Debug(e.ToString()); } Logger.Debug("RtmBackend.UpdateTasks is done"); }
public void UpdateTaskPriority(RtmTask task) { if (rtm != null) { try { List list = rtm.TasksSetPriority(timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID, task.PriorityString); UpdateTaskFromResult(list); } catch (Exception e) { Logger.Debug("Unable to set priority on task: " + task.Name); Logger.Debug(e.ToString()); } } }
public void MoveTaskCategory(RtmTask task, string id) { if (rtm != null) { try { List list = rtm.TasksMoveTo(timeline, task.ListID, id, task.SeriesTaskID, task.TaskTaskID); UpdateTaskFromResult(list); } catch (Exception e) { Logger.Debug("Unable to set Task as completed: " + task.Name); Logger.Debug(e.ToString()); } } }
public void UpdateTask(RtmTask task) { lock (taskLock) { Gtk.TreeIter iter; Gtk.Application.Invoke(delegate { if (taskIters.ContainsKey(task.ID)) { iter = taskIters[task.ID]; taskStore.SetValue(iter, 0, task); } }); } }
public void DeleteNote(RtmTask rtmTask, RtmNote note) { if (rtm != null) { try { rtm.NotesDelete(timeline, note.ID); } catch (Exception e) { Logger.Debug("RtmBackend.DeleteNote: Unable to delete note"); Logger.Debug(e.ToString()); } } else { throw new Exception("Unable to communicate with Remember The Milk"); } }
public void SaveNote(RtmTask rtmTask, RtmNote note) { if (rtm != null) { try { rtm.NotesEdit(timeline, note.ID, String.Empty, note.Text); } catch (Exception e) { Logger.Debug("RtmBackend.SaveNote: Unable to save note"); Logger.Debug(e.ToString()); } } else { throw new Exception("Unable to communicate with Remember The Milk"); } }
public void UpdateTaskActive(RtmTask task) { if (task.State == TaskState.Completed) { if (rtm != null) { try { List list = rtm.TasksUncomplete(timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID); UpdateTaskFromResult(list); } catch (Exception e) { Logger.Debug("Unable to set Task as completed: " + task.Name); Logger.Debug(e.ToString()); } } } else { UpdateTask(task); } }
public ITask CreateTask(string taskName, ICategory category) { string categoryID; RtmTask rtmTask = null; if (category is Tasque.AllCategory) { categoryID = null; } else { categoryID = (category as RtmCategory).ID; } if (rtm != null) { try { List list; if (categoryID == null) { list = rtm.TasksAdd(timeline, taskName); } else { list = rtm.TasksAdd(timeline, taskName, categoryID); } rtmTask = UpdateTaskFromResult(list); } catch (Exception e) { Logger.Debug("Unable to set create task: " + taskName); Logger.Debug(e.ToString()); } } else { throw new Exception("Unable to communicate with Remember The Milk"); } return(rtmTask); }
public void UpdateTaskDueDate(RtmTask task) { if (rtm != null) { try { List list; if (task.DueDate == DateTime.MinValue) { list = rtm.TasksSetDueDate(timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID); } else { list = rtm.TasksSetDueDate(timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID, task.DueDateString); } UpdateTaskFromResult(list); } catch (Exception e) { Logger.Debug("Unable to set due date on task: " + task.Name); Logger.Debug(e.ToString()); } } }
public RtmNote CreateNote(RtmTask rtmTask, string text) { RtmNet.Note note = null; RtmNote rtmNote = null; if (rtm != null) { try { note = rtm.NotesAdd(timeline, rtmTask.ListID, rtmTask.SeriesTaskID, rtmTask.TaskTaskID, String.Empty, text); rtmNote = new RtmNote(note); } catch (Exception e) { Logger.Debug("RtmBackend.CreateNote: Unable to create a new note"); Logger.Debug(e.ToString()); } } else { throw new Exception("Unable to communicate with Remember The Milk"); } return(rtmNote); }
public void UpdateTaskDueDate(RtmTask task) { if(rtm != null) { try { List list; if(task.DueDate == DateTime.MinValue) list = rtm.TasksSetDueDate(timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID); else list = rtm.TasksSetDueDate(timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID, task.DueDateString); UpdateTaskFromResult(list); } catch(Exception e) { Logger.Debug("Unable to set due date on task: " + task.Name); Logger.Debug(e.ToString()); } } }
public void UpdateTaskCompleteDate(RtmTask task) { UpdateTask(task); }
public void UpdateTaskPriority(RtmTask task) { if(rtm != null) { try { List list = rtm.TasksSetPriority(timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID, task.PriorityString); UpdateTaskFromResult(list); } catch(Exception e) { Logger.Debug("Unable to set priority on task: " + task.Name); Logger.Debug(e.ToString()); } } }
public void UpdateTaskCompleteDate(RtmTask task) { UpdateTask(task); }
public void UpdateTaskDeleted(RtmTask task) { UpdateTask(task); }
public void UpdateTaskPriority(RtmTask task) { if (rtm != null) { try { rtm.TasksSetPriority (timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID, task.PriorityString); } catch (Exception e) { Debug.WriteLine ("Unable to set priority on task: " + task.Name); Debug.WriteLine (e.ToString ()); } } }
public void UpdateTaskDueDate(RtmTask task) { if (rtm != null) { try { if (task.DueDate == DateTime.MinValue) rtm.TasksSetDueDate (timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID); else rtm.TasksSetDueDate (timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID, task.DueDateString); } catch (Exception e) { Debug.WriteLine ("Unable to set due date on task: " + task.Name); Debug.WriteLine (e.ToString ()); } } }
public void UpdateTaskDeleted(RtmTask task) { if (rtm != null) { try { rtm.TasksDelete (timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID); } catch (Exception e) { Debug.WriteLine ("Unable to set Task as deleted: " + task.Name); Debug.WriteLine (e.ToString ()); } } }
public void MoveTaskCategory(RtmTask task, string id) { if (rtm != null) { try { rtm.TasksMoveTo (timeline, task.ListID, id, task.SeriesTaskID, task.TaskTaskID); } catch (Exception e) { Debug.WriteLine ("Unable to set Task as completed: " + task.Name); Debug.WriteLine (e.ToString ()); } } }
public void DeleteNote(RtmTask rtmTask, RtmNote note) { if (rtm != null) { try { rtm.NotesDelete (timeline, note.ID); } catch (Exception e) { Debug.WriteLine ("RtmBackend.DeleteNote: Unable to delete note"); Debug.WriteLine (e.ToString ()); } } else throw new Exception ("Unable to communicate with Remember The Milk"); }
/// <summary> /// Update the model to match what is in RTM /// FIXME: This is a lame implementation and needs to be optimized /// </summary> private void UpdateTasks(Lists lists) { Logger.Debug("RtmBackend.UpdateTasks was called"); try { foreach(List list in lists.listCollection) { Tasks tasks = null; try { tasks = rtm.TasksGetList(list.ID); } catch (Exception tglex) { Logger.Debug("Exception calling TasksGetList(list.ListID) " + tglex.Message); } if(tasks != null) { foreach(List tList in tasks.ListCollection) { if (tList.TaskSeriesCollection == null) continue; foreach(TaskSeries ts in tList.TaskSeriesCollection) { RtmTask rtmTask = new RtmTask(ts, this, list.ID); lock(taskLock) { Gtk.TreeIter iter; Gtk.Application.Invoke ( delegate { if(taskIters.ContainsKey(rtmTask.ID)) { iter = taskIters[rtmTask.ID]; } else { iter = taskStore.AppendNode (); taskIters.Add(rtmTask.ID, iter); } taskStore.SetValue (iter, 0, rtmTask); }); } } } } } } catch (Exception e) { Logger.Debug("Exception in fetch " + e.Message); Logger.Debug(e.ToString()); } Logger.Debug("RtmBackend.UpdateTasks is done"); }
public void UpdateTaskInactive(RtmTask task) { UpdateTask(task); }
public void UpdateTask(RtmTask task) { lock(taskLock) { Gtk.TreeIter iter; Gtk.Application.Invoke ( delegate { if(taskIters.ContainsKey(task.ID)) { iter = taskIters[task.ID]; taskStore.SetValue (iter, 0, task); } }); } }
public void UpdateTaskDeleted(RtmTask task) { UpdateTask(task); }
public RtmNote CreateNote(RtmTask rtmTask, string text) { Note note = null; RtmNote rtmNote = null; if (rtm != null) { try { note = rtm.NotesAdd (timeline, rtmTask.ListID, rtmTask.SeriesTaskID, rtmTask.TaskTaskID, string.Empty, text); rtmNote = new RtmNote (note); rtmNote.OnTextChangedAction = delegate { SaveNote (rtmTask, rtmNote); }; } catch (Exception e) { Debug.WriteLine ("RtmBackend.CreateNote: Unable to create a new note"); Debug.WriteLine (e.ToString ()); } } else throw new Exception ("Unable to communicate with Remember The Milk"); return rtmNote; }
public void UpdateTaskCompleted(RtmTask task) { if(rtm != null) { try { List list = rtm.TasksComplete(timeline, task.ListID, task.SeriesTaskID, task.TaskTaskID); UpdateTaskFromResult(list); } catch(Exception e) { Logger.Debug("Unable to set Task as completed: " + task.Name); Logger.Debug(e.ToString()); } } }
public RtmTask UpdateTaskFromResult(List list) { TaskSeries ts = list.TaskSeriesCollection[0]; if(ts != null) { RtmTask rtmTask = new RtmTask(ts, this, list.ID); lock(taskLock) { Gtk.Application.Invoke ( delegate { if(taskIters.ContainsKey(rtmTask.ID)) { Gtk.TreeIter iter = taskIters[rtmTask.ID]; taskStore.SetValue (iter, 0, rtmTask); } else { Gtk.TreeIter iter = taskStore.AppendNode(); taskIters.Add(rtmTask.ID, iter); taskStore.SetValue (iter, 0, rtmTask); } }); } return rtmTask; } return null; }
void SaveNote(RtmTask rtmTask, RtmNote note) { if (rtm != null) { try { rtm.NotesEdit (timeline, note.ID, string.Empty, note.Text); } catch (Exception e) { Debug.WriteLine ("RtmBackend.SaveNote: Unable to save note"); Debug.WriteLine (e.ToString ()); } } else throw new Exception ("Unable to communicate with Remember The Milk"); }
public void UpdateTaskInactive(RtmTask task) { UpdateTask(task); }
/// <summary> /// Update the model to match what is in RTM /// FIXME: This is a lame implementation and needs to be optimized /// </summary> void UpdateTasks(Lists lists) { Debug.WriteLine ("RtmBackend.UpdateTasks was called"); try { foreach (var list in lists.listCollection) { Tasks tasks = null; try { tasks = rtm.TasksGetList (list.ID); } catch (Exception tglex) { Debug.WriteLine ("Exception calling TasksGetList(list.ListID) " + tglex.Message); } if (tasks != null) { foreach (var tList in tasks.ListCollection) { if (tList.TaskSeriesCollection == null) continue; foreach (var ts in tList.TaskSeriesCollection) { lock (taskLock) { Application.Instance.Dispatcher.Invoke (delegate { if (!Tasks.Any (t => ((RtmTask)t).ID == ts.TaskID)) { var rtmTask = new RtmTask (ts, this, list.ID); var cat = Categories.SingleOrDefault ( c => ((RtmCategory)c).ID == list.ID); if (cat != null) cat.Add (rtmTask); } }); } } } } } } catch (Exception e) { Debug.WriteLine ("Exception in fetch " + e.Message); Debug.WriteLine (e.ToString ()); } Debug.WriteLine ("RtmBackend.UpdateTasks is done"); }
public RtmNote CreateNote(RtmTask rtmTask, string text) { RtmNet.Note note = null; RtmNote rtmNote = null; if(rtm != null) { try { note = rtm.NotesAdd(timeline, rtmTask.ListID, rtmTask.SeriesTaskID, rtmTask.TaskTaskID, String.Empty, text); rtmNote = new RtmNote(note); } catch(Exception e) { Logger.Debug("RtmBackend.CreateNote: Unable to create a new note"); Logger.Debug(e.ToString()); } } else throw new Exception("Unable to communicate with Remember The Milk"); return rtmNote; }