有什么方法可以在Windows 10中的C#桌面应用程序中使用Bluetooth LE? [英] Is there any way to use Bluetooth LE from a c# desktop app in windows 10?
问题描述
我在网上发现的有关蓝牙LE的所有内容都需要通用Windows应用程序,这完全不适合我.
Everything I found online regarding bluetooth LE requires a universal windows app, which is completely unsuitable for me.
有没有一种方法可以从c#使用蓝牙LE,而不必像在UWP上那样编写我的整个应用程序?
Is there a way to use bluetooth LE from c# without having to write my whole app as on UWP?
推荐答案
您可以在C#桌面应用程序中使用C#API!我在GitHub上有一个示例.
You can use C# APIs in C# Desktop applications! I have a sample here in GitHub.
通常,要访问C#APIS,请为您的项目添加两个引用:
In general, to get access to the C# APIS, add two references to your project:
-
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd
-
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
请注意,#2版本取决于您所使用的.NET版本.
Note that the #2 version depends on the version of .NET that you're using.
不支持后台任务,但所有其他蓝牙C# 功能应该在那里.
Background tasks will not be supported, but all other Bluetooth C# features should be there.
这篇关于有什么方法可以在Windows 10中的C#桌面应用程序中使用Bluetooth LE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!