[Gtk-sharp-list] Responsive Applications

Matteo Bertozzi theo.bertozzi at gmail.com
Sat Jan 6 12:36:21 EST 2007


I don't have understand the  Responsive Application "Lesson" at
http://www.mono-project.com/Responsive_Applications
Why OnButtonClick() Code Freeze the GUI?
and how i could correct it?

using Gtk;
using System;
using System.Threading;

public class Responsive {
    private static Gtk.Button button;
    public static void Main() {
        Gtk.Application.Init();
        Window win = new Window("Prova");
        button = new Gtk.Button("Start Hard Work");
        button.Clicked += new EventHandler(OnButtonClick);
        win.Add(button);
        win.ShowAll();
        Gtk.Application.Run();
    }

    private static void OnButtonClick (object obj, EventArgs args) {
        Gtk.Application.Invoke (delegate {
            Thread.Sleep(1800 + 3600);
            button.Label = "End Hard Work";
        });
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20070106/6dde33ae/attachment.html 


More information about the Gtk-sharp-list mailing list