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