wpf refactoring