added some support for events when support it activated. Tidied up provider sample to allow for buttons to be shown and hidden, etc.