Example #1
0
        public static RTMTaskItem NewTask(string listId, string taskData)
        {
            List rtmList;

            try {
                rtmList = rtm.TasksAdd(timeline, taskData, listId, true);
            } catch (RtmException e) {
                Log <RTM> .Debug(e.Message);

                return(null);
            }

            FinalizeAction(AddinManager.CurrentLocalizer.GetString("New Task Created"),
                           AddinManager.CurrentLocalizer.GetString("The task has been successully added to your Remember The milk task list."));

            return(new RTMTaskItem(rtmList.ID, rtmList.TaskSeriesCollection[0].TaskSeriesID,
                                   rtmList.TaskSeriesCollection[0].TaskCollection[0].TaskID,
                                   rtmList.TaskSeriesCollection[0].Name,
                                   rtmList.TaskSeriesCollection[0].TaskCollection[0].Due,
                                   rtmList.TaskSeriesCollection[0].TaskCollection[0].Completed,
                                   rtmList.TaskSeriesCollection[0].TaskURL,
                                   rtmList.TaskSeriesCollection[0].TaskCollection[0].Priority,
                                   rtmList.TaskSeriesCollection[0].TaskCollection[0].HasDueTime,
                                   rtmList.TaskSeriesCollection[0].TaskCollection[0].Estimate,
                                   rtmList.TaskSeriesCollection[0].LocationID, ""));
        }
Example #2
0
        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);
        }