alterNERDtive-base: fixed settings dialog closing prematurely

This commit is contained in:
alterNERDtive 2022-05-18 13:55:35 +02:00
parent 8a3b17d674
commit e81f3961ea

View file

@ -94,6 +94,8 @@ namespace alterNERDtive
private void okButton_Click(object sender, RoutedEventArgs reargs)
{
bool error = false;
foreach (Setting setting in values)
{
dynamic state = null;
@ -130,14 +132,18 @@ namespace alterNERDtive
log.Log($@"Configuration changed via settings dialog: ""{setting.Profile}.{setting.Option.Name}"" → ""{state}""", util.LogLevel.DEBUG);
config.SetConfig(setting.Profile, setting.Option.Name, state);
}
Window.GetWindow(this).Close();
}
catch (Exception e) when (e is ArgumentNullException || e is FormatException || e is OverflowException)
{
log.Log($@"Invalid value for ""{setting.Profile}.{setting.Option.Name}"": ""{((TextBox)setting.UiElement).Text}""", util.LogLevel.ERROR);
error = true;
}
}
if (!error)
{
Window.GetWindow(this).Close();
}
}
}
}