|
@@ -45,8 +45,8 @@ namespace PRS.Mobile
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- public async Task<bool> AddImage<T, TShell>()
|
|
|
+
|
|
|
+ public async Task<bool> AddImage<T, TShell>(bool pdf = false, Action<TShell> customiseshell = null)
|
|
|
where T : MobileDocumentSource, new()
|
|
|
where TShell : class, IEntityDocumentShell
|
|
|
{
|
|
@@ -56,6 +56,7 @@ namespace PRS.Mobile
|
|
|
{
|
|
|
file = await MobileDocument.From<T>();
|
|
|
}
|
|
|
+
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
await MaterialDialog.Instance.AlertAsync(e.Message, "ERROR");
|
|
@@ -65,12 +66,20 @@ namespace PRS.Mobile
|
|
|
{
|
|
|
using (await MaterialDialog.Instance.LoadingDialogAsync("Saving Image"))
|
|
|
{
|
|
|
+ var thumbnail = MobileUtils.ImageTools.CreateThumbnail(file.Data, 256, 256);
|
|
|
+
|
|
|
+ if (pdf)
|
|
|
+ file = file.ToPDF();
|
|
|
+
|
|
|
var docshell = EntityDocumentUtils.SaveDocument<TShell>(
|
|
|
file,
|
|
|
() =>
|
|
|
{
|
|
|
var shell = ItemsSource.AddItem() as TShell;
|
|
|
shell.ParentID = ParentID;
|
|
|
+ shell.FileName = file.FileName;
|
|
|
+ shell.Thumbnail = thumbnail;
|
|
|
+ customiseshell?.Invoke(shell);
|
|
|
return shell;
|
|
|
},
|
|
|
"Created on Mobile Device"
|