[Gtk-sharp-list] portability issues

Paulo Pires paulo.pires@vodafone.pt
Sun, 24 Oct 2004 19:42:10 +0100


--=-0oLWdr97r0QOTcVhPdtx
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi fellows

I've solved my problem, and I must say: it was so simple! The code
follows in attach.

Thanks for you all (specially miguel for opening my eyes about
Gtk.ThreadNotify)

Oh, btw, no Gdk.Threads anymore :)

--=-0oLWdr97r0QOTcVhPdtx
Content-Disposition: attachment; filename=wndSplash.cs
Content-Type: text/x-csharp; name=wndSplash.cs; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

/*	=09
 *		File:				wndSplash.cs
 *		Description:		Splash screen
 *
 *		Developer:			Paulo Pires
 *		Email:				pjpires@gmail.com
 *
 *		Created on:			7th September 2004
 *
 */

using System;
using Gtk;

namespace TrafficMan{

public class wndSplash : Window
{
	private static Image logo, logo2;
	private static Label label1, label2, label3;
	private static ProgressBar pBar;
=09
	private static ThreadNotify tnLoad;
=09
	public wndSplash () : base (Globals.AppName)
	{
		// definir objectos
		logo =3D new Image();	=09
		logo.File =3D "trafficman.png";
	=09
		label1 =3D new Label("<b>TrafficMan</b>");
		label2 =3D new Label("<small>Um produto <b>Sinalarte</b>, desenvolvido po=
r Paulo Pires</small>");
	=09
		label1.UseMarkup =3D true;
		label2.UseMarkup =3D true;
	=09
		logo2 =3D new Image();
		logo2.File =3D "sinalarte.gif";
	=09
		pBar =3D new ProgressBar();

		VBox v =3D new VBox();
		v.BorderWidth =3D 12;
		v.Spacing =3D 12;
		this.Add(v);

		HBox h =3D new HBox();
		h.Spacing =3D 6;
		h.PackStart(logo, true, true, 0);
		h.PackStart(label1, false, false, 0);
		h.PackEnd(logo2, true, true, 0);
		v.Add(h);

		// adicionar objectos
		v.Spacing =3D 6;
		v.PackStart(label2, true, true, 0);
		v.PackEnd(pBar, true, true, 0);

		// event handlers
		this.DeleteEvent +=3D OnWindowDeleteEvent;
	=09
		// show
		this.SetIconFromFile("trafficman.png");
		this.SetPosition(WindowPosition.Center);
		this.Resizable =3D false;
		this.ShowAll();
	=09
		// definir notifies para cada Thread
		tnLoad =3D new ThreadNotify(new ReadyEvent(Load));

		Work();

	}
=09
	private void OnWindowDeleteEvent(object o, DeleteEventArgs args){
		Application.Quit();
		args.RetVal =3D true;
	}
	  =20
	static void Load(){
=09
		// load xml
		log("Loading Project ...");
		// carregar o projecto
		pBar.Text =3D "A carregar o =C3=BAltimo projecto ...";
		pBar.Fraction =3D 0.5;
	=09
		// load xml
		log("Loading Configuration ...");
		// carregar a configura=C3=A7=C3=A3o
		pBar.Text =3D "A carregar configura=C3=A7=C3=A3o ...";
		pBar.Fraction =3D 1;
	}

	void Work(){
		tnLoad.WakeupMain();
		this.Hide();			=09
		new wndMain();
	}
=09
	static void log(string str){
		Console.WriteLine(str);
	}
}
}
--=-0oLWdr97r0QOTcVhPdtx--