CosmosOS / Cosmos

Cosmos is an operating system "construction kit". Build your own OS using managed languages such as C#, VB.NET, and more!
https://www.goCosmos.org
BSD 3-Clause "New" or "Revised" License
2.94k stars 552 forks source link

Implement battery percentage detection for laptop users, #2921

Closed Samdasti closed 10 months ago

Samdasti commented 10 months ago

Add this new function - Cosmos.System.Power.GetBatteryPercentage(); - Returns the value of how many percent the battery is, this function only works for laptop users, if the user is running a desktop, it does nothing, this function can be used in an if statement to do something if the battery percentage is of a certain level, for example: "if (Cosmos.System.Power.GetBatteryPercentage(); == 0) { Console.WriteLine("Battery has run out, shutting down..."); System.Threading.Thread.Sleep(1); Cosmos.System.Power.Shutdown(); } ".

9xbt commented 10 months ago

Duplicate of https://github.com/CosmosOS/Cosmos/issues/2503