private void DrawCanvas_Paint(object sender, PaintEventArgs e) { if (history != null) { history.Execute(); } }
static void Main(string[] args) { var commands = new List <ICommand>(); commands.Add(new NullCommand()); commands.Add(new WriteCommand()); var com = new MacroCommand(commands); com.Execute(); Console.ReadKey(); }
static void Main(string[] args) { List <Command> commands = new List <Command>(); commands.Add(new PasteCommand()); commands.Add(new DrawCommand()); Command macro = new MacroCommand(commands); macro.Execute(); Console.ReadLine(); }
static void Main(string[] args) { Document document = new Document("doc1"); Document document2 = new Document("doc2"); Application app = new Application(); app.Add(document); app.Add(document2); Command com = new OpenCommand(app); com.Execute(); Command com2 = new PasteCommand(document2); com2.Execute(); MacroCommand coms = new MacroCommand(); coms.Add(com); coms.Add(com2); coms.Execute(); }