Sfoglia il codice sorgente

More QA Fixes for DigitalFormVariables

frogsoftware 1 anno fa
parent
commit
22273a1686

+ 14 - 14
InABox.Core/DigitalForms/Layouts/Fields/DFLayoutFieldProperties.cs

@@ -59,24 +59,24 @@ namespace InABox.Core
 
         protected override void LoadProperties()
         {
-            Description = GetProperty("Description", "");
-            Property = GetProperty("Property", "");
-            Required = GetProperty("Required", false);
-            Secure = GetProperty("Secure", false);
-            Retain = GetProperty("Retain", false);
-            Expression = GetProperty("Expression", "");
-            ColourExpression = GetProperty("ColourExpression", "");
+            Description = GetProperty(nameof(Description), "");
+            Property = GetProperty(nameof(Property), "");
+            Required = GetProperty(nameof(Required), false);
+            Secure = GetProperty(nameof(Secure), false);
+            Retain = GetProperty(nameof(Retain), false);
+            Expression = GetProperty(nameof(Expression), "");
+            ColourExpression = GetProperty(nameof(ColourExpression), "");
         }
 
         protected override void SaveProperties()
         {
-            SetProperty("Description", Description);
-            SetProperty("Property", Property);
-            SetProperty("Required", Required);
-            SetProperty("Secure", Secure);
-            SetProperty("Retain", Retain);
-            SetProperty("Expression", Expression);
-            SetProperty("ColourExpression", ColourExpression);
+            SetProperty(nameof(Description), Description);
+            SetProperty(nameof(Property), Property);
+            SetProperty(nameof(Required), Required);
+            SetProperty(nameof(Secure), Secure);
+            SetProperty(nameof(Retain), Retain);
+            SetProperty(nameof(Expression), Expression);
+            SetProperty(nameof(ColourExpression), ColourExpression);
         }
 
         private class PropertyLookupGenerator : LookupGenerator<object>

+ 16 - 14
InABox.Core/DigitalForms/Layouts/Fields/DFLayoutLookupField/DFLayoutLookupFieldProperties.cs

@@ -6,7 +6,7 @@ using System.Reflection;
 namespace InABox.Core
 {
     
-    public enum DFLayoutLookupType
+    public enum DFLayoutLookupDisplayType
     {
         Button = 0,
         Combo = 1,
@@ -19,12 +19,12 @@ namespace InABox.Core
         public List<string> AdditionalPropertiesList = new List<string>();
 
         [ComboLookupEditor(typeof(PropertyClassLookups))]
-        [EditorSequence(1)]
+        [EditorSequence(100)]
         public string LookupType { get; set; } = "";
 
         // A JSON-serialized Filter for filtering entries in the lookup editor
         [FilterEditor]
-        [EditorSequence(2)]
+        [EditorSequence(101)]
         public string Filter { get; set; } = "";
 
         /// <summary>
@@ -32,7 +32,7 @@ namespace InABox.Core
         /// </summary>
         //[TextBoxEditor(ToolTip = "A comma-separated list of property names.")]
         [MultiLookupEditor(typeof(AdditionalPropertyLookupGenerator))]
-        [EditorSequence(3)]
+        [EditorSequence(102)]
         public string AdditionalProperties
         {
             get => string.Join(',', AdditionalPropertiesList);
@@ -42,13 +42,13 @@ namespace InABox.Core
             }
         }
         
-        [EnumLookupEditor(typeof(DFLayoutLookupType))]
-        [EditorSequence(4)]
-        public DFLayoutLookupType Type { get; set; }
+        [EnumLookupEditor(typeof(DFLayoutLookupDisplayType))]
+        [EditorSequence(103)]
+        public DFLayoutLookupDisplayType DisplayType { get; set; }
 
         public DFLayoutLookupFieldProperties()
         {
-            Type = DFLayoutLookupType.Button;
+            DisplayType = DFLayoutLookupDisplayType.Button;
         }
 
         public override string FormatValue(object? value)
@@ -81,17 +81,19 @@ namespace InABox.Core
         protected override void LoadProperties()
         {
             base.LoadProperties();
-            LookupType = GetProperty("LookupType", "");
-            Filter = GetProperty("Filter", "");
-            AdditionalProperties = GetProperty("AdditionalProperties", "");
+            LookupType = GetProperty(nameof(LookupType), "");
+            Filter = GetProperty(nameof(Filter), "");
+            AdditionalProperties = GetProperty(nameof(AdditionalProperties), "");
+            DisplayType = GetProperty(nameof(DisplayType), DFLayoutLookupDisplayType.Button);
         }
 
         protected override void SaveProperties()
         {
             base.SaveProperties();
-            SetProperty("LookupType", LookupType);
-            SetProperty("Filter", Filter);
-            SetProperty("AdditionalProperties", AdditionalProperties);
+            SetProperty(nameof(LookupType), LookupType);
+            SetProperty(nameof(Filter), Filter);
+            SetProperty(nameof(AdditionalProperties), AdditionalProperties);
+            SetProperty(nameof(DisplayType),DisplayType);
         }
 
 

+ 20 - 3
InABox.Core/DigitalForms/Layouts/Fields/DFLayoutVideoField/DFLayoutVideoFieldProperties.cs

@@ -16,15 +16,15 @@ namespace InABox.Core
         }
         
         [CheckBoxEditor]
-        [EditorSequence(1)]
+        [EditorSequence(100)]
         public bool DisableLibrary { get; set; }
         
         [IntegerEditor(ToolTip = "Maximum video length (sec)")]
-        [EditorSequence(2)]
+        [EditorSequence(101)]
         public int MaximumVideoLength { get; set; } = 0;
 
         [EnumLookupEditor(typeof(VideoQuality))]
-        [EditorSequence(3)]
+        [EditorSequence(102)]
         public VideoQuality Quality { get; set; } = VideoQuality.Default;
 
         public override string FormatValue(object? value)
@@ -57,5 +57,22 @@ namespace InABox.Core
 
             return null;
         }
+        
+        protected override void LoadProperties()
+        {
+            base.LoadProperties();
+            DisableLibrary = GetProperty(nameof(DisableLibrary), false);
+            MaximumVideoLength = GetProperty(nameof(MaximumVideoLength), 0);
+            Quality = GetProperty(nameof(Quality), VideoQuality.Default);
+         }
+
+        protected override void SaveProperties()
+        {
+            base.SaveProperties();
+            SetProperty(nameof(DisableLibrary), DisableLibrary);
+            SetProperty(nameof(MaximumVideoLength),MaximumVideoLength);
+            SetProperty(nameof(Quality), Quality);
+        }
+        
     }
 }