private void TextBoxAutotileButtonClick(object sender, EventArgs e)
{
var textBoxButton = sender as TextBoxButton;
if (textBoxButton == null) return;
var index = Convert.ToInt32(textBoxButton.Tag);
string tile = this._tileset.autotile_names[index];
using (var dialog = new ImageSelectionForm(@"Autotiles", tile))
{
if (dialog.ShowDialog(this) != DialogResult.OK) return;
var name = dialog.ImageName;
this._tileset.autotile_names[index] = name;
textBoxButton.Text = String.IsNullOrWhiteSpace(name) ? "<None>" : name;
this.tilesetXnaPanel.Invalidate();
}
}