Exemplo n.º 1
0
        public static void Main()
        {
            Gdk.Threads.Init();
            Gtk.Application.Init();

            System.Threading.Thread.CurrentThread.Name = "gui-thread";

            new Gnome.Program("SteticBackend", "0.0", Gnome.Modules.UI, new string[0]);

            // Read the remoting channel to use

            string channel = Console.In.ReadLine();

            IServerChannelSinkProvider formatterSink = new BinaryServerFormatterSinkProvider();

            formatterSink.Next = new GuiDispatchServerSinkProvider();

            string unixPath = null;

            if (channel == "unix")
            {
                unixPath = System.IO.Path.GetTempFileName();
                Hashtable props = new Hashtable();
                props ["path"] = unixPath;
                props ["name"] = "__internal_unix";
                ChannelServices.RegisterChannel(new UnixChannel(props, null, formatterSink));
            }
            else
            {
                Hashtable props = new Hashtable();
                props ["port"] = 0;
                props ["name"] = "__internal_tcp";
                ChannelServices.RegisterChannel(new TcpChannel(props, null, formatterSink));
            }

            // Read the reference to the application

            string sref = Console.In.ReadLine();

            byte[]          data = Convert.FromBase64String(sref);
            MemoryStream    ms   = new MemoryStream(data);
            BinaryFormatter bf   = new BinaryFormatter();

            controller = (ApplicationBackendController)bf.Deserialize(ms);
            ApplicationBackend backend = new ApplicationBackend(controller.Application);

            controller.Connect(backend);

            Gdk.Threads.Enter();
            Gtk.Application.Run();
            Gdk.Threads.Leave();

            controller.Disconnect(backend);
        }
Exemplo n.º 2
0
		public static void Main ()
		{
			Gdk.Threads.Init ();
			Gtk.Application.Init ();
			
			System.Threading.Thread.CurrentThread.Name = "gui-thread";
			
			// Read the remoting channel to use
			
			string channel = Console.In.ReadLine ();
			
			IServerChannelSinkProvider formatterSink = new BinaryServerFormatterSinkProvider ();
			formatterSink.Next = new GuiDispatchServerSinkProvider ();
				
			string unixPath = null;
			if (channel == "unix") {
				unixPath = System.IO.Path.GetTempFileName ();
				Hashtable props = new Hashtable ();
				props ["path"] = unixPath;
				props ["name"] = "__internal_unix";
				ChannelServices.RegisterChannel (new UnixChannel (props, null, formatterSink), false);
			} else {
				Hashtable props = new Hashtable ();
				props ["port"] = 0;
				props ["name"] = "__internal_tcp";
				ChannelServices.RegisterChannel (new TcpChannel (props, null, formatterSink), false);
			}
			
			// Read the reference to the application
			
			string sref = Console.In.ReadLine ();
			byte[] data = Convert.FromBase64String (sref);
			MemoryStream ms = new MemoryStream (data);
			BinaryFormatter bf = new BinaryFormatter ();
			
			controller = (ApplicationBackendController) bf.Deserialize (ms);
			ApplicationBackend backend = new ApplicationBackend (controller.Application);
			
			controller.Connect (backend);
			
			Gdk.Threads.Enter ();
			Gtk.Application.Run ();
			Gdk.Threads.Leave ();
			
			controller.Disconnect (backend);
		}