Chore: Refactor profile views into a reusable control#3537
Merged
Conversation
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors profile panels into shared UI and view-model infrastructure, preparing for profile grouping improvements in #3519.
Changes:
- Adds reusable profile panel UI and shared view-model behavior.
- Shares panel width and expansion state across tools.
- Migrates 15 profile-hosting views and removes duplicated handlers.
Reviewed changes
Copilot reviewed 48 out of 53 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
Source/NETworkManager.Profiles/IProfileHostViewModel.cs |
Defines the shared profile-host contract. |
Source/NETworkManager.Profiles/NETworkManager.Profiles.csproj |
References the controls project. |
Source/NETworkManager.Settings/ProfileViewState.cs |
Manages shared panel state. |
Source/NETworkManager.Settings/SettingsInfo.cs |
Consolidates panel settings. |
Source/NETworkManager/ViewModels/ProfileHostViewModelBase.cs |
Centralizes profile behavior. |
Source/NETworkManager/ViewModels/DNSLookupHostViewModel.cs |
Adopts the shared base. |
Source/NETworkManager/ViewModels/IPGeolocationHostViewModel.cs |
Adopts the shared base. |
Source/NETworkManager/ViewModels/IPScannerHostViewModel.cs |
Adopts the shared base. |
Source/NETworkManager/ViewModels/NetworkInterfaceViewModel.cs |
Adopts the shared base. |
Source/NETworkManager/ViewModels/PingMonitorHostViewModel.cs |
Adopts the shared base. |
Source/NETworkManager/ViewModels/PortScannerHostViewModel.cs |
Adopts the shared base. |
Source/NETworkManager/ViewModels/PowerShellHostViewModel.cs |
Adopts shared behavior with focus hooks. |
Source/NETworkManager/ViewModels/PuTTYHostViewModel.cs |
Adopts shared behavior with focus hooks. |
Source/NETworkManager/ViewModels/RemoteDesktopHostViewModel.cs |
Adopts shared profile behavior. |
Source/NETworkManager/ViewModels/SNMPHostViewModel.cs |
Adopts the shared base. |
Source/NETworkManager/ViewModels/TigerVNCHostViewModel.cs |
Adopts shared behavior. |
Source/NETworkManager/ViewModels/TracerouteHostViewModel.cs |
Adopts the shared base. |
Source/NETworkManager/ViewModels/WakeOnLANViewModel.cs |
Preserves selection behavior on the shared base. |
Source/NETworkManager/ViewModels/WebConsoleHostViewModel.cs |
Adopts shared behavior. |
Source/NETworkManager/ViewModels/WhoisHostViewModel.cs |
Adopts the shared base. |
Source/NETworkManager/Views/Controls/ProfileExpanderPanel.xaml |
Implements reusable profile UI. |
Source/NETworkManager/Views/Controls/ProfileExpanderPanel.xaml.cs |
Implements reusable panel events and properties. |
Source/NETworkManager/Views/DNSLookupHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/DNSLookupHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/IPGeolocationHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/IPGeolocationHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/IPScannerHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/IPScannerHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/NetworkInterfaceView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/NetworkInterfaceView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/PingMonitorHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/PingMonitorHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/PortScannerHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/PortScannerHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/PowerShellHostView.xaml |
Configures shared panel focus behavior. |
Source/NETworkManager/Views/PowerShellHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/PuTTYHostView.xaml |
Configures shared panel focus behavior. |
Source/NETworkManager/Views/PuTTYHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/RemoteDesktopHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/RemoteDesktopHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/SNMPHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/SNMPHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/TigerVNCHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/TigerVNCHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/TracerouteHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/TracerouteHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/WakeOnLANView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/WakeOnLANView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/WebConsoleHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/WebConsoleHostView.xaml.cs |
Removes duplicated handlers. |
Source/NETworkManager/Views/WhoisHostView.xaml |
Uses the reusable panel. |
Source/NETworkManager/Views/WhoisHostView.xaml.cs |
Removes duplicated handlers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+23
to
24
| public class RemoteDesktopHostViewModel : ProfileHostViewModelBase | ||
| { |
| /// tool-specific view. Holds all profile-panel state/commands that are identical across tools; derived | ||
| /// classes only need to describe how their tool's profiles are identified and searched. | ||
| /// </summary> | ||
| public abstract class ProfileHostViewModelBase : ViewModelBase, IProfileHostViewModel |
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.
Changes proposed in this pull request
Related issue(s)
Copilot generated summary
Provide a Copilot generated summary of the changes in this pull request.
Copilot summary
This pull request introduces a reusable profile panel control (
ProfileExpanderPanel) to unify and simplify the profile-related UI across all tool views. It adds supporting interfaces and shared state management, and removes duplicated event handler code from individual host views, centralizing profile panel logic for consistency and maintainability.Key changes include:
Introduction of reusable profile panel and supporting interfaces:
ProfileExpanderPanelcontrol, which encapsulates common profile panel UI and behavior, with dependency properties for tool-specific customization (ProfileExpanderPanel.xaml.cs).IProfileHostViewModelinterface to define the contract for view models hosting the shared profile panel, including properties and commands for profile selection, searching, filtering, and group expansion (IProfileHostViewModel.cs).NETworkManager.Controlsto enable use of shared controls in the profiles project (NETworkManager.Profiles.csproj).Centralization and sharing of profile panel state:
ProfileViewStateclass to manage the expanded/collapsed state and width of the profile panel, ensuring all tools reflect changes consistently via a shared instance (ProfileViewState.cs).Code cleanup and removal of duplication:
DNSLookupHostView.xaml.cs,IPGeolocationHostView.xaml.cs,IPScannerHostView.xaml.cs,NetworkInterfaceView.xaml.cs,PingMonitorHostView.xaml.cs,PortScannerHostView.xaml.cs,PowerShellHostView.xaml.cs,PuTTYHostView.xaml.cs). These responsibilities are now handled by the reusable profile panel. [1] [2] [3] [4] [5] [6] [7] [8] [9]These changes streamline the codebase, improve maintainability, and ensure a consistent user experience across all tools hosting profiles.
To-Do
Contributing
By submitting this pull request, I confirm the following: