private static void Initialize(FileUploadPropertyEditor fileUpload) { MediaService.Saving += fileUpload.MediaServiceSaving; ContentService.Copied += fileUpload.ContentServiceCopied; MediaService.Deleted += (sender, args) => args.MediaFilesToDelete.AddRange(fileUpload.ServiceDeleted(args.DeletedEntities.Cast<ContentBase>())); ContentService.Deleted += (sender, args) => args.MediaFilesToDelete.AddRange(fileUpload.ServiceDeleted(args.DeletedEntities.Cast<ContentBase>())); MemberService.Deleted += (sender, args) => args.MediaFilesToDelete.AddRange(fileUpload.ServiceDeleted(args.DeletedEntities.Cast<ContentBase>())); }
private void Initialize(FileUploadPropertyEditor fileUpload) { MediaService.Saving += fileUpload.MediaServiceSaving; _terminate.Add(() => MediaService.Saving -= fileUpload.MediaServiceSaving); ContentService.Copied += fileUpload.ContentServiceCopied; _terminate.Add(() => ContentService.Copied -= fileUpload.ContentServiceCopied); void mediaServiceDeleted(IMediaService sender, DeleteEventArgs <IMedia> args) => args.MediaFilesToDelete.AddRange(fileUpload.ServiceDeleted(args.DeletedEntities.Cast <ContentBase>())); MediaService.Deleted += mediaServiceDeleted; _terminate.Add(() => MediaService.Deleted -= mediaServiceDeleted); void contentServiceDeleted(IContentService sender, DeleteEventArgs <IContent> args) => args.MediaFilesToDelete.AddRange(fileUpload.ServiceDeleted(args.DeletedEntities.Cast <ContentBase>())); ContentService.Deleted += contentServiceDeleted; _terminate.Add(() => ContentService.Deleted -= contentServiceDeleted); void memberServiceDeleted(IMemberService sender, DeleteEventArgs <IMember> args) => args.MediaFilesToDelete.AddRange(fileUpload.ServiceDeleted(args.DeletedEntities.Cast <ContentBase>())); MemberService.Deleted += memberServiceDeleted; _terminate.Add(() => MemberService.Deleted -= memberServiceDeleted); }