[Gtk-sharp-list] Application.Invoke
Robert Schillinger
robby.schillinger at t-online.de
Tue Jan 9 03:45:33 EST 2007
Hi there,
I use a thread, wich does some Application.Invoke.
The Thread itself works properly and the invokes are done.
But ...
the invoked delegates are only executed when some keystrokes or mousemoves
are done.
I also tried to use TimeoutHandlers, but received the same behavior.
Some suggestions for that ?
Thanks a lot
namespace MySpace
{
class MainClass
{
public static void Main(string[] args)
{
Gtk.Application.Init();
MainWindow win = new MainWindow();
win.Show();
Gtk.Application.Run();
}
}
public class MainWindow : Gtk.Window
{
private Thread testThread;
public MainWindow()
: base("MyWindow")
{
testThread = new Thread(doTest);
// testThread.IsBackground = true;
testThread.Start();
}
private void doTest()
{
#if DEBUG
Console.WriteLine("Starting update test-thread");
#endif
try
{
while (true)
{
Thread.Sleep(1000);
Gtk.Application.Invoke(this.doUpdate);
#if DEBUG
Console.WriteLine("Call Gtk.Application.Invoke(...) ");
#endif
}
}
catch (ThreadAbortException e)
{
Console.WriteLine("UpdateThread - caught ThreadAbortException -
resetting.");
}
}
private void doUpdate(object sender, System.EventArgs args)
{
#if DEBUG
Console.WriteLine("App-Invokation does some work ");
#endif
Thread.Sleep(100);
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20070109/7f5cae53/attachment.html
More information about the Gtk-sharp-list
mailing list