diff --git a/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml b/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml index b9de1ead..b6f79190 100644 --- a/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml +++ b/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml @@ -16,7 +16,7 @@ - + diff --git a/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml.cs b/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml.cs index 9a62a3a7..acdccc2d 100644 --- a/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml.cs +++ b/MisakaTranslator-WPF/SettingsPages/TranslatorPages/TranslatorGeneralSettingsPage.xaml.cs @@ -36,6 +36,8 @@ public TranslatorGeneralSettingsPage() EachRowTransCheckBox.IsChecked = Convert.ToBoolean(Common.appSettings.EachRowTrans); TransLimitBox.Value = Common.appSettings.TransLimitNums; + // 给TransLimitBox添加Minimum后,初始化它时就会触发一次ValueChanged,导致Settings被设为1,因此只能从设置中读取数据后再添加事件处理函数 + TransLimitBox.ValueChanged += TransLimitBox_ValueChanged; } private void FirstTransCombox_SelectionChanged(object sender, SelectionChangedEventArgs e) @@ -51,11 +53,11 @@ private void SecondTransCombox_SelectionChanged(object sender, SelectionChangedE private void EachRowTransCheckBox_Click(object sender, RoutedEventArgs e) { Common.appSettings.EachRowTrans = Convert.ToString(EachRowTransCheckBox.IsChecked); - } - - private void TransLimitBox_ValueChanged(object sender, HandyControl.Data.FunctionEventArgs e) - { - Common.appSettings.TransLimitNums = (int)TransLimitBox.Value; - } + } + + private void TransLimitBox_ValueChanged(object sender, HandyControl.Data.FunctionEventArgs e) + { + Common.appSettings.TransLimitNums = (int)TransLimitBox.Value; + } } } \ No newline at end of file