This is Class 4 on a 6 week course I taught on Software Design Patterns.
This course goes over Command and Adapter pattern.
Class based on "Head First Design Patterns."
39. Command Manager 05/28/10 The Commands property contains a list of all possible Commands. CommandsList contains a List object internally for storing each possible Command. It also has a reference to CommandManager.
40. Command Object ExecuteHandler = delegate that represents the logic for executing the actual Command logic. Triggered when the command is executed. Gets associated with OnExecute event. UpdateHandler = delegate that represents the logic for executing the logic to update the state of a command. (For example, Edit Copy should be enabled if text has been selected). Associated with OnUpdate event.
41.
42.
43.
44. So far.. 05/28/10 Command #1 Tag = “Edit Copy” OnExecute = OnCopy OnUpdate = UpdateCopyCommand Command #2 Tag = “File Open” OnExecute = OnFileOpen OnUpdate = null
47. So far.. 05/28/10 Command #1 Tag = “Edit Copy” OnExecute = OnCopy OnUpdate = UpdateCopyCommand Two items: mnuEditCopy tlbMain.Buttons[4] All we have done so far is store information…
Note: In the RemoteControl example, each Command wrapped a Receiver object and told the Reciever to do something. In this example, the Command is given the logic externally. 13 November 2008
Possible Side Discussion on Factory? 13 November 2008