Bagikan melalui


GamePadState.IsConnected Property

Indicates whether the Xbox 360 Controller is connected.

Namespace: Microsoft.Xna.Framework.Input
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public bool IsConnected { get; }

Property Value

true if the controller is connected; false otherwise.

Remarks

When calling GetState or GetCapabilities, check the returned structure's IsConnected property value. If the controller has been disconnected, this value will be false. When a controller is disconnected, values for its state and/or capabilities will not be valid. The controller will also not be able to receive new vibration settings.

See Also

Tasks

Detecting Xbox 360 Controller Button Presses (Xbox 360, Windows)
Determining If an Xbox 360 Controller Is Disconnected (Xbox 360, Windows)

Concepts

Overview of User Input and Input Devices

Reference

GamePadState Structure
GamePadState Members
Microsoft.Xna.Framework.Input Namespace

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone