-
Notifications
You must be signed in to change notification settings - Fork 76
CommandBase
Rico Suter edited this page Jun 3, 2015
·
4 revisions
- Package: MyToolkit (PCL)
- Platforms: All (PCL)
- Subclasses:
An ICommand base implementation to use as base class for own command implementations when using the command pattern.
Sample implementation:
public class DeletePersonCommand<Person> : CommandBase<Person>
{
private DataRepository _dataRepository;
public DeletePersonCommand(DataRepository dataRepository)
{
_dataRepository = dataRepository;
}
public override bool CanExecute(object person)
{
return person # = null && person is Person;
}
public override void Execute(object person)
{
_dataRepository.DeletePerson((Person)person);
}
}