I have a MustInherit class called wCommand. It's basically a class that represents a command of any type. I've made (or will make) several subclasses, like wRenameFile, wDeleteFile, wRunProgram, wOpenWebPage, wRetrieveText, etc.
The problem is that each command takes different arguments.
As an example, taking a look at the screenshot. If I selected 'Open Web Page' from the drop down, here is what would happen:
The problem is that each command takes different arguments.
- You can see the arguments 'Rename File(s)' would take from the screenshot.
- 'Delete File(s)' would need the name of the file, its folder, and whether to delete everything in the folder that matches.
- 'Open Web Page' would just require a URL.
- Run program would need to know the path of the executable and its window state (minimized/maximized/hidden) ...
As an example, taking a look at the screenshot. If I selected 'Open Web Page' from the drop down, here is what would happen:
- The controls from wRenameFile would be unloaded
- The controls stored in wOpenWebPage (probably something like txtURL) would be loaded onto the form.
- When the create command button is pushed, wOpenWebPage would read all the information from its controls and create a new instance of wOpenWebPage.
- At this point, if .PerformCommand is called on this instance, it has the command already stored, so it knows what to do and does it. (Maybe you'd have a wCommand called OpenGoogle that launches www.google.com in Internet Explorer)