private void OK_Click(object sender, RoutedEventArgs e)
 {
     if (name.Text == "")
     {
         TextBox t = new TextBox();
         errorDialog = new PromptDialog("Error", ModernWindow.GetWindow(this));
         errorDialog.AddColoredHeader("Invalid Name");
         errorDialog.AddTextBlock("Please enter a valid name.");
         errorDialog.ShowDialog();
         if (errorDialog.DialogResult == true && t.Text != "")
         {
             a.name = t.Text;
         }
         else
         {
             errorDialog.ShowDialog();
         }
         return;
     }
     SaveAll();
     ItemEditor.UpdateItemNameAt(ItemEditor.index);
     if (ApplicationSettings.instance.autoSave)
     {
         Utils.SaveToFile(ItemEditor.kv_list, ApplicationSettings.instance.currentModPath + "\\scripts\\npc\\" + ItemEditor.file, rootKey);
     }
     this.Close();
 }