How to add multiple/bulks of items to the timeline?

1 view
Skip to first unread message

wataweb

unread,
Jul 5, 2011, 6:20:37 PM7/5/11
to Seesmic Desktop Platform Development
So right now, the plugin that I'm working on adds each item to the
timeline individually like so

while (y >= 0)
{
...
SynchronizationHelper.Post(OnItemAdded, new TimelineItemEventArgs(new
TimelineItemContainer(new VisibliTimelineItem(j.links[y].link,
j.links[y].title, j.links[y].clicks + "", "http://visibli.com/", "View
Full Stats")
{
Id = Guid.NewGuid().ToString()
})));
y--;
...
}

but this becomes very problematic in some cases - is there a way to
add items in bulks instead of adding each item individually?

More information
*Basically the plugin flickers if I do it this way mainly because each
item is being added to the timeline individually and this causes a
flickering effect - more over ideally I would like it to add all the
items at once so this effect does not occur

George Ionita

unread,
Jul 6, 2011, 1:37:34 AM7/6/11
to seesmic-d...@googlegroups.com
How does the Timeline implementation looks like? Do you have your own implementation or are you using Seesmic.Sdp.Utils.Timeline?

George Ionita

unread,
Jul 7, 2011, 9:41:30 AM7/7/11
to seesmic-d...@googlegroups.com
I'd definitely go with #2. This is what we do in our own plugins. If you subclass your ITimelineItem from ObservableObject, or INotifyPropertyChanged, the UI should update without any problem.

Implementing your first solution will not avoid flickering because you still have to call Clear every time - and that is the deal breaker.

Thanks,
George

On Thu, Jul 7, 2011 at 4:36 PM, wataweb <adrian....@gmail.com> wrote:
I'm using Seesmic.Sdp.Utils.Timeline

Just to explain why I receive a flicker - its due to my logic which
is:
1. clear all the items in the timeline
2. add all the items again to the timeline (with their updated
contents - some may not have updates)

I do this because each item can update very frequently so I can't rely
on adding items to the stack because the items at the bottom of the
stack are no longer up to date.

Now this is no where near perfect as I can only imagine that when I
clear the timeline things get lost and I'm sure the garbage collection
is not as good as I would like it to be.

So my thoughts on how I can do this is:
1. add the items in bulks instead of individually (this will stop the
flicker and eliminate a race case (*))
2. create data structures that hold the timeline items and just update
the data structure and the timeline item will update (whether this is
actually going to work I have my doubts because I'm thinking I need to
add some two way binding listeners)

(*)here is my biggest problem - when I call on
SynchronizationHelper.Post it must open a new thread or something
because items appear out of order - I solved this temporarily by
checking if the last item has been added before adding the next item
which is another reason why I get the flicker (i.e. if item N-1 takes
10 s to be added to the timeline, item N waits for 10 s until it adds
to the timeline - you can see why this would cause a flicker or
glitchy feel to it)

Anyways if I can add these items in bulks it would solve this waiting
process for item N-1

wataweb

unread,
Jul 7, 2011, 9:36:55 AM7/7/11
to Seesmic Desktop Platform Development
Reply all
Reply to author
Forward
0 new messages