private void deleteScript(object sender, RoutedEventArgs e)
{
Script script = ((KeyValuePair<string, Script>)((Button)e.Source).DataContext).Value;
string messageBoxText = "Are you sure you want to delete the \"" + script.Name + "\" script?";
string caption = "Delete Script";
MessageBoxResult result = MessageBox.Show(messageBoxText, caption, MessageBoxButton.YesNo, MessageBoxImage.Warning);
switch (result)
{
case MessageBoxResult.Yes:
// Remove the script from the list
Personality.Scripts.Remove(script.Name);
Personality.ToFile();
EDDI.Instance.Reload("Speech responder");
// We updated a property of the personality but not the personality itself so need to manually update items
scriptsData.Items.Refresh();
break;
}
}