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