Refactoring Implementation Todo Checklist
🏗️ Application Infrastructure & Bootstrapping
Dependency Injection & Service Container
- App.InitiateServiceCollector() → App_refactor.ConfigureServices()
- Remove custom service collector initialization
- Implement standard Microsoft DI ConfigureServices method
- Verify all services are properly registered
- App.ServiceCollector static property → App_refactor._host private field
- Remove static ServiceCollector property
- Implement private IHost field
- Update all service resolution calls to use IHost
- App.ServiceCollector.BuildServiceProvider() → ModuleManager.InitializeModulesAsync()
- Remove BuildServiceProvider() calls
- Implement async module initialization
- Verify proper async/await pattern usage
Application Lifecycle Management
- App.Current_DispatcherUnhandledException → App_refactor.Current_DispatcherUnhandledException
- Move exception handler to refactored app
- Improve exception handling implementation
- Test exception scenarios
- App.CurrentDomain_UnhandledException → App_refactor.CurrentDomain_UnhandledException
- Move domain exception handler
- Integrate with new logging system
- Verify proper error reporting
- App.App_Exit() → App_refactor.App_Exit()
- Move exit handler to refactored app
- Integrate with IHost lifecycle
- Test graceful shutdown
- App.RestartApplication() → App_refactor.RestartApplication()
- Move restart logic to refactored app
- Simplify restart implementation
- Test restart scenarios
🔐 Authentication & User Management Layer
Authentication Service Implementation
- Direct access to UserInformation globals → AuthenticationService.InitializeAsync()
- Create AuthenticationService class
- Implement InitializeAsync method
- Replace all direct UserInformation access
- Test initialization flow
- App direct DB access for user info → AuthenticationService.GetCurrentUserInfoAsync()
- Move database access logic to AuthenticationService
- Implement GetCurrentUserInfoAsync method
- Remove direct DB calls from App class
- Test user info retrieval
Login & Session Management
- App.LoginNamedPipe() → App_refactor.LoginNamedPipe()
- Move named pipe login logic
- Maintain encapsulation
- Test named pipe communication
- App.ConnectManager_LogoutRequests() → App_refactor.HandleMultiLoginLogout()
- Rename and move logout handler
- Improve logout implementation
- Test multi-login scenarios
🎯 Service Layer Architecture
Core Service Interfaces
- MainWindowViewModel constants → IApiService, IContentService interfaces
- Create IApiService interface
- Create IContentService interface
- Move file extension checking logic
- Remove constants from ViewModel
- Implement service classes
Content Management Services
- MainWindowViewModel.LoadPageServer() → ContentService.GetContentAsync()
- Create ContentService class
- Implement GetContentAsync method
- Remove LoadPageServer from ViewModel
- Test content loading functionality
- MainWindowViewModel.ConvertChannelItemToFileSystemItems() → ContentService.ConvertChannelItemToFileSystemItems()
- Move conversion logic to ContentService
- Test data conversion accuracy
- MainWindowViewModel.GetFirstFile() → ContentService.GetFirstFile()
- Move file retrieval to ContentService
- Test file retrieval logic
- MainWindowViewModel.LoadDetail() → ContentService.GetDetailContentInfoAsync()
- Move detail loading to ContentService
- Implement async pattern
- Test detail content loading
Navigation Services
- Direct frame references (_frameContents) → INavigationService.MainFrame, INavigationService.OverlayFrame
- Create INavigationService interface
- Implement NavigationService class
- Move frame references to service
- Update all frame access points
- Test navigation functionality
🎮 Presentation Layer (ViewModels)
Main Window ViewModel Refactoring
- MainWindowViewModel.CreateButtonChannel() → MainWindowViewModel_Refactor.CreateChannelButtons()
- Rename and move method
- Simplify implementation
- Test channel button creation
- MainWindowViewModel.ButtonChannel_Click event handler → MainWindowViewModel_Refactor.SelectChannelCommand
- Replace event handler with ICommand
- Implement SelectChannelCommand
- Remove old event handler
- Test command execution
- MainWindowViewModel.LoadListViewFoloderPage() → MainWindowViewModel_Refactor.SelectChannel()
- Rename and simplify method
- Test channel selection
- MainWindowViewModel.ListViewCurrentChanged() → MainWindowViewModel_Refactor.ListViewItemSelected()
- Replace with command pattern
- Test item selection
Property Encapsulation
- MainWindowViewModel._channels private field → Encapsulated in ApiService
- Move channel storage to ApiService
- Remove private field from ViewModel
- Update all channel access points
- MainWindowViewModel._currentMainViewFileId → MainWindowViewModel_Refactor._currentMainViewFileId
- Improve encapsulation in refactored ViewModel
- Test file ID tracking
- MainWindowViewModel._customListviewViewModel → MainWindowViewModel_Refactor.ContentListViewModel
- Rename property for clarity
- Make public property with proper backing
- Test list view integration
- MainWindowViewModel.isSitemapShow → MainWindowViewModel_Refactor.IsSitemapShow
- Implement proper property with SetProperty
- Test property change notifications
Window Management Commands
- MainWindowViewModel.MinimizeWindowCommand → MainWindowViewModel_Refactor.MinimizeWindowCommand
- Move and simplify command
- Test minimize functionality
- MainWindowViewModel.MaximizeWindowCommand → MainWindowViewModel_Refactor.MaximizeWindowCommand
- Move and simplify command
- Test maximize functionality
- MainWindowViewModel.CloseWindowCommand → MainWindowViewModel_Refactor.CloseWindowCommand
- Move and simplify command
- Test close functionality
- MainWindowViewModel.CloseWindow() → MainWindowViewModel_Refactor.CloseWindow()
- Move and improve method
- Test window closing
🧩 Module Management System
Module Registration & Management
- App.InitiateServiceCollector() → ModuleManager.RegisterModule
() - Create ModuleManager class
- Implement RegisterModule
method - Remove module registration from App
- Test module registration
- Hardcoded MemoButton registration → ModuleExtensions.AddMemoButtonModule()
- Create ModuleExtensions class
- Implement AddMemoButtonModule extension
- Remove hardcoded registration
- Test MemoButton module loading
New Module Infrastructure
- Create IModule interface
- Define standard module interface
- Document module lifecycle
- Create MemoButtonModule adapter
- Implement IModule for MemoButton
- Test adapter functionality
- Implement ServiceCollectionExtensions.AddModule
() - Create extension method
- Simplify module registration
- Test extension method
🎨 UI Layer & Component Management
Button & UI Management
- DraggableButtonManager static instance → IDraggableButtonManager service
- Create IDraggableButtonManager interface
- Implement injectable service
- Remove static instance
- Test button management
- MainWindowViewModel._draggableToggleButtons → Managed via IDraggableButtonManager
- Move button references to service
- Remove field from ViewModel
- Test button toggling
Sitemap Management
- MainWindowViewModel.CreateSitemap() → MainWindowViewModel_Refactor.CreateSitemap()
- Move and simplify method
- Test sitemap creation
- MainWindowViewModel.SitemapDisplay() → MainWindowViewModel_Refactor.SitemapDisplay()
- Simplify to property toggle
- Test sitemap display
🔧 Supporting Infrastructure
Helper Classes & Utilities
- Create PageLoaderHelper
- Implement helper class
- Decouple page loading logic
- Test helper functionality
- Create NavigationEventArgs
- Define event arguments class
- Test with navigation events
- Create ApplicationMessages classes
- Implement messaging system classes
- Test message passing
✅ Verification & Testing
Integration Testing
- Test service dependency injection
- Verify all services resolve correctly
- Test service lifetimes
- Check for circular dependencies
- Test ViewModel-Service integration
- Verify ViewModels use services correctly
- Test async service calls
- Validate error handling
- Test module loading system
- Verify modules load in correct order
- Test module dependencies
- Validate module cleanup
Functionality Verification
- Test authentication flow
- Login process works
- User info retrieval works
- Logout process works
- Test navigation system
- Channel navigation works
- Content loading works
- Detail view works
- Test window management
- Minimize/maximize works
- Close functionality works
- Multi-window scenarios work
Performance & Cleanup
- Remove old code
- Delete unused classes
- Remove obsolete methods
- Clean up unused using statements
- Performance testing
- Compare startup time
- Test memory usage
- Validate responsiveness
📋 Final Checklist
- All original functionality preserved
- No breaking changes introduced
- Code follows new architectural patterns
- All tests pass
- Documentation updated
- Code review completed
- Performance metrics acceptable
- Ready for deployment
📝 Notes & Issues
Issues Found:
- [ ]
Additional Refactoring Needed:
- [ ]
Performance Concerns:
- [ ]
Documentation Updates Required:
- [ ]