private void acceptButtonClick(object sender, RoutedEventArgs e)
{
// Update the script
string newScriptText = string.IsNullOrWhiteSpace(scriptView.Text) ? null : scriptView.Text;
if (_script != null)
{
Script newScript = new Script(scriptName,
scriptDescription,
_script?.Responder ?? false,
newScriptText,
Priority,
_script.defaultValue);
_script = newScript;
}
Script defaultScript = null;
if (Personality.Default().Scripts?.TryGetValue(_script.Name, out defaultScript) ?? false)
{
_script = Personality.UpgradeScript(_script, defaultScript);
}
// Might be updating an existing script so remove it from the list before adding
_scripts.Remove(originalName);
_scripts.Add(_script.Name, _script);
DialogResult = true;
this.Close();
}