This project is read-only.

The page has been moved to GitHub

CommandBase

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);
	}
}

Last edited Jun 3, 2015 at 10:54 PM by rsuter, version 6