private async Task InvokeInternal(IMediaItemAction action, MediaItem mediaItem) { try { var result = await action.ProcessAsync(mediaItem); if (result.Success && result.Result != ContentDirectoryMessaging.MediaItemChangeType.None) { ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem, result.Result); } } catch (Exception ex) { ServiceRegistration.Get <ILogger>().Error("Error executing MediaItemAction '{0}':", ex, action.GetType()); } }
public override async Task <bool> ProcessAsync(ListItem item) { IMediaItemListItem mediaItem = item as IMediaItemListItem; if (mediaItem != null) { var result = await _action.ProcessAsync(mediaItem.MediaItem); if (result.Success) { if (result.Result != ContentDirectoryMessaging.MediaItemChangeType.None) { ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem.MediaItem, result.Result); } return(true); } } return(false); }