diff --git a/STranslate/MainWindow.xaml b/STranslate/MainWindow.xaml index 0830d48..bae4211 100644 --- a/STranslate/MainWindow.xaml +++ b/STranslate/MainWindow.xaml @@ -1,11 +1,12 @@ - + SelectedItem="{Binding InputComboSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> + + + + + + + SelectedItem="{Binding OutputComboSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> + + + + + + diff --git a/STranslate/MainWindow.xaml.cs b/STranslate/MainWindow.xaml.cs index d821fb3..335c9ed 100644 --- a/STranslate/MainWindow.xaml.cs +++ b/STranslate/MainWindow.xaml.cs @@ -80,14 +80,5 @@ namespace STranslate this.Hide(); } } - - private void SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) - { - if (!string.IsNullOrEmpty(vm?.InputTxt)) - { - vm.IdentifyLanguage = string.Empty; - _ = vm?.Translate(); - } - } } } \ No newline at end of file diff --git a/STranslate/STranslate.csproj b/STranslate/STranslate.csproj index ea67377..27bda36 100644 --- a/STranslate/STranslate.csproj +++ b/STranslate/STranslate.csproj @@ -59,6 +59,9 @@ ..\packages\Hardcodet.NotifyIcon.Wpf.1.1.0\lib\net472\Hardcodet.NotifyIcon.Wpf.dll + + ..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll + ..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll @@ -68,6 +71,9 @@ + + ..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\System.Windows.Interactivity.dll + @@ -200,6 +206,5 @@ True - \ No newline at end of file diff --git a/STranslate/ViewModel/MainVM.cs b/STranslate/ViewModel/MainVM.cs index e0ba273..98b3a5c 100644 --- a/STranslate/ViewModel/MainVM.cs +++ b/STranslate/ViewModel/MainVM.cs @@ -92,6 +92,16 @@ namespace STranslate.ViewModel } }); + //切换语言 + SelectLangChangedCmd = new RelayCommand((_) => true, (_) => + { + if (!string.IsNullOrEmpty(InputTxt)) + { + IdentifyLanguage = string.Empty; + _ = Translate(); + } + }); + #endregion #region Common @@ -376,6 +386,7 @@ namespace STranslate.ViewModel public ICommand ExitCmd { get; private set; } public ICommand TopmostCmd { get; private set; } public ICommand EscCmd { get; private set; } + public ICommand SelectLangChangedCmd { get; private set; } /// /// 是否开机自启 diff --git a/STranslate/packages.config b/STranslate/packages.config index e670037..48285a0 100644 --- a/STranslate/packages.config +++ b/STranslate/packages.config @@ -2,4 +2,5 @@ + \ No newline at end of file