Beispiel #1
0
        private void TaskProvider_TasksChanged(object sender, TasksChangedEventArgs e)
        {
            foreach (CommentTask task in e.RemovedTasks)
            {
                this.tasks.Items.Remove(task);
            }

            foreach (CommentTask task in e.AddedTasks)
            {
                this.tasks.Items.Add(task);
            }

            // This is necessary to make new items respect existing SortDescriptions.
            this.tasks.Items.Refresh();
        }
        private void ForegroundTimer_Tick(object sender, EventArgs e)
        {
            var handler = this.TasksChanged;

            if (handler != null)
            {
                // We can only safely add and remove visible tasks from the foreground thread.
                IReadOnlyDictionary <CommentTask, bool> changedTasks = this.manager.GetChangedTasks();
                if (changedTasks != null)
                {
                    TasksChangedEventArgs args = new TasksChangedEventArgs(
                        changedTasks.Where(pair => pair.Value).Select(pair => pair.Key),
                        changedTasks.Where(pair => !pair.Value).Select(pair => pair.Key));
                    handler(this, args);
                }
            }
        }