Plugin configuration patterns

Oct 3, 2011 at 10:05 AM
Edited Oct 3, 2011 at 10:05 AM

Are there recommendations or standard patterns that I should follow when creating facilities for plugin configuration? E.g. if I want to say "For this playlist item, my plugin should enable behaviors A and C" and "For this instance of SMFPlayer, do not enable any behaviors".

My first thought was to use attached properties - I suppose this would work for the second scenario (per-player configuration) but not for the first because since PlaylistItem is not a DependencyObject, I cannot attach any properties to it. Is there a standard pattern that plugins should follow in this scenario?

Oct 3, 2011 at 11:01 PM

There is a property added in SMF 2.4 for this exact purpose: PlaylistItem.CustomMetadata. This is just a dictionary that you can add values to per playlistitem. Plugins can then access this and manipulate their behavior depending on the values.

Note: There is also a property on SMFPlayer called GlobalConfigMetadata that can be used to support passing in data that is not specific to a playlistitem.