Code cleanup and optimization of video controller information retrieval and UI handling. - #140
Merged
Merged
Conversation
Refactored video controller (GPU) data retrieval to fetch all details in a single call, replacing per-DeviceID queries. Updated ViewModel to store controller info as a list of dictionaries and adjusted UI binding and ComboBox logic to match. Improved helper methods for null handling and localization, and added new resource strings for "Unknown" and "billion". Enhanced layout and resource usage for better maintainability and localization support.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the graphics/video controller data pipeline so the app retrieves all video controller information in one WMI query, then updates the ViewModel/UI to consume that unified dataset and adds a new localization string used for missing adapter names.
Changes:
- Replaced per-controller WMI queries with a single
GetAllVideoControllers()method and improved null-handling/localized fallback strings inVideoHelpers. - Updated
VideoViewModelto store all controller dictionaries, generate a controller display list from them, and select controllers by index. - Tweaked the video adapter selector layout and added
GraphicsInfo_Unknownto the en-US resource dictionary (with changelog entry).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| TimVer/Helpers/VideoHelpers.cs | Consolidates WMI querying into a single controller enumeration and formats controller fields for display. |
| TimVer/ViewModels/VideoViewModel.cs | Switches the ViewModel to consume the consolidated controller list and improves selection bounds checks. |
| TimVer/Views/VideoPage.xaml | Minor spacing/alignment update for the adapter selection UI. |
| TimVer/Languages/Strings.en-US.xaml | Adds GraphicsInfo_Unknown and updates the localization changelog. |
| TimVer/TimVer.csproj | Bumps app version and sets prerelease identifier. |
Comment on lines
+20
to
24
| AllControllers = VideoHelpers.GetAllVideoControllers(); | ||
| ControllerList = [.. AllControllers.Select(c => | ||
| c.GetValueOrDefault( GetStringResource("GraphicsInfo_GraphicsAdapter"), GetStringResource("GraphicsInfo_Unknown")))]; | ||
| VideoInfoCollection = AllControllers.FirstOrDefault(); | ||
| } |
Comment on lines
132
to
136
| #pragma warning disable RCS1213 // Remove unused member declaration | ||
| // Leaving this method in place for now as I may add it back in the future. It is currently commented out in the GetVideoInfo method. | ||
| // Leaving this method in place for now as I may add it back in the future. It is currently commented out in the GetAllVideoControllers method. | ||
| private static string FormatAdapterRamInfo(CimInstance instance) | ||
| #pragma warning restore RCS1213 // Remove unused member declaration | ||
| { |
Comment on lines
185
to
189
| @@ -197,21 +188,8 @@ private static string FormatColorsInfo(CimInstance instance) | |||
| return GetStringResource("MsgText_NotAvailable"); | |||
| } | |||
| <sys:String x:Key="GraphicsInfo_SelectAdapter">Select Adapter</sys:String> | ||
| <sys:String x:Key="GraphicsInfo_SelectAdapterToolTipLine1">If there is more than one video adapter installed</sys:String> | ||
| <sys:String x:Key="GraphicsInfo_SelectAdapterToolTipLine2">use the drop-down to select the adapter to display.</sys:String> | ||
| <sys:String x:Key="GraphicsInfo_Unknown">Unknown</sys:String> |
1 task
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.
Refactored video controller data retrieval to eliminate mismatched data, improve efficiency and updated related UI and localization.
GetAllVideoControllersmethod, improved null safety, and returned localized "Not Available" strings.GraphicsInfo_Unknownresource and updated localization change logs.