1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Threading.Tasks;
- using Comal.Classes;
- using InABox.Configuration;
- using InABox.Core;
- using InABox.Mobile;
- namespace PRS.Mobile
- {
- public class DigitalFormEmbeddedImage : DigitalFormEmbeddedMedia<DFLayoutEmbeddedImage, DFLayoutEmbeddedImageProperties, Guid>
- {
- protected override bool IsVideo => false;
- protected override bool DisableLibrary => Definition.Properties.DisableLibrary;
- protected override bool Secure => Definition.Properties.Secure;
- protected override bool Required => Definition.Properties.Required;
- public DigitalFormEmbeddedImage() : base()
- {
- AddButton(Xamarin.Forms.ImageSource.FromFile("rotate"),RotateImage);
- }
- private void RotateImage()
- {
- _value.Thumbnail = MobileUtils.ImageTools.RotateImage(_value.Thumbnail, 90F, 100);
- _value.Data = MobileUtils.ImageTools.RotateImage(_value.Data, 90F, 100);
- UpdateUI();
- }
-
- protected override Task<MobileDocument> CaptureMedia()
- {
- return MobileDocument.From<MobileDocumentCameraSource>(PhotoUtils.CreateCameraOptions());
- }
- protected override Task<MobileDocument> SelectMedia()
- {
- return MobileDocument.From<MobileDocumentPhotoLibrarySource>(PhotoUtils.CreatePhotoLibraryOptions());
- }
- protected override Guid GetValue() => _value.ID;
- protected override void SetValue(Guid value) => _value.ID = value;
-
- protected override byte[] CreateThumbnail(byte[] data, int maxwidth = 256, int maxheight=256)
- {
- return MobileUtils.ImageTools.CreateThumbnail(data, maxwidth, maxheight);
- }
-
- }
- }
|