WPF app中的信号强度 [英] Signal strength in WPF app
问题描述
嗨Rob, 我一直在寻找这样的答案,但我需要在WPF桌面应用中检查电池强度,而不是UWP, 用C#usinf VS2017开发。 你知道我在哪里可以找到解决方案吗?
Hi Rob, I've been looking for an answer like this but instead of UWP I need to check battery strength in a WPF desktop app, developed in C# usinf VS2017. Do you know where I can find a solution?
实际上我发现了一些VMI(system.management)提议,但是在调试时我得到了一个"不相容"错误信息。
Actually I found some VMI (system.management) proposals, however when debugging I get a "Incompatible" error message.
提前致谢, Jorge。
Thanks in advance, Jorge.
推荐答案
WPF论坛中的人们将能够更好地回答WPF中的最佳实践。
The folks in the WPF forum will be better able to answer about best practices in WPF.
那就是说,WinRT ConnectionProfile。 GetSignalBars
|可以从桌面应用程序上下文调用getSignalBars方法 ,因此您可以在当前版本的Windows 10上从WPF应用程序调用它.Scott Hanselman有一个博客条目,其中介绍了如何在https上执行此操作://www.hanselman.com/blog/HowToCallWinRTAPIsInWindows8FromCDesktopApplicationsWinRTDiagram.aspx
。它已经过时了,但是一旦将它们更新为目标Windows 10而不是Windows 8,基本概念应该适用。
That said, the WinRT ConnectionProfile.GetSignalBars | getSignalBars method can be called from desktop apps contexts, so you could call it from a WPF app on current versions of Windows 10. Scott Hanselman has a blog entry that goes over how to do this at https://www.hanselman.com/blog/HowToCallWinRTAPIsInWindows8FromCDesktopApplicationsWinRTDiagram.aspx . It's old, but the basic concepts should apply once you update them to target Windows 10 rather than Windows 8.
这篇关于WPF app中的信号强度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!