Przeglądaj źródła

Added better progress indicators to Digital Form Dashboard

frogsoftware 1 rok temu
rodzic
commit
e0a43d75c8

+ 10 - 4
prs.desktop/Dashboards/Common/QADashboard.xaml.cs

@@ -192,10 +192,16 @@ namespace PRSDesktop
             var id = (Guid)table.Rows[e.RowColumnIndex.RowIndex - 1]["ID"];
 
             if (formType == null) return;
-            var entityForm = typeof(QADashboard)
-                .GetMethod(nameof(GetEntityForm), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)!
-                .MakeGenericMethod(formType)
-                .Invoke(this, new object[] { id }) as IDigitalFormInstance;
+
+            IDigitalFormInstance? entityForm = null;
+            Progress.ShowModal("Loading Form", (s) =>
+            {
+                entityForm = typeof(QADashboard)
+                    .GetMethod(nameof(GetEntityForm), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)!
+                    .MakeGenericMethod(formType)
+                    .Invoke(this, new object[] { id }) as IDigitalFormInstance;
+            });
+
             if (entityForm != null)
             {
                 if (DynamicFormEditWindow.EditDigitalForm(entityForm, out var dataModel))

+ 11 - 0
prs.shared/FormFields/DFAddTaskControl.cs

@@ -62,6 +62,17 @@ namespace PRS.Shared
             }
         }
 
+        public override void Deserialize(string serialized)
+        {
+            if (int.TryParse(serialized, out int i))
+                SetValue(i);
+        }
+
+        public override string Serialize()
+        {
+            return GetValue()?.ToString() ?? "";
+        }
+
         public override int? GetValue()
         {
             return Number.Value.HasValue ? Convert.ToInt32(Number.Value.Value) : null;