|
@@ -1,6 +1,7 @@
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
using InABox.Avalonia;
|
|
|
using InABox.Avalonia.Components;
|
|
|
+using InABox.Avalonia.Platform;
|
|
|
using InABox.Core;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -23,6 +24,12 @@ internal partial class DocumentScannerEditorViewModel : ModuleViewModel
|
|
|
[ObservableProperty]
|
|
|
private DocumentModel? _documentModel;
|
|
|
|
|
|
+ [ObservableProperty]
|
|
|
+ private Func<byte[]>? _getImage;
|
|
|
+
|
|
|
+ [ObservableProperty]
|
|
|
+ private bool _imageChanged;
|
|
|
+
|
|
|
public DocumentScannerEditorViewModel()
|
|
|
{
|
|
|
PrimaryMenu.Add(new AvaloniaMenuItem(Images.save, Save));
|
|
@@ -55,6 +62,17 @@ internal partial class DocumentScannerEditorViewModel : ModuleViewModel
|
|
|
{
|
|
|
ProgressVisible = true;
|
|
|
|
|
|
+ if (ImageChanged && GetImage is not null && Document is not null)
|
|
|
+ {
|
|
|
+ var imgData = GetImage();
|
|
|
+ Document.Data = imgData;
|
|
|
+ Document.CRC = CoreUtils.CalculateCRC(imgData);
|
|
|
+ Document.TimeStamp = DateTime.Now;
|
|
|
+ await Document.SaveAsync("Updated from Mobile Device");
|
|
|
+
|
|
|
+ DataEntryDocument.Thumbnail = PlatformTools.ImageTools.CreateThumbnail(imgData, 256, 256);
|
|
|
+ }
|
|
|
+
|
|
|
await DataEntryDocument.SaveAsync("Updated from Mobile Device");
|
|
|
|
|
|
ProgressVisible = false;
|