var myRadio = BluetoothRadio.Default;
var mode = myRadio.Mode;
if (mode != RadioMode.Connectable)
{
// produces an exception, as the lib uses a Windows RT Dispatcher function
myRadio.Mode = RadioMode.Connectable;
}
Code from BluetoothRadio.Windows, where the Windows.UI.Core.CoreWindow.GetForCurrentThread() returns null.
public RadioMode Mode
{
get
{
return _radio.State == RadioState.On ? RadioMode.Connectable : RadioMode.PowerOff;
}
set
{
Windows.UI.Core.CoreWindow.GetForCurrentThread().DispatcherQueue.TryEnqueue(async () =>
{
if (await Radio.RequestAccessAsync() == RadioAccessStatus.Allowed)
{
await _radio.SetStateAsync(value == RadioMode.PowerOff ? RadioState.Off : RadioState.On);
}
});
}
}
I suppose, that this would be a problem in a console app, too.
I want to do something like this:
Code from BluetoothRadio.Windows, where the Windows.UI.Core.CoreWindow.GetForCurrentThread() returns null.
I suppose, that this would be a problem in a console app, too.