Beispiel #1
0
        private void RefreshThreadLoop()
        {
            while (runningRefreshThread)
            {
                runRefreshEvent.WaitOne();

                if (!runningRefreshThread)
                {
                    return;
                }

                // Fire the event on the main thread
                Gtk.Application.Invoke(delegate {
                    if (BackendSyncStarted != null)
                    {
                        BackendSyncStarted();
                    }
                });

                runRefreshEvent.Reset();

                if (rtmAuth != null)
                {
                    Lists lists = rtm.ListsGetList();
                    UpdateCategories(lists);
                    UpdateTasks(lists);
                }
                if (!initialized)
                {
                    initialized = true;

                    // Fire the event on the main thread
                    Gtk.Application.Invoke(delegate {
                        if (BackendInitialized != null)
                        {
                            BackendInitialized();
                        }
                    });
                }

                // Fire the event on the main thread
                Gtk.Application.Invoke(delegate {
                    if (BackendSyncFinished != null)
                    {
                        BackendSyncFinished();
                    }
                });
            }
        }
Beispiel #2
0
        public IEnumerable <ITaskListCore> GetAll()
        {
            yield return(allList);

            var lists = Rtm.ListsGetList();

            foreach (var list in lists.listCollection)
            {
                ITaskListCore taskList;
                if (list.Smart == 1)
                {
                    taskList = Factory.CreateSmartTaskList(list.ID,
                                                           list.Name);
                }
                else
                {
                    taskList = Factory.CreateTaskList(list.ID, list.Name);
                }
                yield return(taskList);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Retrieves the list of task lists as <see cref="RTMListIem"/>s from RTM server.
        /// Also adds 4 meta lists for easy access to overdue tasks,
        /// and tasks due today/tomorrow/in a week.
        /// </summary>
        public static void UpdateLists()
        {
            lock (list_lock) {
                if (!IsAuthenticated && !TryConnect())
                {
                    return;
                }

                Lists rtmLists;
                try {
                    rtmLists = rtm.ListsGetList();
                } catch (RtmException e) {
                    Log <RTM> .Debug(AddinManager.CurrentLocalizer.GetString("An error occured when updating RTM lists: {0}"),
                                     e.Message);

                    rtmLists = null;
                    return;
                }

                lists.Clear();

                lists.Add(new RTMListItem("today", "Today", 1, 1));
                lists.Add(new RTMListItem("tomorrow", "Tomorrow", 1, 1));
                lists.Add(new RTMListItem("week", "In a Week", 1, 1));
                lists.Add(new RTMListItem("overdue", "Overdue", 1, 1));

                foreach (List rtmList in rtmLists.listCollection)
                {
                    if (rtmList.Deleted == 0 && rtmList.Smart == 0)
                    {
                        lists.Add(new RTMListItem(rtmList.ID, rtmList.Name, rtmList.Locked, rtmList.Smart));
                    }
                }
            }
            Log <RTM> .Debug("Received {0} lists.", lists.ToArray().Length);
        }