Christian Hoff wrote:
> 
> You can use Gtk.Application.Invoke (some_method) and then call 
> Aplication.Run:
> 
> public static void Main (string[] args)
> {
>       Application.Init();
>       MainWindow window = new MainWindow();
>       window.Show();
>       Gtk.Application.Invoke (some_method);
>       Application.Run();
> }
> 
> public static void some_method (object sender, System.EventArgs e) {
>              // This code is called from the Gtk+ main loop(which is run 
> by calling Gtk.Application.Run ();
>              Thread.CurrentThread.Sleep (5000);
>              mywindow.Hide ();
> }
> 
> Gtk.Application.Run does never return until Gtk.Application.Quit is 
> called. It goes into an endless loop, the main loop. By using 
> Application.Invoke, the main loop will call the specified method in one 
> of its next iterations.
> 

Sorry about my late reply, I've been busy with exams and work, and haven't
had any time for my hobby programming attempts. Anyway, I'm sorry, but I
should've mentioned that I've tried that too, unsuccessfully.

Here's a more recent attempt of mine, just to test:

public static void ShowSplash(object sender, EventArgs e)
{       
        MainWindow window = new MainWindow();
        window.Show();
        
        Console.WriteLine("Before Sleep");
        System.Threading.Thread.Sleep(5000);                    
        Console.WriteLine("After Sleep");
}

public static void Main (string[] args)
{
        Application.Init();
        Application.Invoke(ShowSplash);
        Console.WriteLine("Before Run");
        Application.Run();
}

Now, the console shows, in order, "Before Run", "Before Sleep", "After
Sleep". The MainWindow, despite being run in a Gtk.Application invocation,
does not show until after the function returns. In other words, attempting
to show a splash screen and doing some heavy work there would result in the
same problem as the one I'm having. Thanks for your reply, but it is
unfortunately no solution.

I can't believe this can be so hard to do. Is this really that uncommon a
scenario? You'd think there'd be something about doing something like this
in the documentation or some website or blog, but I fail to find any
information anywhere on this topic...
-- 
View this message in context: 
http://www.nabble.com/How-to-implement-a-splash-screen--tp22757836p22881934.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to