private void newScriptClicked(object sender, RoutedEventArgs e)
{
string baseName = "New function";
string scriptName = baseName;
int i = 2;
while (Personality.Scripts.ContainsKey(scriptName))
{
scriptName = baseName + " " + i++;
}
Script script = new Script(scriptName, null, false, null);
Personality.Scripts.Add(script.Name, script);
// Now fire up an edit
EditScriptWindow editScriptWindow = new EditScriptWindow(Personality.Scripts, script.Name);
if (editScriptWindow.ShowDialog() == true)
{
Personality.ToFile();
EDDI.Instance.Reload("Speech responder");
}
else
{
Personality.Scripts.Remove(script.Name);
}
scriptsData.Items.Refresh();
}