From ec7f7185b163122ab1995c688ccb37d338b9ece8 Mon Sep 17 00:00:00 2001 From: "DESKTOP-3BO4HSG\\ksat" Date: Fri, 6 Jan 2023 18:26:13 +0800 Subject: [PATCH] perf: update translate with lang switched --- STranslate/MainWindow.xaml | 2 ++ STranslate/MainWindow.xaml.cs | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/STranslate/MainWindow.xaml b/STranslate/MainWindow.xaml index 065b189..8164fdf 100644 --- a/STranslate/MainWindow.xaml +++ b/STranslate/MainWindow.xaml @@ -102,6 +102,7 @@ diff --git a/STranslate/MainWindow.xaml.cs b/STranslate/MainWindow.xaml.cs index ebefbb2..95d1c47 100644 --- a/STranslate/MainWindow.xaml.cs +++ b/STranslate/MainWindow.xaml.cs @@ -301,5 +301,14 @@ namespace STranslate private bool _IsTopmost { get; set; } private readonly string _TopmostTemplateName = "ButtonTemplateTopmost"; private readonly string _UnTopmostTemplateName = "ButtonTemplateUnTopmost"; + + 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