From a368b5f2b0d03e744d183264649dcc5082a8cceb Mon Sep 17 00:00:00 2001 From: imba-tjd <109224573@qq.com> Date: Tue, 14 Feb 2023 10:48:12 +0800 Subject: [PATCH] =?UTF-8?q?HttpProxyBox:=20=E9=AA=8C=E8=AF=81=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TranslatorPages/TranslatorGeneralSettingsPage.xaml | 2 +- .../TranslatorPages/TranslatorGeneralSettingsPage.xaml.cs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml b/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml index 476273e1..34e81af2 100644 --- a/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml +++ b/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml @@ -15,7 +15,7 @@ - + diff --git a/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml.cs b/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml.cs index 7d635c6d..3779041b 100644 --- a/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml.cs +++ b/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml.cs @@ -56,9 +56,12 @@ private void EachRowTransCheckBox_Click(object sender, RoutedEventArgs e) Common.appSettings.EachRowTrans = EachRowTransCheckBox.IsChecked ?? false; } - private void HttpProxyBox_TextChanged(object sender, TextChangedEventArgs e) + private void HttpProxyBox_LostFocus(object sender, RoutedEventArgs e) { - Common.appSettings.HttpProxy = HttpProxyBox.Text; + string text = HttpProxyBox.Text.Trim(); + try { new Uri(text); } + catch (UriFormatException) { HandyControl.Controls.Growl.Error("Proxy url unsupported."); return; }; + Common.appSettings.HttpProxy = text; } private void TransLimitBox_ValueChanged(object sender, HandyControl.Data.FunctionEventArgs e)