|
@@ -1016,6 +1016,9 @@ namespace PRS.Mobile
|
|
|
View view = null;
|
|
|
DFLayoutSignaturePad dFLayoutSignaturePad = element as DFLayoutSignaturePad;
|
|
|
var isrequired = dFLayoutSignaturePad.Properties.Required;
|
|
|
+
|
|
|
+ // if we have a value, then show the image
|
|
|
+ // We need a clear button to be able to reset it
|
|
|
if (loadData.TryGetValue(dFLayoutSignaturePad.Name, out value))
|
|
|
{
|
|
|
if (!string.IsNullOrWhiteSpace(value))
|
|
@@ -1025,52 +1028,40 @@ namespace PRS.Mobile
|
|
|
embeddedImageCapture.DataToImage(data);
|
|
|
view = embeddedImageCapture;
|
|
|
view.IsEnabled = false;
|
|
|
+ view.HeightRequest = 200;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SfSignaturePad signaturePad = new SfSignaturePad();
|
|
|
- EmbeddedImageCapture hiddenEmbeddedImageCapture = new EmbeddedImageCapture() { HeightRequest = 200, IsVisible = false, IsEnabled = false };
|
|
|
- if (isrequired) signaturePad.BackgroundColor = isRequiredColor;
|
|
|
- signaturePad.MinimumHeightRequest = 200;
|
|
|
- signaturePad.MinimumStrokeWidth = 0.2;
|
|
|
- signaturePad.MaximumStrokeWidth = 17;
|
|
|
- Button clearButton = new Button()
|
|
|
+ // If we don't have a value, show the signaturepad + utility buttons
|
|
|
+ SfSignaturePad signaturePad = new SfSignaturePad()
|
|
|
{
|
|
|
- Text = "Clear",
|
|
|
- HorizontalOptions = LayoutOptions.FillAndExpand,
|
|
|
- VerticalOptions = LayoutOptions.End,
|
|
|
- Margin = 0,
|
|
|
- BackgroundColor = Color.FromHex("#15C7C1"),
|
|
|
- FontAttributes = FontAttributes.Bold,
|
|
|
- TextColor = Color.White,
|
|
|
- CornerRadius = 5,
|
|
|
- Padding = 1
|
|
|
+ MinimumStrokeWidth = 0.2,
|
|
|
+ MaximumStrokeWidth = 17
|
|
|
};
|
|
|
- clearButton.Clicked += (object sender, EventArgs e) =>
|
|
|
+ if (isrequired)
|
|
|
+ signaturePad.BackgroundColor = isRequiredColor;
|
|
|
+ signaturePad.SetValue(Grid.ColumnProperty,0);
|
|
|
+ signaturePad.SetValue(Grid.ColumnSpanProperty,3);
|
|
|
+ signaturePad.SetValue(Grid.RowProperty,0);
|
|
|
+
|
|
|
+ EmbeddedImageCapture hiddenEmbeddedImageCapture = new EmbeddedImageCapture()
|
|
|
{
|
|
|
- signaturePad.IsVisible = true;
|
|
|
- hiddenEmbeddedImageCapture.IsVisible = false;
|
|
|
- useSavedSignatures.Remove(dFLayoutSignaturePad.Name);
|
|
|
- signaturePad.Clear();
|
|
|
+ IsVisible = false,
|
|
|
+ IsEnabled = false
|
|
|
};
|
|
|
- Grid.SetColumn(clearButton, 2);
|
|
|
-
|
|
|
- Button signNowButton = new Button()
|
|
|
+ hiddenEmbeddedImageCapture.SetValue(Grid.ColumnProperty,0);
|
|
|
+ hiddenEmbeddedImageCapture.SetValue(Grid.ColumnSpanProperty,3);
|
|
|
+ hiddenEmbeddedImageCapture.SetValue(Grid.RowProperty,0);
|
|
|
+
|
|
|
+ MobileButton createSignatureButton = new MobileButton()
|
|
|
{
|
|
|
- Text = "Apply Saved",
|
|
|
- HorizontalOptions = LayoutOptions.FillAndExpand,
|
|
|
- VerticalOptions = LayoutOptions.End,
|
|
|
- Margin = 0,
|
|
|
- BackgroundColor = Color.FromHex("#15C7C1"),
|
|
|
- FontAttributes = FontAttributes.Bold,
|
|
|
- TextColor = Color.White,
|
|
|
- CornerRadius = 5,
|
|
|
- Padding = 1
|
|
|
+ Text = "Save New"
|
|
|
};
|
|
|
- signNowButton.Clicked += (object sender, EventArgs e) =>
|
|
|
+ createSignatureButton.Clicked += (sender, args) =>
|
|
|
{
|
|
|
- if (Application.Current.Properties.ContainsKey("SavedSignature"))
|
|
|
+ SignatureSaver saver = new SignatureSaver();
|
|
|
+ saver.OnSignatureSaved += () =>
|
|
|
{
|
|
|
Task.Run(() =>
|
|
|
{
|
|
@@ -1081,26 +1072,19 @@ namespace PRS.Mobile
|
|
|
hiddenEmbeddedImageCapture.IsVisible = true;
|
|
|
if (!useSavedSignatures.Contains(dFLayoutSignaturePad.Name))
|
|
|
useSavedSignatures.Add(dFLayoutSignaturePad.Name);
|
|
|
- }
|
|
|
+ };
|
|
|
+ Navigation.PushAsync(saver);
|
|
|
};
|
|
|
- Grid.SetColumn(signNowButton, 1);
|
|
|
-
|
|
|
- Button createSignatureButton = new Button()
|
|
|
- {
|
|
|
- Text = "Save New",
|
|
|
- HorizontalOptions = LayoutOptions.FillAndExpand,
|
|
|
- VerticalOptions = LayoutOptions.End,
|
|
|
- Margin = 0,
|
|
|
- BackgroundColor = Color.FromHex("#15C7C1"),
|
|
|
- FontAttributes = FontAttributes.Bold,
|
|
|
- TextColor = Color.White,
|
|
|
- CornerRadius = 5,
|
|
|
- Padding = 1
|
|
|
+ createSignatureButton.SetValue(Grid.ColumnProperty,0);
|
|
|
+ createSignatureButton.SetValue(Grid.RowProperty,1);
|
|
|
+
|
|
|
+ MobileButton signNowButton = new MobileButton()
|
|
|
+ {
|
|
|
+ Text = "Apply Saved",
|
|
|
};
|
|
|
- createSignatureButton.Clicked += (object sender, EventArgs e) =>
|
|
|
+ signNowButton.Clicked += (sender, args) =>
|
|
|
{
|
|
|
- SignatureSaver saver = new SignatureSaver();
|
|
|
- saver.OnSignatureSaved += () =>
|
|
|
+ if (Application.Current.Properties.ContainsKey("SavedSignature"))
|
|
|
{
|
|
|
Task.Run(() =>
|
|
|
{
|
|
@@ -1111,28 +1095,38 @@ namespace PRS.Mobile
|
|
|
hiddenEmbeddedImageCapture.IsVisible = true;
|
|
|
if (!useSavedSignatures.Contains(dFLayoutSignaturePad.Name))
|
|
|
useSavedSignatures.Add(dFLayoutSignaturePad.Name);
|
|
|
- };
|
|
|
- Navigation.PushAsync(saver);
|
|
|
+ }
|
|
|
};
|
|
|
- Grid.SetColumn(createSignatureButton, 0);
|
|
|
-
|
|
|
- Grid buttonsGrid = new Grid { Margin = 0, Padding = 0, VerticalOptions = LayoutOptions.End };
|
|
|
- buttonsGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
|
|
- buttonsGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
|
|
- buttonsGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
|
|
- buttonsGrid.Children.Add(createSignatureButton);
|
|
|
- buttonsGrid.Children.Add(signNowButton);
|
|
|
- buttonsGrid.Children.Add(clearButton);
|
|
|
-
|
|
|
- Grid grid = new Grid() { Margin = 0, Padding = 0 };
|
|
|
- grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200, GridUnitType.Absolute) });
|
|
|
- Grid.SetRow(signaturePad, 0);
|
|
|
- Grid.SetRow(hiddenEmbeddedImageCapture, 0);
|
|
|
-
|
|
|
- grid.Children.Add(hiddenEmbeddedImageCapture);
|
|
|
+ signNowButton.SetValue(Grid.ColumnProperty,1);
|
|
|
+ signNowButton.SetValue(Grid.RowProperty,1);
|
|
|
+
|
|
|
+ MobileButton clearButton = new MobileButton()
|
|
|
+ {
|
|
|
+ Text = "Clear",
|
|
|
+ };
|
|
|
+ clearButton.Clicked += (sender, args) =>
|
|
|
+ {
|
|
|
+ signaturePad.IsVisible = true;
|
|
|
+ hiddenEmbeddedImageCapture.IsVisible = false;
|
|
|
+ useSavedSignatures.Remove(dFLayoutSignaturePad.Name);
|
|
|
+ signaturePad.Clear();
|
|
|
+ };
|
|
|
+ clearButton.SetValue(Grid.ColumnProperty,2);
|
|
|
+ clearButton.SetValue(Grid.RowProperty,1);
|
|
|
+
|
|
|
+ Grid grid = new Grid { Padding = 5, ColumnSpacing = 5 };
|
|
|
+ grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(200, GridUnitType.Absolute) });
|
|
|
+ grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(40, GridUnitType.Absolute) });
|
|
|
+ grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
|
|
+ grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
|
|
+ grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
|
|
+
|
|
|
grid.Children.Add(signaturePad);
|
|
|
- grid.Children.Add(buttonsGrid);
|
|
|
-
|
|
|
+ grid.Children.Add(hiddenEmbeddedImageCapture);
|
|
|
+ grid.Children.Add(createSignatureButton);
|
|
|
+ grid.Children.Add(signNowButton);
|
|
|
+ grid.Children.Add(clearButton);
|
|
|
+
|
|
|
view = grid;
|
|
|
}
|
|
|
|
|
@@ -1293,7 +1287,8 @@ namespace PRS.Mobile
|
|
|
if (element is DFLayoutField)
|
|
|
{
|
|
|
pairs[element as DFLayoutField] = view;
|
|
|
- if (isSecure || readOnly || !string.IsNullOrWhiteSpace((element as DFLayoutField).GetPropertyValue<string>("Expression")))
|
|
|
+ if (isSecure || readOnly ||
|
|
|
+ !string.IsNullOrWhiteSpace((element as DFLayoutField).GetPropertyValue<string>("Expression")))
|
|
|
view.IsEnabled = false;
|
|
|
|
|
|
if (requiresFrame)
|
|
@@ -1325,7 +1320,9 @@ namespace PRS.Mobile
|
|
|
}
|
|
|
|
|
|
if (element.Row > 0)
|
|
|
- SetRow(view, element.Row - 1); //rows and columns coming in from the desktop designer start from 1, not 0 (most of the time??)
|
|
|
+ SetRow(view,
|
|
|
+ element.Row -
|
|
|
+ 1); //rows and columns coming in from the desktop designer start from 1, not 0 (most of the time??)
|
|
|
else if (element.Row == 0)
|
|
|
SetRow(view, dfLayout.RowHeights.Count + 1);
|
|
|
if (element.RowSpan > 0)
|
|
@@ -1333,7 +1330,9 @@ namespace PRS.Mobile
|
|
|
else if (element.RowSpan == 0)
|
|
|
SetRowSpan(view, 1);
|
|
|
if (element.Column > 0)
|
|
|
- SetColumn(view, element.Column - 1); //rows and columns coming in from the desktop designer start from 1, not 0 (most of the time??)
|
|
|
+ SetColumn(view,
|
|
|
+ element.Column -
|
|
|
+ 1); //rows and columns coming in from the desktop designer start from 1, not 0 (most of the time??)
|
|
|
if (element.ColumnSpan > 0)
|
|
|
SetColumnSpan(view, element.ColumnSpan);
|
|
|
|
|
@@ -1348,24 +1347,24 @@ namespace PRS.Mobile
|
|
|
view = lblView;
|
|
|
}
|
|
|
}
|
|
|
- else if (element.ColumnSpan == 0) SetColumnSpan(view, 1);
|
|
|
+ else if (element.ColumnSpan == 0)
|
|
|
+ SetColumnSpan(view, 1);
|
|
|
|
|
|
- view.SetValue(Grid.MarginProperty, 0.01);
|
|
|
+ //view.SetValue(Grid.MarginProperty, 0.01);
|
|
|
|
|
|
- if (element is DFLayoutSignaturePad)
|
|
|
- view.Margin = new Thickness(25, 0, 25, 0);
|
|
|
+ //if (element is DFLayoutSignaturePad)
|
|
|
+ // view.Margin = new Thickness(25, 0, 25, 0);
|
|
|
|
|
|
- Device.BeginInvokeOnMainThread(() =>
|
|
|
- {
|
|
|
- Children.Add(view);
|
|
|
- });
|
|
|
+ Device.BeginInvokeOnMainThread(() => { Children.Add(view); });
|
|
|
|
|
|
if (element is DFLayoutHeader)
|
|
|
if ((element as DFLayoutHeader).Collapsed)
|
|
|
headersToCollapse.Add(view as DigitalFormsHeader);
|
|
|
}
|
|
|
- catch
|
|
|
- { }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ MobileLogging.Log(e,"DFLayout");
|
|
|
+ }
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
@@ -2102,26 +2101,9 @@ namespace PRS.Mobile
|
|
|
|
|
|
private string GetStringFromOptionField(View view)
|
|
|
{
|
|
|
- if (Device.RuntimePlatform == Device.iOS)
|
|
|
- {
|
|
|
- var iOSPicker = view as CustomPickeriOS;
|
|
|
- if (iOSPicker.SelectedIndex != -1)
|
|
|
- {
|
|
|
- return iOSPicker.SelectedItem.ToString();
|
|
|
- }
|
|
|
- else
|
|
|
- return "";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- var picker = view as Picker;
|
|
|
- if (picker.SelectedIndex != -1)
|
|
|
- {
|
|
|
- return picker.SelectedItem.ToString();
|
|
|
- }
|
|
|
- else
|
|
|
- return "";
|
|
|
- }
|
|
|
+ if (view is MobileTabStrip strip)
|
|
|
+ return strip.SelectedItem?.Text ?? "";
|
|
|
+ return "";
|
|
|
}
|
|
|
|
|
|
public object GetFieldData(string fieldName, string dataField)
|