|
@@ -197,13 +197,20 @@ namespace PRS.Mobile
|
|
|
ColumnDefinitions.Add(def);
|
|
|
}
|
|
|
|
|
|
- Children.Clear();
|
|
|
- foreach (DFLayoutControl element in _layout.Elements)
|
|
|
- LoadViewAccordingToElement(element);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Children.Clear();
|
|
|
+ foreach (DFLayoutControl element in _layout.Elements)
|
|
|
+ LoadViewAccordingToElement(element);
|
|
|
+
|
|
|
+ foreach (var header in headersToCollapse)
|
|
|
+ AdjustHeaderSection(header, false);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ InABox.Mobile.MobileLogging.Log(ex,"LoadFormLayout");
|
|
|
+ }
|
|
|
|
|
|
- foreach (var header in headersToCollapse)
|
|
|
- AdjustHeaderSection(header, false);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private static void SetRowHeight(string row, RowDefinition def)
|
|
@@ -236,102 +243,127 @@ namespace PRS.Mobile
|
|
|
|
|
|
private void LoadViewAccordingToElement(DFLayoutControl element)
|
|
|
{
|
|
|
- // Not sure why this is here - perhaps to ry and handle malformed element definitions?
|
|
|
- if (string.IsNullOrEmpty(element.Description))
|
|
|
- return;
|
|
|
-
|
|
|
- if (element is DFLayoutLabel l)
|
|
|
- {
|
|
|
- var result = new DigitalFormLabel() { Definition = l };
|
|
|
- AddViewToGrid(result, element);
|
|
|
- }
|
|
|
-
|
|
|
- else if (element is DFLayoutImage img )
|
|
|
- {
|
|
|
- var result = new DigitalFormImage() { Definition = img };
|
|
|
- AddViewToGrid(result, element);
|
|
|
- }
|
|
|
-
|
|
|
- else if (element is DFLayoutHeader hdr)
|
|
|
- {
|
|
|
- var result = new DigitalFormHeader() { Definition = hdr };
|
|
|
- result.CollapsedChanged += (sender, args) => AdjustHeaderSection(result, result.Collapsed);
|
|
|
- if (hdr.Collapsed)
|
|
|
- headersToCollapse.Add(result);
|
|
|
- AddViewToGrid(result, element);
|
|
|
- }
|
|
|
-
|
|
|
- else if (element is DFLayoutBooleanField b)
|
|
|
- CreateView<DigitalFormBoolean, DFLayoutBooleanField, DFLayoutBooleanFieldProperties, bool, bool?>(b);
|
|
|
-
|
|
|
- else if (element is DFLayoutStringField s)
|
|
|
+ try
|
|
|
{
|
|
|
- if (s.Properties.PopupEditor)
|
|
|
- CreateView<DigitalFormStringPopup, DFLayoutStringField, DFLayoutStringFieldProperties, string, string?>(s);
|
|
|
- else if (s.Properties.TextWrapping)
|
|
|
- CreateView<DigitalFormStringEditor, DFLayoutStringField, DFLayoutStringFieldProperties, string, string?>(s);
|
|
|
- else
|
|
|
- CreateView<DigitalFormStringEntry, DFLayoutStringField, DFLayoutStringFieldProperties, string, string?>(s);
|
|
|
- }
|
|
|
-
|
|
|
- else if (element is DFLayoutIntegerField i)
|
|
|
- CreateView<DigitalFormIntegerEntry, DFLayoutIntegerField, DFLayoutIntegerFieldProperties, int, int?>(i);
|
|
|
-
|
|
|
- else if (element is DFLayoutDoubleField d)
|
|
|
- CreateView<DigitalFormDoubleEntry, DFLayoutDoubleField, DFLayoutDoubleFieldProperties, double, double?>(d);
|
|
|
+ // Not sure why this is here - perhaps to ry and handle malformed element definitions?
|
|
|
+ if (string.IsNullOrEmpty(element.Description))
|
|
|
+ return;
|
|
|
|
|
|
- else if (element is DFLayoutDateField df)
|
|
|
- CreateView<DigitalFormDateEntry, DFLayoutDateField, DFLayoutDateFieldProperties, DateTime, DateTime?>(df);
|
|
|
-
|
|
|
- else if (element is DFLayoutTimeField tf)
|
|
|
- CreateView<DigitalFormTimeEntry, DFLayoutTimeField, DFLayoutTimeFieldProperties, TimeSpan,TimeSpan?>(tf);
|
|
|
-
|
|
|
+ if (element is DFLayoutLabel l)
|
|
|
+ {
|
|
|
+ var result = new DigitalFormLabel() { Definition = l };
|
|
|
+ AddViewToGrid(result, element);
|
|
|
+ }
|
|
|
|
|
|
- else if (element is DFLayoutOptionField of)
|
|
|
- {
|
|
|
- if (of.Properties.OptionType == DFLayoutOptionType.Radio)
|
|
|
- CreateView<DigitalFormOptionRadioList, DFLayoutOptionField, DFLayoutOptionFieldProperties, string, string?>(of);
|
|
|
- else if (of.Properties.OptionType == DFLayoutOptionType.Buttons)
|
|
|
- CreateView<DigitalFormOptionButtonList, DFLayoutOptionField, DFLayoutOptionFieldProperties, string, string?>(of);
|
|
|
- else
|
|
|
- CreateView<DigitalFormOptionComboBox, DFLayoutOptionField, DFLayoutOptionFieldProperties, string, string?>(of);
|
|
|
- }
|
|
|
-
|
|
|
- else if (element is DFLayoutLookupField lf)
|
|
|
- {
|
|
|
- if (lf.Properties.DisplayType == DFLayoutLookupDisplayType.Combo)
|
|
|
- CreateView<DigitalFormLookupComboBox, DFLayoutLookupField, DFLayoutLookupFieldProperties, Guid, DFLayoutLookupValue>(lf);
|
|
|
- else
|
|
|
- CreateView<DigitalFormLookupButton, DFLayoutLookupField, DFLayoutLookupFieldProperties, Guid, DFLayoutLookupValue>(lf);
|
|
|
- }
|
|
|
-
|
|
|
- else if (element is DFLayoutSignaturePad sp)
|
|
|
- CreateView<DigitalFormSignature, DFLayoutSignaturePad, DFLayoutSignaturePadProperties, byte[], byte[]?>(sp);
|
|
|
+ else if (element is DFLayoutImage img)
|
|
|
+ {
|
|
|
+ var result = new DigitalFormImage() { Definition = img };
|
|
|
+ AddViewToGrid(result, element);
|
|
|
+ }
|
|
|
|
|
|
- else if (element is DFLayoutEmbeddedImage ei)
|
|
|
- CreateView<DigitalFormEmbeddedImage, DFLayoutEmbeddedImage, DFLayoutEmbeddedImageProperties, Guid, DFLayoutEmbeddedMediaValue>(ei);
|
|
|
-
|
|
|
- else if (element is DFLayoutVideoField ev)
|
|
|
- CreateView<DigitalFormEmbeddedVideo, DFLayoutVideoField, DFLayoutVideoFieldProperties, byte[], DFLayoutEmbeddedMediaValue>(ev);
|
|
|
-
|
|
|
- else if (element is DFLayoutMultiImage mi)
|
|
|
- CreateView<DigitalFormMultiImage, DFLayoutMultiImage, DFLayoutMultiImageProperties, List<Guid>, DFLayoutEmbeddedMediaValues>(mi);
|
|
|
-
|
|
|
- else if (element is DFLayoutMultiSignaturePad ms)
|
|
|
- {
|
|
|
- CreateView<DigitalFormMultiSignature, DFLayoutMultiSignaturePad, DFLayoutMultiSignaturePadProperties,
|
|
|
- Dictionary<string, byte[]>, Dictionary<string, byte[]>?>(ms);
|
|
|
- //var tuple = LoadMultiSignaturePad(element);
|
|
|
- //AddViewToGrid(tuple.Item1, element);
|
|
|
+ else if (element is DFLayoutHeader hdr)
|
|
|
+ {
|
|
|
+ var result = new DigitalFormHeader() { Definition = hdr };
|
|
|
+ result.CollapsedChanged += (sender, args) => AdjustHeaderSection(result, result.Collapsed);
|
|
|
+ if (hdr.Collapsed)
|
|
|
+ headersToCollapse.Add(result);
|
|
|
+ AddViewToGrid(result, element);
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (element is DFLayoutBooleanField b)
|
|
|
+ CreateView<DigitalFormBoolean, DFLayoutBooleanField, DFLayoutBooleanFieldProperties, bool, bool?>(
|
|
|
+ b);
|
|
|
+
|
|
|
+ else if (element is DFLayoutStringField s)
|
|
|
+ {
|
|
|
+ if (s.Properties.PopupEditor)
|
|
|
+ CreateView<DigitalFormStringPopup, DFLayoutStringField, DFLayoutStringFieldProperties, string,
|
|
|
+ string?>(s);
|
|
|
+ else if (s.Properties.TextWrapping)
|
|
|
+ CreateView<DigitalFormStringEditor, DFLayoutStringField, DFLayoutStringFieldProperties, string,
|
|
|
+ string?>(s);
|
|
|
+ else
|
|
|
+ CreateView<DigitalFormStringEntry, DFLayoutStringField, DFLayoutStringFieldProperties, string,
|
|
|
+ string?>(s);
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (element is DFLayoutIntegerField i)
|
|
|
+ CreateView<DigitalFormIntegerEntry, DFLayoutIntegerField, DFLayoutIntegerFieldProperties, int, int
|
|
|
+ ?>(i);
|
|
|
+
|
|
|
+ else if (element is DFLayoutDoubleField d)
|
|
|
+ CreateView<DigitalFormDoubleEntry, DFLayoutDoubleField, DFLayoutDoubleFieldProperties, double,
|
|
|
+ double?>(d);
|
|
|
+
|
|
|
+ else if (element is DFLayoutDateField df)
|
|
|
+ CreateView<DigitalFormDateEntry, DFLayoutDateField, DFLayoutDateFieldProperties, DateTime, DateTime
|
|
|
+ ?>(df);
|
|
|
+
|
|
|
+ else if (element is DFLayoutTimeField tf)
|
|
|
+ CreateView<DigitalFormTimeEntry, DFLayoutTimeField, DFLayoutTimeFieldProperties, TimeSpan, TimeSpan
|
|
|
+ ?>(tf);
|
|
|
+
|
|
|
+
|
|
|
+ else if (element is DFLayoutOptionField of)
|
|
|
+ {
|
|
|
+ if (of.Properties.OptionType == DFLayoutOptionType.Radio)
|
|
|
+ CreateView<DigitalFormOptionRadioList, DFLayoutOptionField, DFLayoutOptionFieldProperties,
|
|
|
+ string, string?>(of);
|
|
|
+ else if (of.Properties.OptionType == DFLayoutOptionType.Buttons)
|
|
|
+ CreateView<DigitalFormOptionButtonList, DFLayoutOptionField, DFLayoutOptionFieldProperties,
|
|
|
+ string, string?>(of);
|
|
|
+ else
|
|
|
+ CreateView<DigitalFormOptionComboBox, DFLayoutOptionField, DFLayoutOptionFieldProperties, string
|
|
|
+ , string?>(of);
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (element is DFLayoutLookupField lf)
|
|
|
+ {
|
|
|
+ if (lf.Properties.DisplayType == DFLayoutLookupDisplayType.Combo)
|
|
|
+ CreateView<DigitalFormLookupComboBox, DFLayoutLookupField, DFLayoutLookupFieldProperties, Guid,
|
|
|
+ DFLayoutLookupValue>(lf);
|
|
|
+ else
|
|
|
+ CreateView<DigitalFormLookupButton, DFLayoutLookupField, DFLayoutLookupFieldProperties, Guid,
|
|
|
+ DFLayoutLookupValue>(lf);
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (element is DFLayoutSignaturePad sp)
|
|
|
+ CreateView<DigitalFormSignature, DFLayoutSignaturePad, DFLayoutSignaturePadProperties, byte[], byte
|
|
|
+ []?>(sp);
|
|
|
+
|
|
|
+ else if (element is DFLayoutEmbeddedImage ei)
|
|
|
+ CreateView<DigitalFormEmbeddedImage, DFLayoutEmbeddedImage, DFLayoutEmbeddedImageProperties, Guid,
|
|
|
+ DFLayoutEmbeddedMediaValue>(ei);
|
|
|
+
|
|
|
+ else if (element is DFLayoutVideoField ev)
|
|
|
+ CreateView<DigitalFormEmbeddedVideo, DFLayoutVideoField, DFLayoutVideoFieldProperties, byte[],
|
|
|
+ DFLayoutEmbeddedMediaValue>(ev);
|
|
|
+
|
|
|
+ else if (element is DFLayoutMultiImage mi)
|
|
|
+ CreateView<DigitalFormMultiImage, DFLayoutMultiImage, DFLayoutMultiImageProperties, List<Guid>,
|
|
|
+ DFLayoutEmbeddedMediaValues>(mi);
|
|
|
+
|
|
|
+ else if (element is DFLayoutMultiSignaturePad ms)
|
|
|
+ {
|
|
|
+ CreateView<DigitalFormMultiSignature, DFLayoutMultiSignaturePad, DFLayoutMultiSignaturePadProperties
|
|
|
+ ,
|
|
|
+ Dictionary<string, byte[]>, Dictionary<string, byte[]>?>(ms);
|
|
|
+ //var tuple = LoadMultiSignaturePad(element);
|
|
|
+ //AddViewToGrid(tuple.Item1, element);
|
|
|
+ }
|
|
|
+ else if (element is DFLayoutAddTaskField at)
|
|
|
+ {
|
|
|
+ CreateView<DigitalFormAddTask, DFLayoutAddTaskField, DFLayoutAddTaskFieldProperties,
|
|
|
+ string?, string?>(at);
|
|
|
+ //var tuple = LoadAddTaskField(element);
|
|
|
+ //AddViewToGrid(tuple.Item1, element);
|
|
|
+ }
|
|
|
}
|
|
|
- else if (element is DFLayoutAddTaskField at)
|
|
|
+ catch (Exception e)
|
|
|
{
|
|
|
- CreateView<DigitalFormAddTask, DFLayoutAddTaskField, DFLayoutAddTaskFieldProperties,
|
|
|
- string?, string?>(at);
|
|
|
- //var tuple = LoadAddTaskField(element);
|
|
|
- //AddViewToGrid(tuple.Item1, element);
|
|
|
+ InABox.Mobile.MobileLogging.Log(e,"LoadFormLayout");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private TField CreateView<TField, TDefinition, TProperties, TValue, TSerialized>(TDefinition definition)
|