public BBClient(string host, uint port) { client = new GT.Net.Client(new BBClientConfiguration()); client.ConnexionAdded += _client_ConnexionAdded; this.host = host; this.port = port; MDR = MessageDeliveryRequirements.MostStrict; timer = new System.Windows.Forms.Timer(); timer.Interval = 50; timer.Tick += _timer_Tick; }
void Form1_Load(object sender, EventArgs e) { if (Program.kinectEnabled) kinectClient.RecalculateTable(); // Set up GT var config = new DefaultClientConfiguration(); client = new GT.Net.Client(config); client.ErrorEvent += delegate(ErrorSummary es) { Console.WriteLine(es); if (es.Context is GT.Net.CannotConnectException) { Cursor.Show(); MessageBox.Show(this, "Could not connect to server. Make sure the ClientRepeater is started."); quitting = true; } }; client.ConnexionRemoved += client_ConnexionRemoved; client.Start(); updates = client.OpenSessionChannel(host, port, SessionUpdatesChannelId, ChannelDeliveryRequirements.SessionLike); updates.MessagesReceived += updates_SessionMessagesReceived; coords = client.OpenStreamedTuple<int, int>(host, port, PointersChannelId, TimeSpan.FromMilliseconds(25), ChannelDeliveryRequirements.AwarenessLike); coords.StreamedTupleReceived += coords_StreamedTupleReceived; control = client.OpenStringChannel(host, port, ControlChannelId, ChannelDeliveryRequirements.CommandsLike); control.MessagesReceived += control_MessagesReceived; clicks = client.OpenStringChannel(host, port, ClickChannelId, ChannelDeliveryRequirements.CommandsLike); clicks.MessagesReceived += clicks_MessagesReceived; armImages = client.OpenObjectChannel(host, port, ArmImageChannelId, ChannelDeliveryRequirements.AwarenessLike); armImages.MessagesReceived += armImages_MessagesReceived; origins = client.OpenStreamedTuple<int, int>(host, port, OriginsChannelId, TimeSpan.FromMilliseconds(25), ChannelDeliveryRequirements.AwarenessLike); origins.StreamedTupleReceived += origins_StreamedTupleReceived; showArms = client.OpenStreamedTuple<bool>(host, port, ShowArmsChannelId, TimeSpan.FromMilliseconds(25), ChannelDeliveryRequirements.AwarenessLike); showArms.StreamedTupleReceived += showArms_StreamedTupleReceived; kinectCalibrationChannel = client.OpenObjectChannel(host, port, KinectCalibrationChannelId, ChannelDeliveryRequirements.CommandsLike); kinectCalibrationChannel.MessagesReceived += kinectCalibrationChannel_MessagesReceived; boxGrabChannel = client.OpenObjectChannel(host, port, BoxGrabChannelId, ChannelDeliveryRequirements.CommandsLike); boxGrabChannel.MessagesReceived += boxGrabChannel_MessagesReceived; if (Program.useTouch) { tuioClient = new TuioClient(); tuioClient.addTuioListener(this); tuioClient.connect(); } }