Skip to content

Implement battery percentage detection for laptop users,  #2921

Closed as not planned
@Samdasti

Description

@Samdasti

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();
}
".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions