Skip to content

Instantly share code, notes, and snippets.

@gdyrrahitis
Created November 10, 2018 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdyrrahitis/c01ff1b4709c0703fb9d0ae3e5ea4ccd to your computer and use it in GitHub Desktop.
Save gdyrrahitis/c01ff1b4709c0703fb9d0ae3e5ea4ccd to your computer and use it in GitHub Desktop.
// Undo button handler
private void undoButton_Click(object sender, EventArgs e)
{
// If history list (stack) contains any command
if (_commands.Any())
{
// Pop it out and undo it
var command = _commands.Pop();
command.Undo();
}
// Refresh UI (trivial operation, omitted for brevity)
RefreshWindow();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment