共用方式為


GameControllerBatteryLevel 列舉

定義

控制器中剩餘的電池數量。

public enum class GameControllerBatteryLevel
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Gaming.Input.GamingInputPreviewContract, 131072)]
enum class GameControllerBatteryLevel
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Gaming.Input.GamingInputPreviewContract), 131072)]
public enum GameControllerBatteryLevel
var value = Windows.Gaming.Input.Preview.GameControllerBatteryLevel.unknown
Public Enum GameControllerBatteryLevel
繼承
GameControllerBatteryLevel
屬性

Windows 需求

裝置系列
Windows Desktop Extension SDK (已於 10.0.23665.0 引進)
API contract
Windows.Gaming.Input.GamingInputPreviewContract (已於 v2.0 引進)

欄位

Critical 1

電池電量非常低。

Full 4

電池會完全充電。

Low 2

電池電量很低。

Medium 3

電池部分收費。

Unknown 0

電池電量未知。

範例

public void SetupHeadset(IGameControllerProvider headsetProvider)
{
    LegacyGipGameControllerProvider legacyGipGameControllerProvider =
        LegacyGipGameControllerProvider.FromGameControllerProvider(headsetProvider);

    // Reset the device
    legacyGipGameControllerProvider.ExecuteCommand(DeviceCommand.Reset);

    // Check the smart mute level
    byte[] smartMuteBuffer =
        legacyGipGameControllerProvider.GetHeadsetOperation(HeadsetOperation.SmartMute);
    HeadsetLevel smartMuteValue = (HeadsetLevel)smartMuteBuffer[0];

    // Set bass boost to 3db
    byte[] bassBuffer = BitConverter.GetBytes((UInt32)3);
    legacyGipGameControllerProvider.SetHeadsetOperation(HeadsetOperation.BassBoostGain,
        bassBuffer);
}

適用於