/** * Is invoked when application launches. Connects the Client to the Server */ public void OnUserConnect(string address, int port) { ChannelDispatcher dispatcher = new ChannelDispatcher(); this.transport = new TransportClient(dispatcher); sessionClient = new SessionClient(this.transport, this); dispatcher.RegisterChannel(sessionClient); surfaceClient = new SurfaceClient(this, this.transport); dispatcher.RegisterChannel(surfaceClient); inputClient = new InputClient(this.transport); dispatcher.RegisterChannel(inputClient); try { this.transport.Connect(address, port); DisplayStatusText("Welcome! You are connected to Screenary server at " + address + " : " + port); } catch (TransportException e) { ExceptionDialog exception = new ExceptionDialog("Operation Fail", "Could not connect to Screenary server at " + address + " : " + port + "\nVerify connections."); } }
public void OnUserConnect(string address, int port) { ChannelDispatcher dispatcher = new ChannelDispatcher(); this.transport = new TransportClient(dispatcher); session = new Session(this.transport, this); dispatcher.RegisterChannel(session); SurfaceClient surface = new SurfaceClient(this, this.transport); dispatcher.RegisterChannel(surface); this.transport.Connect(address, port); Console.WriteLine("connected to screenary server at {0}:{1}", address, port); notificationBar.Push (id, "Welcome! You are connected to Screenary server at " + address + " : " + port); }