[Gtk-sharp-list] Updating UI from a thread

Antonio Gutiérrez Mayoral agutierr@gsyc.escet.urjc.es
Wed, 09 Mar 2005 10:16:35 +0100


Hello,

See Gtk.ThreadNotify Class on Monodoc manual, it includes an example.

Saludos,

Antonio

El mié, 09-03-2005 a las 10:00 +0100, Vincent Arnoux escribió:
> Sorry I made a mistake in the code: I am using the "ThreadStart" class
> to create the thread.
> Doesn't anyone has a track for me to follow ?
> 
> Vincent
> class myApp
> {
>    Label myLabel;
> 
>    public static void Main (string[] args)
>    {
>        new myApp ();
>    }
> 
>    public myApp()
>    {
>       //build a Gtk# window an add a label called myLabel
> 
>       Thread oThread = new Thread(new ThreadStart(this.LongComputation)=
);
>       oThread.IsBackground = true;
>       oThread.Start();
>    }
> 
>    public void LongComputation()
>    {
>       for (int i = 0; i < 100000000000000; i++)
>          myLabel.Text = "#" + i;
>    }
> }
> 
> Vincent Arnoux a écrit :
> 
> > Hello,
> > I start a large computation in a thread of my program, and I want this 
> > thread to update a label. I know this looks like a classical issue, 
> > but I can't find an easy solution. Can you please give me a solution, 
> > or point me towards a link ?
> >
> > ...
> >
> > Regards,
> > Vincent
> > _______________________________________________
> > Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> >
> >
> >
> 
> 
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
-- 
Antonio Gutiérrez Mayoral << http://gsyc.info/~agutierr >>
Grupo de Sistemas y Comunicaciones << http://gsyc.info/ >>
Escuela Superior de CC Experimentales y Tecnología
Universidadad Rey Juan Carlos << http://www.urjc.es >>