private static bool IsInitialState(MonitoredJoystick monitor)
        {
            return(monitor.Current.Equals(monitor.Prev));
//                IsInitialState(monitor.Current.X) &&
//                IsInitialState(monitor.Current.Y) &&
//                IsInitialState(monitor.Current.Z) &&
//                IsInitialState(monitor.Current.Rx) &&
//                IsInitialState(monitor.Current.Ry) &&
//                IsInitialState(monitor.Current.Rz) &&
//                IsInitialState(monitor.Current.U) &&
//                IsInitialState(monitor.Current.V);
        }
        private static bool IsInitialState(MonitoredJoystick monitor)
        {
            return monitor.Current.Equals(monitor.Prev);
//                IsInitialState(monitor.Current.X) &&
//                IsInitialState(monitor.Current.Y) &&
//                IsInitialState(monitor.Current.Z) &&
//                IsInitialState(monitor.Current.Rx) &&
//                IsInitialState(monitor.Current.Ry) &&
//                IsInitialState(monitor.Current.Rz) &&
//                IsInitialState(monitor.Current.U) &&
//                IsInitialState(monitor.Current.V);
        }
        private static bool IsAxisRecognized(MonitoredJoystick monitor, IList<JoystickAxis> ignoreAxes, out JoystickAxis axis, out bool isInverted)
        {
            // When exiting in false, we still need to set some default values that should never be used
            axis = JoystickAxis.X;
            isInverted = false;

//            if (IsInitialState(monitor))
//                return false;

            // Max possible deviation is Int16.MaxValue - Int16.MinValue
            // Most likely deviation is from 0 to Int16.MaxValue or 0 to Int16.MinValue
            // as the joystick is typically centered.
            const int threshold = (int)(0.9*Int16.MaxValue);
            if (monitor.Deviation.X > threshold && !ignoreAxes.Contains(JoystickAxis.X))
            {
                axis = JoystickAxis.X;
                isInverted = monitor.Current.X > monitor.MinValue.X;
            }
            else if (monitor.Deviation.Y > threshold && !ignoreAxes.Contains(JoystickAxis.Y))
            {
                axis = JoystickAxis.Y;
                isInverted = monitor.Current.Y > monitor.MinValue.Y;
            }
            else if (monitor.Deviation.Z > threshold && !ignoreAxes.Contains(JoystickAxis.Z))
            {
                axis = JoystickAxis.Z;
                isInverted = monitor.Current.Z > monitor.MinValue.Z;
            }
            else if (monitor.Deviation.Rx > threshold && !ignoreAxes.Contains(JoystickAxis.Rx))
            {
                axis = JoystickAxis.Rx;
                isInverted = monitor.Current.Rx > monitor.MinValue.Rx;
            }
            else if (monitor.Deviation.Ry > threshold && !ignoreAxes.Contains(JoystickAxis.Ry))
            {
                axis = JoystickAxis.Ry;
                isInverted = monitor.Current.Ry > monitor.MinValue.Ry;
            }
            else if (monitor.Deviation.Rz > threshold && !ignoreAxes.Contains(JoystickAxis.Rz))
            {
                axis = JoystickAxis.Rz;
                isInverted = monitor.Current.Rz > monitor.MinValue.Rz;
            }
            else if (monitor.Deviation.U > threshold && !ignoreAxes.Contains(JoystickAxis.U))
            {
                axis = JoystickAxis.U;
                isInverted = monitor.Current.U > monitor.MinValue.U;
            }
            else if (monitor.Deviation.V > threshold && !ignoreAxes.Contains(JoystickAxis.V))
            {
                axis = JoystickAxis.V;
                isInverted = monitor.Current.V > monitor.MinValue.V;
            }
            else
                return false;

            return true;
        }
        private static bool IsAxisRecognized(MonitoredJoystick monitor, IList <JoystickAxis> ignoreAxes, out JoystickAxis axis, out bool isInverted)
        {
            // When exiting in false, we still need to set some default values that should never be used
            axis       = JoystickAxis.X;
            isInverted = false;

//            if (IsInitialState(monitor))
//                return false;

            // Max possible deviation is Int16.MaxValue - Int16.MinValue
            // Most likely deviation is from 0 to Int16.MaxValue or 0 to Int16.MinValue
            // as the joystick is typically centered.
            const int threshold = (int)(0.9 * Int16.MaxValue);

            if (monitor.Deviation.X > threshold && !ignoreAxes.Contains(JoystickAxis.X))
            {
                axis       = JoystickAxis.X;
                isInverted = monitor.Current.X > monitor.MinValue.X;
            }
            else if (monitor.Deviation.Y > threshold && !ignoreAxes.Contains(JoystickAxis.Y))
            {
                axis       = JoystickAxis.Y;
                isInverted = monitor.Current.Y > monitor.MinValue.Y;
            }
            else if (monitor.Deviation.Z > threshold && !ignoreAxes.Contains(JoystickAxis.Z))
            {
                axis       = JoystickAxis.Z;
                isInverted = monitor.Current.Z > monitor.MinValue.Z;
            }
            else if (monitor.Deviation.Rx > threshold && !ignoreAxes.Contains(JoystickAxis.Rx))
            {
                axis       = JoystickAxis.Rx;
                isInverted = monitor.Current.Rx > monitor.MinValue.Rx;
            }
            else if (monitor.Deviation.Ry > threshold && !ignoreAxes.Contains(JoystickAxis.Ry))
            {
                axis       = JoystickAxis.Ry;
                isInverted = monitor.Current.Ry > monitor.MinValue.Ry;
            }
            else if (monitor.Deviation.Rz > threshold && !ignoreAxes.Contains(JoystickAxis.Rz))
            {
                axis       = JoystickAxis.Rz;
                isInverted = monitor.Current.Rz > monitor.MinValue.Rz;
            }
            else if (monitor.Deviation.U > threshold && !ignoreAxes.Contains(JoystickAxis.U))
            {
                axis       = JoystickAxis.U;
                isInverted = monitor.Current.U > monitor.MinValue.U;
            }
            else if (monitor.Deviation.V > threshold && !ignoreAxes.Contains(JoystickAxis.V))
            {
                axis       = JoystickAxis.V;
                isInverted = monitor.Current.V > monitor.MinValue.V;
            }
            else
            {
                return(false);
            }

            return(true);
        }