瀏覽代碼

Fixed Refresh Issues when closing Leave Request Forms
Fixed issue where signatures were not being saved

Frank van den Bos 1 年之前
父節點
當前提交
7927f520ae

+ 13 - 3
prs.mobile.new/PRS.Mobile/Components/DigitalForms/Editor/DigitalFormHost.xaml.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Threading.Tasks;
 using InABox.Core;
 using Xamarin.Forms;
 using Xamarin.Forms.Xaml;
@@ -65,9 +66,18 @@ namespace PRS.Mobile
 
         private void ExitBtn_Clicked(object sender, EventArgs e)
         {
-            RetainedResults.IsFormRetained = false;
-            OnClosing?.Invoke(this, new DigitalFormsHostClosingArgs(false));
-            Navigation.PopAsync();
+            
+        }
+
+        protected override async Task<bool> OnBackButtonClicked()
+        {
+            Dispatcher.BeginInvokeOnMainThread(() =>
+            {
+                RetainedResults.IsFormRetained = false;
+                OnClosing?.Invoke(this, new DigitalFormsHostClosingArgs(false));
+                Navigation.PopAsync();
+            });
+            return false;
         }
 
         private void SaveBtn_Clicked(object sender, EventArgs e)

+ 7 - 2
prs.mobile.new/PRS.Mobile/Components/DigitalForms/Editor/Views/DigitalFormSignature.cs

@@ -49,6 +49,11 @@ namespace PRS.Mobile
 
         public void Serialize(DFSaveStorageEntry entry)
         {
+            if (_value?.Any() != true)
+            {
+                _pad.Save();
+                _value = GetSignature(_pad.ImageSource);
+            }
             Definition?.Properties.SerializeValue(entry,_value);
         }
 
@@ -75,7 +80,7 @@ namespace PRS.Mobile
 
         public string Serialize()
         {
-            if (_value == null)
+            if (_value?.Any() != true)
             {
                 _pad.Save();
                 _value = GetSignature(_pad.ImageSource);
@@ -209,7 +214,7 @@ namespace PRS.Mobile
         
         private void UpdateValue()
         {
-            if (_value == null)
+            if (_value?.Any() != true)
             {
                 _pad.Clear();
                 _pad.IsVisible = true;