[Mono-list] Liststore not appending correctly

Alan McGovern alan.mcgovern at gmail.com
Thu Mar 22 08:37:43 EDT 2007


Well if you want a responsive UI you should do no long calculations inside
Application.Invoke. For example
Application.Invoke(Calculate1000000DigitsOfPi())
would freeze your UI.

Doing your calculations in a worker thread and using App.Invoke to just
update the UI would be better.

Alan.

On 3/22/07, Nil Gradisnik <ghaefbgtk at gmail.com> wrote:
>
> I see.
> So if I wrap the whole thing inside Application.Invoke.... it should work
> ?
> Or do I still need to create a new variable inside for loop.
>
> Hm.. I wonder how this Application.Invoke effects performance if I use it
> alot.
> If I'm making big calculations or long loops inside Application.Invoke ?
>
> Thanks for all the answers
>
> Nil Gradisnik
>
>
> On 3/22/07, Miguel de Icaza <miguel at novell.com> wrote:
> > Hello,
> >
> > > I need your opinion on this one. I'm running a Thread which starts
> this
> > > function named PopulateTreevew() and in there this is what happens:
> >
> > First of all, you are queueing three calls: clear, the appends and the
> > setting of the model.  You should do all at once.
> >
> > Second, like Juan pointed out what happens is that the "i" variable is
> > captured, which means that they all will see the same value of i (which
> > is 10 by the time the loop is over).
> >
> > If you want to use that setup, you need to create a new variable inside
> > the for loop:
> >
> >         int j = i;
> >
> > So that you have a copy that has the value at that point in time, and
> > thats the value that will get captured.
> >
> > For more details, see the C# specification.
> >
> > Miguel
> >
> >
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070322/9f60b361/attachment-0001.html 


More information about the Mono-list mailing list