namespace DelftTools.Controls { /// /// Linking command to button. Using the Command Pattern in Windows Forms clients. /// /// /// This example demonstrates how to create a Button, hook it up to a Command with a minimum of code and let the power of data binding deal with turning the command on and off: /// /// Button button = new Button(); /// Command command = new ArbitraryCommand("My Data"); /// button.DataBindings.Add("Text", command, "DisplayName"); /// button.DataBindings.Add("Enabled", command, "Enabled"); /// button.Click += delegate { command.Execute(); }; /// /// public abstract class Command : ICommand { public abstract bool Enabled { get; } public virtual bool Checked { set; get; } public void Execute(params object[] arguments) { OnExecute(arguments); } protected abstract void OnExecute(params object[] arguments); } }