LoginSignup
0

More than 5 years have passed since last update.

C#のBatteryChargeStatesで悩んだ話

Posted at

電源状態取得してた

C#のSystemInformation.PowerStates.BatteryChargeStates使ってバッテリーの残量取得してたらある一定範囲の残量で取得できてなかったように見えた

分析

どうやら33%から66%の時に取得できてない?

結果

BatteryChargeStates.LowとBatteryChargeStates.Highの間にはそもそもプロパティがなかった
→switchで分岐してたのでdefaultに追加することで対応

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0