diff --git a/STranslate/MainWindow.xaml.cs b/STranslate/MainWindow.xaml.cs index 52fa5fd..e27efc0 100644 --- a/STranslate/MainWindow.xaml.cs +++ b/STranslate/MainWindow.xaml.cs @@ -142,7 +142,7 @@ namespace STranslate HotkeysHelper.InitialHook(this); HotkeysHelper.Register(HotkeysHelper.InputTranslateId, () => { - InputTranslateMenuItem_Click(null, null); + vm.InputTranslate(); }); HotkeysHelper.Register(HotkeysHelper.CrosswordTranslateId, () => diff --git a/STranslate/ViewModel/MainVM.cs b/STranslate/ViewModel/MainVM.cs index e5c5653..9c15890 100644 --- a/STranslate/ViewModel/MainVM.cs +++ b/STranslate/ViewModel/MainVM.cs @@ -38,8 +38,7 @@ namespace STranslate.ViewModel //输入翻译 InputTranslateCmd = new RelayCommand((_) => true, (_) => { - ClearAll(); - OpenMainWin(); + InputTranslate(); }); //显示主界面 @@ -138,12 +137,21 @@ namespace STranslate.ViewModel /// /// 打开主窗口 /// - private void OpenMainWin() + public void OpenMainWin() { mainwin.Show(); mainwin.Activate(); //TODO: add textbox focus } + public void InputTranslate() + { + ClearAll(); + OpenMainWin(); + } + public void CrossWordTranslate() + { + + } /// /// 初始化配置文件