Exemple #1
0
        private void ConnectOrReconnect()
        {
            try
            {
                // Close active connections (if restarting)
                apiClient.DisconnectHeadTrackingProxy();
                apiClient.DisconnectControllerProxy();
                apiClient.DisconnectBroadcastProxy();
                controllerService?.Dispose();

                // Give it some time to clean up
                Thread.Sleep(10);

                // Connect to the services
                headTrackingService = new TrackingService(apiClient.ConnectHeadTrackingProxy());
                controllerService   = new ControllerService(apiClient.ConnectToControllerProxy());

                broadcastProxy = apiClient.ConnectToBroadcaster();
                broadcastProxy.HapticPulseReceived += OnHapticFeedbackReceived;

                headTrackingService.ChangeStatus(IsControllingHeadTracking);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }