Stetic.ApplicationBackend.Main C# (CSharp) Method

Main() public static method

public static Main ( ) : void
return void
        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);
        }