@@ -131,15 +131,6 @@ private void TemplateListBox_SelectionChanged(object sender, SelectionChangedEve
131131 PathBox . Text = Path . Combine ( PathStr , templateInfo . NewName ) ;
132132 }
133133
134- private void Button_Click ( object sender , RoutedEventArgs e )
135- {
136- var destFile = new FileInfo ( PathBox . Text ) ;
137- var templateInfo = TemplateDictionary [ ( string ) TemplateListBox . SelectedItem ] ;
138- File . Copy ( templateInfo . Path , destFile . FullName , true ) ;
139- Program . MainWindow . TryLoadSourceFile ( destFile . FullName , true , true , true ) ;
140- Close ( ) ;
141- }
142-
143134 private void Language_Translate ( )
144135 {
145136 if ( Program . Translations . IsDefault )
@@ -172,6 +163,33 @@ public void Execute(object parameter)
172163 ExecuteAction ? . Invoke ( parameter ) ;
173164 }
174165 }
166+
167+ private void Button_Click ( object sender , RoutedEventArgs e )
168+ {
169+ GoToSelectedTemplate ( ) ;
170+ }
171+
172+ private void TemplateListBox_MouseDoubleClick ( object sender , MouseButtonEventArgs e )
173+ {
174+ GoToSelectedTemplate ( ) ;
175+ }
176+
177+ private void TemplateListBox_KeyDown ( object sender , KeyEventArgs e )
178+ {
179+ if ( e . Key == Key . Enter )
180+ {
181+ GoToSelectedTemplate ( ) ;
182+ }
183+ }
184+
185+ private void GoToSelectedTemplate ( )
186+ {
187+ var destFile = new FileInfo ( PathBox . Text ) ;
188+ var templateInfo = TemplateDictionary [ ( string ) TemplateListBox . SelectedItem ] ;
189+ File . Copy ( templateInfo . Path , destFile . FullName , true ) ;
190+ Program . MainWindow . TryLoadSourceFile ( destFile . FullName , true , true , true ) ;
191+ Close ( ) ;
192+ }
175193 }
176194
177195 public class TemplateInfo
0 commit comments