Example #1
0
        private void StateSendingLoop()
        {
            try
            {
                while (isActive)
                {
                    proxy.SendControllerData(controllerState);

                    // Send state when it was updated or at least once very 1000ms to read haptic feedback
                    controllerStateChangeWaitHandle.WaitOne(millisecondsTimeout: 1000);
                }
            }
            catch (Exception x)
            {
                // Possibly connection crashed or state became corrupted in some way
                Debug.WriteLine(x);
                Dispose();
            }
        }