protected override AttachmentPanelDecoratorBase_NonGeneric CreateAttachmentDecorator(string filePath) { byte[] fileData = File.ReadAllBytes(filePath); var photoModel = new PhotoAttachmentModel { добавить сохранение фул блоба и сжатие превью PreviewDataBlob = ImageScaler.ScaleToPreview(fileData), TypeOfAttachment = AttachmentType.Photo, RootSubjectType = subject?.TypeOfSubject ?? SubjectType.None, RootSubjectId = subject == null ? "" : RootSubjectIdentifier.Identify(subject) }; return(new PhotoPanelDecorator(PhotoAttachmentViewModel.CreateEditable(photoModel))); }
public static AttachmentViewModelBase CreateReadonly(AttachmentModelBase attachmentModel) { if (attachmentModel is NoteAttachmentModel noteModel) { return(NoteAttachmentViewModel.CreateReadonly(noteModel)); } if (attachmentModel is PhotoAttachmentModel photoModel) { return(PhotoAttachmentViewModel.CreateReadonly(photoModel)); } if (attachmentModel is DocumentAttachmentModel documentModel) { return(DocumentAttachmentViewModel.CreateReadonly(documentModel)); } if (attachmentModel is PhotoAlbumAttachmentModel photoAlbumModel) { return(new PhotoAlbumAttachmentViewModel(photoAlbumModel, true)); } throw new NotImplementedException(); }
protected override AttachmentPanelDecoratorBase_NonGeneric DecoratorFactory(PhotoAttachmentModel model) { return(new PhotoPanelDecorator(PhotoAttachmentViewModel.CreateEditable(model))); }