[Gtk-sharp-list] Application.Invoke

gemini64 robby.schillinger at t-online.de
Tue Jan 9 03:00:12 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);
  }

}
}
-- 
View this message in context: http://www.nabble.com/Application.Invoke-tf2944404.html#a8233455
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list