[Gtk-sharp-list] Apps not responsive on Windows
xiii29 at free.fr
xiii29 at free.fr
Mon Nov 20 07:23:39 EST 2006
Hi,
Ive got trouble with Gtk# on Windows. Ive following the tutorial here
(http://www.mono-project.com/Responsive_Applications) in order to manager
refresh of my interface.
//This method handles a event from a background tak which is executed after
Timer.Elasped event :
private void gereMiseAJour(object source, MiseAJourEventArgs args)
{
Debug.WriteLine(" gereMiseAJour ... ", DebugLevel.Information);
this._obj = args;
if (this._delMiseAJour != null)
{
Gtk.Application.Invoke(this._delMiseAJour);
}
}
// The delegate Im using in the Gtk.Application.Invoke
private EventHandler _delMiseAJour;
// Which is declared in the constructor
//[...]
this._delMiseAJour = new EventHandler(this.miseAJour);
//[...]
// Here is the code in the miseAJour function
private void miseAJour(object sender, EventArgs args)
{
if (this._obj != null)
{
Debug.WriteLine(" MainWindow.miseAJour : " + this._obj.ToString(),
DebugLevel.Information);
this._lblTexte1.LabelProp = "<b>" + this._obj.Texte1 + "</b>"
Debug.WriteLine(" MainWindow.miseAJour : " +
this._lblTexte1.get_Text(), DebugLevel.Information);
}
}
As you can see the principe is :
-1- Get the event from the background and store the parameter,
-2- If delegate not null ==> call it threw Gtl.Application.Invoke,
-3- The delegate link to a methode that use the stored parameters to refresh the
interface.
It is working fine on Mono/Linux but on .Net/Windows, I have to select or
deselect the interface in order to make it refresh
There is a Debug.WriteLine in the miseAJour method. I can see in the trace that
méthod is execute only when I do an action on the window ...
More information about the Gtk-sharp-list
mailing list