Add remarks and examples to Microsoft.Windows.System.Power API docs#124
Draft
GrantMeStrength wants to merge 3 commits into
Draft
Add remarks and examples to Microsoft.Windows.System.Power API docs#124GrantMeStrength wants to merge 3 commits into
GrantMeStrength wants to merge 3 commits into
Conversation
Fill empty remarks sections for 12 files across the PowerManager namespace: - Namespace overview: usage guidance and common scenarios - PowerManager class: full remarks with C# code example showing battery check, event subscription, and energy saver handling - 6 property files: BatteryStatus, EffectivePowerMode, EffectivePowerMode2, PowerSupplyStatus, RemainingDischargeTime, SystemSuspendStatus - 4 enum files: BatteryStatus, EffectivePowerMode, PowerSupplyStatus, SystemSuspendStatus Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR enhances the API reference documentation for Microsoft.Windows.System.Power by adding practical remarks and a C# example to help developers correctly interpret power-related properties/events and related enums.
Changes:
- Expanded remarks across the namespace overview, PowerManager class, several PowerManager properties, and multiple enums to provide usage guidance and cross-references.
- Added a C# example to PowerManager showing power source checks and event subscriptions.
- Added contextual explanations for enum values (for example, EffectivePowerMode, PowerSupplyStatus, SystemSuspendStatus, BatteryStatus).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| microsoft.windows.system.power/microsoft_windows_system_power.md | Adds namespace-level usage guidance and common scenarios. |
| microsoft.windows.system.power/powermanager.md | Adds static-class guidance, packaged/unpackaged note, and a C# usage example. |
| microsoft.windows.system.power/powermanager_batterystatus.md | Adds remarks describing how to interpret BatteryStatus and subscribe to changes. |
| microsoft.windows.system.power/powermanager_effectivepowermode.md | Adds remarks describing EffectivePowerMode usage and a sync alternative. |
| microsoft.windows.system.power/powermanager_effectivepowermode2.md | Adds remarks describing the synchronous EffectivePowerMode2 property and event subscription. |
| microsoft.windows.system.power/powermanager_powersupplystatus.md | Adds remarks describing PowerSupplyStatus and subscribing to changes. |
| microsoft.windows.system.power/powermanager_remainingdischargetime.md | Adds remarks describing RemainingDischargeTime meaning and relevant event. |
| microsoft.windows.system.power/powermanager_systemsuspendstatus.md | Adds remarks on using SystemSuspendStatus with its event for suspend/resume handling. |
| microsoft.windows.system.power/batterystatus.md | Adds enum remarks to interpret BatteryStatus values. |
| microsoft.windows.system.power/effectivepowermode.md | Adds enum remarks explaining EffectivePowerMode usage and intended interpretation. |
| microsoft.windows.system.power/powersupplystatus.md | Adds enum remarks to interpret PowerSupplyStatus values. |
| microsoft.windows.system.power/systemsuspendstatus.md | Adds enum remarks explaining SystemSuspendStatus and resume distinctions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Namespace overview: clarify enums exist alongside PowerManager class - PowerManager: remove unverified packaged/unpackaged claim - EffectivePowerMode enum: remove power-consumption ordering assertion - SystemSuspendStatus enum: remove specific wake trigger examples - PowerSupplyStatus enum + property: remove USB charger scenario Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- PowerManager: soften Win32 GUID wrapping claim to 'several correspond to' - BatteryStatus: fix Idle definition to 'neither charging nor discharging' - EffectivePowerMode property: use code formatting for enum values, not links - EffectivePowerMode2: clarify relationship to async EffectivePowerMode Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Questions for SME reviewers
The following questions came up during authoring. Accurate answers would directly improve the docs — and are especially important for AI coding assistants (e.g. GitHub Copilot) that use API reference to generate code.
PowerManager properties
RemainingDischargeTimereturn when the device is plugged in?TimeSpan.Zero?TimeSpan.MaxValue? Should we document the behavior?RemainingChargePercentreturn on a desktop PC with no battery? 0? -1? Should we document the no-battery case?EffectivePowerMode(async) deprecated in favor ofEffectivePowerMode2(sync)? Should we guide developers toward one?Events
Enums
Idlespecifically "fully charged and on AC" or can it also mean "on battery but not discharging" (e.g., conservation mode)?AutoResumevsManualResume? Wake timers? Network wake? Power button?General
Summary
Adds remarks to 12 files in
Microsoft.Windows.System.Power(namespace overview, PowerManager class, 6 properties, 4 enums). Adds a C# code example to the PowerManager class showing battery status checks and event subscriptions.Changes
microsoft_windows_system_power.md): Usage guidance and common scenariospowermanager.md): Static class guidance, packaged/unpackaged note, full C# example with battery check + event subscription + energy saver handlingMotivation
OGF quality scan identified 22/32 files in this namespace with empty or minimal remarks. This PR fills the highest-impact gaps. All claims are derived from the API signatures, enum field descriptions, and existing remarks in sibling files — no unverifiable claims.