1
有一些奇怪的方法,如檢查配對設備and catching exceptions以查看它是否打開。如何在Windows運行時檢查藍牙的狀態?
if ((uint)ex.HResult == 0x8007048F)
{
var result = MessageBox.Show("Bluetooth is turned off.\nTo see the current Bluetooth settings tap 'ok'", "Bluetooth Off", MessageBoxButton.OKCancel);
}
但我看到有一個新的API BluetoothConnectionStatus
但不知道如何使用它。
如何檢查Windows Phone Runtime應用程序中的藍牙狀態?
BluetoothDevice類還沒有構造,是靜態的。 – user3293835
好的。我更新了我的回答 – PaulH
哦,我明白了。這不是靜態的。它只是沒有ctor。它要求您使用'FromHostNameAsync'或'FromBluetoothAddressAsync'選擇特定設備。您可以使用「PeerFinder」API獲取該信息 – PaulH