Esempio n. 1
0
 private void locationMenuItem_Click(object sender, EventArgs e)
 {
     using(ComposedForm form = new ComposedForm("Location name", ComposedForm.Parts.Name, ComposedForm.Parts.None)) {
         string originalName = CurrentLayer[0].tiles[tileLocation.Value.X, tileLocation.Value.Y].locationName;
         form.SetName(originalName);
         if (form.ShowDialog(this) == DialogResult.OK) {
             var undoName = string.Format("Changed location: {0} -> {1}", originalName, form.GetName());
             currentProject.Undo.DoCommand(new UndoCommandList(undoName, new UndoCommand(
                                               delegate() {
                                                   CurrentLayer[0].tiles[tileLocation.Value.X, tileLocation.Value.Y].locationName = form.GetName();
                                               },
                                               delegate() {
                                                   CurrentLayer[0].tiles[tileLocation.Value.X, tileLocation.Value.Y].locationName = originalName;
                                               }
                                           )));
         }
     }
 }