如何获取 .NET CF 3.5 中的当前电池电量?

发布于 2024-07-16 15:03:30 字数 72 浏览 5 评论 0原文

如何(或者最好的方法是什么)在 Windows Mobile 5 和 6 上的 .NET CF 3.5 中检索设备的当前电池电量?

How - or what's the best way - to retrieve the device's current battery level in .NET CF 3.5 on Windows Mobile 5 and 6?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

策马西风 2024-07-23 15:03:31

我认为您想要使用 Microsoft.WindowsMo​​bile.Status 名称(特别是 SystemState 类。

using Microsoft.WindowsMobile.Status;

...

BatteryLevel batteryLevel = SystemState.PowerBatteryStrength;
BatteryState batteryState = SystemState.PowerBatteryState;

请参阅 这篇文章获取完整的代码示例。

I think you want to use the Microsoft.WindowsMobile.Status namepsace (specifically the SystemState class.

using Microsoft.WindowsMobile.Status;

...

BatteryLevel batteryLevel = SystemState.PowerBatteryStrength;
BatteryState batteryState = SystemState.PowerBatteryState;

See this post for the full code sample.

冷夜 2024-07-23 15:03:31

您可能需要 Nordorin 推荐的 State Notation Broker 类。 我认为它不会为您提供非常精细的信息。 您会得到诸如“低”或“非常低”之类的信息。 如果您需要特定百分比,请考虑使用 GetSystemPowerStatusEx。

如何:获取设备电源状态
GetSystemPowerStatusEx

You probably want the State Notification Broker class that Noldorin is recommending. I don't think it gives you very fine grain information. You get information like Low or Very Low. If you need specific percentages consider using GetSystemPowerStatusEx.

HOWTO: Get the Device Power Status
GetSystemPowerStatusEx

自控 2024-07-23 15:03:31

要添加到 CJ 的响应中,您可以找到如何从 http 获取详细电池信息的代码示例://www.codeproject.com/kb/mobile/Wimopower1.aspx。 这些信息包括电池的电量、温度、是否正在充电或正在放电以及消耗的电流量。

示例输出 http: //j2i.net/resized-image.ashx/__size/800x0/__key/CommunityServer.Blogs.Components.WeblogFiles/home/powerMeter.png

To add to CJ's response you can find a code example of how to get detailed battery information from http://www.codeproject.com/kb/mobile/Wimopower1.aspx . This information includes the batter's power level, temperature, whether it is charging or draining, and the amount of current being drawn.

Example Output http://j2i.net/resized-image.ashx/__size/800x0/__key/CommunityServer.Blogs.Components.WeblogFiles/home/powerMeter.png

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文