Exemplo n.º 1
0
 void OnBackendStopped(object ob, EventArgs args)
 {
     // The backend process crashed, try to restart it
     Backend           = null;
     backendController = new ApplicationBackendController(this, channelId);
     backendController.StartBackend();
     OnBackendChanged(true);
 }
Exemplo n.º 2
0
        void OnNewBackendStarted(object ob, EventArgs args)
        {
            OnBackendChanging();
            ApplicationBackendController oldBackend = backendController;

            backendController = (ApplicationBackendController)ob;
            OnBackendChanged(true);
            oldBackend.StopBackend(false);
        }
Exemplo n.º 3
0
		public IsolatedApplication (IsolationMode mode)
		{
			if (mode == IsolationMode.None)
				throw new ArgumentException ("mode");
			channelId = RegisterRemotingChannel (mode);
			backendController = new ApplicationBackendController (this, channelId);
			backendController.StartBackend ();
			OnBackendChanged (false);
		}
Exemplo n.º 4
0
 public IsolatedApplication(IsolationMode mode)
 {
     if (mode == IsolationMode.None)
     {
         throw new ArgumentException("mode");
     }
     channelId         = RegisterRemotingChannel(mode);
     backendController = new ApplicationBackendController(this, channelId);
     backendController.StartBackend();
     OnBackendChanged(false);
 }
Exemplo n.º 5
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.º 6
0
        internal override void RestartBackend()
        {
            // The backend process needs to be restarted.
            // This is done in background.

            ThreadPool.QueueUserWorkItem(delegate {
                try {
                    // Start the new backend
                    ApplicationBackendController newController = new ApplicationBackendController(this, channelId);
                    newController.StartBackend();
                    Gtk.Application.Invoke(newController, EventArgs.Empty, OnNewBackendStarted);
                } catch {
                    // FIXME: show an error message
                }
            });
        }
Exemplo n.º 7
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);
		}
Exemplo n.º 8
0
		void OnBackendStopped (object ob, EventArgs args)
		{
			// The backend process crashed, try to restart it
			Backend = null;
			backendController = new ApplicationBackendController (this, channelId);
			backendController.StartBackend ();
			OnBackendChanged (true);
		}
Exemplo n.º 9
0
		void OnNewBackendStarted (object ob, EventArgs args)
		{
			OnBackendChanging ();
			ApplicationBackendController oldBackend = backendController;
			backendController = (ApplicationBackendController) ob;
			OnBackendChanged (true);
			oldBackend.StopBackend (false);
		}
Exemplo n.º 10
0
		internal override void RestartBackend ()
		{
			// The backend process needs to be restarted.
			// This is done in background.
				
			ThreadPool.QueueUserWorkItem (delegate {
				try {
					// Start the new backend
					ApplicationBackendController newController = new ApplicationBackendController (this, channelId);
					newController.StartBackend ();
					Gtk.Application.Invoke (newController, EventArgs.Empty, OnNewBackendStarted);
				} catch {
					// FIXME: show an error message
				}
			});
		}