fix: refresh monitor handles when app window is shown - #28
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
ChangesMonitor refresh lifecycle
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant AppWindow
participant MainWindow
participant MainPage
AppWindow->>MainWindow: DidVisibilityChange
MainWindow->>MainPage: RefreshMonitors()
MainPage->>MainPage: Restore selected monitor or choose primary
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)✅ Unit Test PR creation complete.
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@MainPage.xaml.cs`:
- Around line 27-34: Update MonitorInfo to expose a stable monitor/device
identifier derived from MONITORINFOEX.DeviceName, then change the selection
preservation logic in MainPage to capture and compare that identifier instead of
Name. Keep the existing primary-monitor fallback for cases where no matching
device is found.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 317c68ba-f23d-4142-9385-4b349929e2aa
📒 Files selected for processing (2)
MainPage.xaml.csMainWindow.xaml.cs
|
Note Unit test generation is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Models/MonitorInfo.cs (1)
9-9: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winClarify whether this is a device ID or a display name.
Services/MonitorService.cs:28assignsmi.DeviceNameto this property. If that logical display name is intentional, rename the property toDeviceName; otherwise populateDeviceIdwith the actual device-interface identifier.As per coding guidelines, use meaningful names.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Models/MonitorInfo.cs` at line 9, Resolve the naming mismatch between MonitorInfo.DeviceId and the mi.DeviceName assignment in MonitorService by either renaming the property to DeviceName when it represents the display name, or updating the assignment to use the actual device-interface identifier. Keep the property name and assigned value semantically consistent throughout the affected model and service.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Models/MonitorInfo.cs`:
- Line 9: Resolve the naming mismatch between MonitorInfo.DeviceId and the
mi.DeviceName assignment in MonitorService by either renaming the property to
DeviceName when it represents the display name, or updating the assignment to
use the actual device-interface identifier. Keep the property name and assigned
value semantically consistent throughout the affected model and service.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 60f9b845-7c49-4df9-b96f-330cfd9c0c9a
📒 Files selected for processing (3)
MainPage.xaml.csModels/MonitorInfo.csServices/MonitorService.cs
🚧 Files skipped from review as they are similar to previous changes (1)
- MainPage.xaml.cs
|
✅ Created PR with unit tests: #29 |
Fixes an issue where stale monitor handles after a sleep cycle caused the fallback WMI brightness adjustment to affect the built-in laptop screen instead of the selected external display.
Summary by CodeRabbit