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 { 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.RotateImage(_value.Thumbnail); _value.Data = MobileUtils.RotateImage(_value.Data); UpdateUI(); } protected override Task CaptureMedia() { return MobileDocument.From(PhotoUtils.CreateCameraOptions()); } protected override Task SelectMedia() { return MobileDocument.From(PhotoUtils.CreatePhotoLibraryOptions()); } protected override Guid GetValue() => _value.ID; protected override void SetValue(Guid value) => _value.ID = value; protected override byte[] CreateThumbnail(byte[] data, float maxwidth = 200, float maxheight=200) { return MobileUtils.ImageTools.CreateThumbnail(data, maxwidth, maxheight); } } }