-
-
Save gdyrrahitis/9d3b40f745fc53516da6bf526b9e58b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class MainForm : Form | |
{ | |
// Code omitted for brevity | |
// The history list | |
private Stack<ICommand> _commands = new Stack<ICommand>(); | |
// Code omitted for brevity | |
// Draws the shape on canvas | |
private void canvas_MouseDown(object sender, MouseEventArgs e) | |
{ | |
// We get the command based on the shape selection | |
// and we draw it in the X, Y coordinates | |
var command = GetCommand(e.X, e.Y); | |
command.Draw(); | |
// We store the command in the history list | |
_commands.Push(command); | |
// Refresh the UI (trivial code, omitted for brevity) | |
RefreshWindow(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment