add delegate sample code