public void Select(ListItem item) { if (item == null) { return; } object actionObj; object mediaItemObj; if (!item.AdditionalProperties.TryGetValue(Consts.KEY_MEDIA_ITEM_ACTION, out actionObj) || !item.AdditionalProperties.TryGetValue(Consts.KEY_MEDIA_ITEM, out mediaItemObj)) { return; } IMediaItemAction action = actionObj as IMediaItemAction; MediaItem mediaItem = mediaItemObj as MediaItem; if (action == null || mediaItem == null) { return; } try { ContentDirectoryMessaging.MediaItemChangeType changeType; if (action.Process(mediaItem, out changeType) && changeType != ContentDirectoryMessaging.MediaItemChangeType.None) { ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem, changeType); } } catch (Exception ex) { ServiceRegistration.Get <ILogger>().Error("Error executing MediaItemAction '{0}':", ex, action.GetType()); } }
protected void InvokeAction(IMediaItemAction action, MediaItem mediaItem) { try { ContentDirectoryMessaging.MediaItemChangeType changeType; if (action.Process(mediaItem, out changeType) && changeType != ContentDirectoryMessaging.MediaItemChangeType.None) { ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem, changeType); } } catch (Exception ex) { ServiceRegistration.Get <ILogger>().Error("Error executing MediaItemAction '{0}':", ex, action.GetType()); } }