Accord.Controls.Joystick.GetCurrentStatus C# (CSharp) Method

GetCurrentStatus() public method

Get joystick's status.

Before using this method the joystick object needs to be initialized using Init method or Joystick(int) constructor.

The requested joystick is not connected to the system. Joystick was not initialized.
public GetCurrentStatus ( ) : Status
return Status
        public Status GetCurrentStatus()
        {
            JoystickAPI.JOYINFOEX ji = new JoystickAPI.JOYINFOEX();

            ji.size = System.Runtime.InteropServices.Marshal.SizeOf(ji);
            ji.flags = (Info.capabilities.axesNumber > 5) ? JoystickAPI.JoyPosFlags.ReturnAll :
                requestFlags[Info.capabilities.axesNumber];

            if (JoystickAPI.joyGetPosEx(Info.ID, ji) != JoystickAPI.ResultCode.NoError)
            {
                throw new NotConnectedException("The requested joystick is not connected to the system.");
            }

            return new Status(ji, Info.capabilities);
        }