Skip to content

[Code Quality] Manager ViewModels — SearchServicesAsync duplicated across ConsoleViewModel, PerformanceViewModel, DependenciesViewModel #632

@Christophe-Rogiers

Description

@Christophe-Rogiers

Severity: Warning

Files:

  • src/Servy.Manager/ViewModels/ConsoleViewModel.cs lines 572–614
  • src/Servy.Manager/ViewModels/PerformanceViewModel.cs lines 448–493
  • src/Servy.Manager/ViewModels/DependenciesViewModel.cs lines 341–380

Description:
All three SearchServicesAsync implementations follow the same 50-line pattern: cancel CTS, set cursor/busy/button text, optionally yield to dispatcher, call ServiceCommands.SearchServicesAsync(), fill Services collection, restore cursor/busy/button in finally. The only difference is the model type populated (ConsoleService vs PerformanceService vs DependencyService).

Suggested fix:
Extract to a shared base class with a factory method for creating the service item from a search result.

Metadata

Metadata

Assignees

Labels

refactorChanges that improve structure, readability, or maintainability without altering external behavior

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions