static void Main() { // set up the application Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainWindow window = new MainWindow(); Controller controller = new Controller(); controller.Initialise(); window.controller = controller; controller.mainWindow = window; // publish the controller to the remoting system TcpChannel channel = new TcpChannel(1180); ChannelServices.RegisterChannel(channel, false); RemotingServices.Marshal(controller, "controller.rem"); // start the event loop Application.Run(window); // the application is finishing - close down the remoting channel RemotingServices.Disconnect(controller); ChannelServices.UnregisterChannel(channel); }