如何在WPF应用程序中调用Windows.Devices.Bluetooth [英] How to call Windows.Devices.Bluetooth in WPF app
问题描述
我正在尝试使用Windows.Devices.Bluetooth命名空间,并在WPF应用程序中获得PlatformNotSupportedException。 它说这个平台不支持WinRT。
I'm trying to use the Windows.Devices.Bluetooth namespace and I get PlatformNotSupportedException in a WPF app. It says WinRT is not supported on this platform.
我做错了什么?
杰克
推荐答案
请参阅https://blogs.windows.com/buildingapps/2017/01/25/calling-windows-10-apis-desktop-application/从桌面上下文(包括.Net和WPF)调用WinRT API的概述。您需要添加适当的引用来导入WinRT API。
See https://blogs.windows.com/buildingapps/2017/01/25/calling-windows-10-apis-desktop-application/ for an overview of calling WinRT API from desktop contexts (including .Net and WPF). You will need to add appropriate references to import the WinRT API.
Windows.Devices.Bluetooth API是DualApiPartitioned,因此可以从桌面上下文和UWP调用。
The Windows.Devices.Bluetooth API are DualApiPartitioned and so can be called from desktop contexts as well as from UWP.
桌面.Net Framework论坛中的人员应该能够提供有关从桌面上下文调用WinRT API的更多详细信息。
Folks in the desktop .Net Framework forums should be able to provide more detail on calling WinRT API from desktop contexts if needed.
这篇关于如何在WPF应用程序中调用Windows.Devices.Bluetooth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!