示例#1
0
        private void LoadTasksFromCategory(IceCategory category)
        {
            TaskEntry [] taskEntries = null;
            try {
                taskEntries = deskIceDaemon.GetTaskEntries(category.Folder.ID);
            } catch (Exception e) {
                Logger.Warn("Exception loading tasks from category: {0}", e.Message);
                return;
            }

            foreach (TaskEntry entry in taskEntries)
            {
                IceTask      task = new IceTask(this, category, entry);
                Gtk.TreeIter iter;
                if (taskIters.ContainsKey(task.Id))
                {
                    iter = taskIters [task.Id];
                }
                else
                {
                    iter = tasks.Append();
                    taskIters [task.Id] = iter;
                }

                tasks.SetValue(iter, 0, task);
            }
        }
示例#2
0
        public void UpdateTask(IceTask task)
        {
            // Set the task in the store so the model will update the UI.
            Gtk.TreeIter iter;

            if (!taskIters.ContainsKey(task.Id))
            {
                // This must be a new task that should be added in.
                iter = tasks.Append();
                taskIters [task.Id] = iter;
            }
            else
            {
                iter = taskIters [task.Id];
            }

            if (task.State == TaskState.Deleted)
            {
                taskIters.Remove(task.Id);
                if (!tasks.Remove(ref iter))
                {
                    Logger.Debug("Successfully deleted from taskStore: {0}",
                                 task.Name);
                }
                else
                {
                    Logger.Debug("Problem removing from taskStore: {0}",
                                 task.Name);
                }
            }
            else
            {
                tasks.SetValue(iter, 0, task);
            }
        }
示例#3
0
        public void SaveAndUpdateTask(IceTask task)
        {
            // Send new values to the server and then update the task in the
            // TreeModel.

            try {
                IceCategory iceCategory = task.Category as IceCategory;
                deskIceDaemon.UpdateTask(iceCategory.Folder.ID,
                                         task.Entry.ID,
                                         task.Name,
                                         task.Entry.Description,
                                         task.IceDesktopStatus,
                                         int.Parse(task.Entry.Priority),
                                         int.Parse(task.Entry.PercentComplete),
                                         task.DueDateString);
            } catch (Exception e) {
                Logger.Warn("Error calling deskIceDaemon.UpdateTask: {0}",
                            e.Message);
                return;
            }

            UpdateTask(task);
        }
示例#4
0
        /// <summary>
        /// Create a new task.
        /// </summary>
        public ITask CreateTask(string taskName, ICategory category)
        {
            IceTask     task        = null;
            IceCategory iceCategory = category as IceCategory;

            if (taskName == null || taskName.Trim() == string.Empty ||
                category == null)
            {
                Logger.Warn("Cannot call IceBackend.CreateTask () with null/empty arguments.");
                return(null);
            }

            string taskId = null;

            try {
                taskId =
                    deskIceDaemon.CreateTask(iceCategory.Folder.ID,
                                             taskName,
                                             string.Empty,                                      // description
                                             5,                                                 // Lowest Priority/None
                                             TaskStatus.NeedsAction,
                                             string.Empty,                                      // start date
                                             string.Empty);                                     // due date
            } catch (Exception e) {
                Logger.Error("Exception calling deskIceDaemon.CreateTask (): {0}", e.Message);
                return(null);
            }

            TaskEntry taskEntry = new TaskEntry(taskId, taskName);

            task = new IceTask(this, iceCategory, taskEntry);

            UpdateTask(task);

            return(task);
        }
示例#5
0
        private void LoadTasksFromCategory(IceCategory category)
        {
            TaskEntry [] taskEntries = null;
            try {
                taskEntries = deskIceDaemon.GetTaskEntries (category.Folder.ID);
            } catch (Exception e) {
                Logger.Warn ("Exception loading tasks from category: {0}", e.Message);
                return;
            }

            foreach (TaskEntry entry in taskEntries) {
                IceTask task = new IceTask (this, category, entry);
                Gtk.TreeIter iter;
                if (taskIters.ContainsKey (task.Id))
                    iter = taskIters [task.Id];
                else {
                    iter = tasks.Append ();
                    taskIters [task.Id] = iter;
                }

                tasks.SetValue (iter, 0, task);
            }
        }
示例#6
0
        public void UpdateTask(IceTask task)
        {
            // Set the task in the store so the model will update the UI.
            Gtk.TreeIter iter;

            if (!taskIters.ContainsKey (task.Id)) {
                // This must be a new task that should be added in.
                iter = tasks.Append ();
                taskIters [task.Id] = iter;
            } else {
                iter = taskIters [task.Id];
            }

            if (task.State == TaskState.Deleted) {
                taskIters.Remove (task.Id);
                if (!tasks.Remove (ref iter)) {
                    Logger.Debug ("Successfully deleted from taskStore: {0}",
                        task.Name);
                } else {
                    Logger.Debug ("Problem removing from taskStore: {0}",
                        task.Name);
                }
            } else {
                tasks.SetValue (iter, 0, task);
            }
        }
示例#7
0
        public void SaveAndUpdateTask(IceTask task)
        {
            // Send new values to the server and then update the task in the
            // TreeModel.

            try {
                IceCategory iceCategory = task.Category as IceCategory;
                deskIceDaemon.UpdateTask (iceCategory.Folder.ID,
                                          task.Entry.ID,
                                          task.Name,
                                          task.Entry.Description,
                                          task.IceDesktopStatus,
                                          int.Parse (task.Entry.Priority),
                                          int.Parse (task.Entry.PercentComplete),
                                          task.DueDateString);
            } catch (Exception e) {
                Logger.Warn ("Error calling deskIceDaemon.UpdateTask: {0}",
                             e.Message);
                return;
            }

            UpdateTask (task);
        }
示例#8
0
        /// <summary>
        /// Create a new task.
        /// </summary>
        public ITask CreateTask(string taskName, ICategory category)
        {
            IceTask task = null;
            IceCategory iceCategory = category as IceCategory;

            if (taskName == null || taskName.Trim () == string.Empty
                    || category == null) {
                Logger.Warn ("Cannot call IceBackend.CreateTask () with null/empty arguments.");
                return null;
            }

            string taskId = null;
            try {
                taskId =
                deskIceDaemon.CreateTask (iceCategory.Folder.ID,
                                          taskName,
                                          string.Empty,	// description
                                          5,			// Lowest Priority/None
                                          TaskStatus.NeedsAction,
                                          string.Empty,	// start date
                                          string.Empty);	// due date
            } catch (Exception e) {
                Logger.Error ("Exception calling deskIceDaemon.CreateTask (): {0}", e.Message);
                return null;
            }

            TaskEntry taskEntry = new TaskEntry (taskId, taskName);
            task = new IceTask (this, iceCategory, taskEntry);

            UpdateTask (task);

            return task;
        }
示例#9
0
文件: IceNote.cs 项目: nolith/tasque
 public IceNote(IceBackend iceBackend,
                IceTask iceTask)
 {
     backend = iceBackend;
     task    = iceTask;
 }
示例#10
0
文件: IceNote.cs 项目: nolith/tasque
        public IceNote(IceBackend iceBackend,
						IceTask iceTask)
        {
            backend = iceBackend;
            task = iceTask;
        }