Class ShellCommand
See also AsyncShellCommand if you need an asynchronous shell command.
public class ShellCommand : ICommand
- Inheritance
-
ShellCommand
- Implements
- Derived
- Inherited Members
Constructors
ShellCommand(ISurface, Action, Func<bool>, Action<EventHandler>)
public ShellCommand(ISurface surface, Action execute, Func<bool> canExecute = null, Action<EventHandler> subscribe = null)
Parameters
surfaceISurfaceUI element which should handle errors.
executeActionAction to run when command is invoked.
canExecuteFunc<bool>Optional. Synchronous enablement test.
subscribeAction<EventHandler>Optional. An Action<T> to use to subscribe to an event. The subscription will be stored in case the event uses the weak event pattern. When the event is raised, CanExecuteChanged will be raised. If null, no subscription will take place.
ShellCommand(ISurface, Action<object>, Func<object, bool>, Action<EventHandler>)
public ShellCommand(ISurface surface, Action<object> execute, Func<object, bool> canExecute = null, Action<EventHandler> subscribe = null)
Parameters
surfaceISurfaceUI element which should handle errors.
executeAction<object>Action to run when command is invoked.
canExecuteFunc<object, bool>Optional. Synchronous enablement test.
subscribeAction<EventHandler>Optional. An Action<T> to use to subscribe to an event. The subscription will be stored in case the event uses the weak event pattern. When the event is raised, CanExecuteChanged will be raised. If null, no subscription will take place.
ShellCommand(ISurface, Action<ISurface, object>, Func<object, bool>)
protected ShellCommand(ISurface surface, Action<ISurface, object> execute, Func<object, bool> canExecute)
Parameters
ShellCommand(ISurface, Func<ISurface, object, Task>, Func<object, bool>)
protected ShellCommand(ISurface surface, Func<ISurface, object, Task> executeAsync, Func<object, bool> canExecute)
Parameters
Fields
Subscription
protected readonly EventHandler Subscription
Field Value
Methods
CanExecute(object)
Defines the method that determines whether the command can execute in its current state.
public bool CanExecute(object parameter)
Parameters
parameterobjectData used by the command. If the command does not require data to be passed, this object can be set to null.
Returns
Execute(object)
Defines the method to be called when the command is invoked.
public void Execute(object parameter)
Parameters
parameterobjectData used by the command. If the command does not require data to be passed, this object can be set to null.
OnCanExecuteChanged()
public void OnCanExecuteChanged()
RaiseCanExecuteChanged()
public void RaiseCanExecuteChanged()
Events
CanExecuteChanged
forward handlers to the command manager
public event EventHandler CanExecuteChanged