Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, October 11, 2016 6:34 AM
Recently on the forum i noticed about 32feet.net lib for .net. Then, i head to get hands on it. It's a good lib for free for bluetooth tech for .net. Everything is fine until i got an exception thrown when my laptop's bluetooth device turned off. I searched the lib for any api, and found BluetoothRadio.PirmaryRadio and BluetoothRadio.AllRadios properties. But, they contains null reference when the device is turned off by which i think that i can enable my device's mode to Discoverable or Connectable.
Therefore, i googled about solutions for this issue. Again i found about WinRT (Windows Runtime) API which are great. They actually contains api for bluetooth.
Here,
how i can reference the WinRT API libs from within VS 2015 community for C# desktop applications and which api should i use in order to programmitically control my laptop's bluetooth device powering activity that is turning on and off from my C# programs.
All replies (3)
Wednesday, October 12, 2016 4:13 AM ✅Answered
Hi KAREEM SULTHAN,
Thanks for posting there .
>>how i can reference the WinRT API libs from within VS 2015 community for C# desktop applications
If you want to add reference to WinRT API libs ,you could:
1. Go to Add Reference, and choose Browse . ***
***2.Then hit the Browse button, and select C:\ProgramFiles (x86)\WindowsKits\8.\References\CommonConfiguration\Neutral\Windows.winmd(or the 8.1 version) and click OK.
For moredetail ,you can refer to this blog:http://www.davidmoore.info/blog/2014/10/17/walkthrough-using-winrt-libraries-from-a-windows-desktop-application/
>> which api should i use in order to programmitically control my laptop's Bluetooth device powering activity that is turning on and off from my C# programs>
Microsoft has provided Bluetooth API to achieve remote control .***
***Here is the link from Windows dev Center :https://msdn.microsoft.com/en_us/library/windows/desktop/aa362930(v=vs.85).aspx
If you have anything else regarding C# grammar , please feel free to let me know.
Best regards,
Cole Wu
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
Tuesday, October 25, 2016 5:44 AM ✅Answered
Hi KAREEM,
To use WinRT library in a .NET project, you need to change the project file(.csproj) first. Steps below are for your reference.
1. Right Click your project -> Unload your project.
2. Right Click your project -> Edit .csproj file.
3. Add TargetPlatformVersion section to PropertyGroup.
<TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
4. Reload your project and right click your project ->add reference. You will see window tab on the left. Choose and add Windows.Devices library.
5. You could use Windows.Devices.Bluetooth.BluetoothDevice class in your project.
Best Regards,
Li Wang
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].
Thursday, October 13, 2016 1:54 PM
thanks for replying, i did the steps involved for referencing WinRT libs in win desktop application, and once again did it as your link specified.But, though reference happening successfully but the classes like Windows.BluetoothDevice and more are not loading. View the screenshot i've attatched. Am i missing something,