|
@@ -197,10 +197,10 @@ public partial class DynamicFormEditWindow : Window, IDynamicFormWindow
|
|
|
{
|
|
|
if (!Grid.Validate(out var messages))
|
|
|
{
|
|
|
- MessageBox.Show(string.Join('\n', messages));
|
|
|
+ MessageWindow.ShowMessage(string.Join('\n', messages), "Validation Error", image: MessageWindow.WarningImage);
|
|
|
return;
|
|
|
}
|
|
|
- if (MessageBox.Show("Are you sure you want to complete this form?", "Confirm Completion", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
|
|
+ if (MessageWindow.ShowYesNo("Are you sure you want to complete this form?", "Confirm Completion"))
|
|
|
{
|
|
|
Result = FormResult.Complete;
|
|
|
DialogResult = true;
|
|
@@ -265,10 +265,10 @@ public partial class DynamicFormEditWindow : Window, IDynamicFormWindow
|
|
|
{
|
|
|
if (DataModel?.Instance.FormCompleted.IsEmpty() == false && !Grid.Validate(out var messages))
|
|
|
{
|
|
|
- MessageBox.Show(string.Join('\n', messages));
|
|
|
+ MessageWindow.ShowMessage(string.Join('\n', messages), "Validation Error", image: MessageWindow.WarningImage);
|
|
|
return;
|
|
|
}
|
|
|
- if (MessageBox.Show("Are you sure you want to save this form?", "Confirm Save", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
|
|
+ if (MessageWindow.ShowYesNo("Are you sure you want to save this form?", "Confirm Save"))
|
|
|
{
|
|
|
Result = FormResult.Save;
|
|
|
DialogResult = true;
|
|
@@ -306,7 +306,8 @@ public partial class DynamicFormEditWindow : Window, IDynamicFormWindow
|
|
|
DigitalFormLayout layout = null;
|
|
|
DigitalFormVariable[] variables = null;
|
|
|
DFLoadStorage? values = null;
|
|
|
- String error = "";
|
|
|
+ string? error = null;
|
|
|
+ string? errorDetails = null;
|
|
|
|
|
|
Progress.ShowModal("Loading Form", (progress) =>
|
|
|
{
|
|
@@ -351,19 +352,27 @@ public partial class DynamicFormEditWindow : Window, IDynamicFormWindow
|
|
|
|
|
|
if (parent == null)
|
|
|
{
|
|
|
- Logger.Send(LogType.Error, "",
|
|
|
- $"Form parent is null; Form Type: {formInstance.GetType()}; Parent Type: {parenttype}; Form ID: {formInstance.ID}");
|
|
|
error = "An error occurred while loading the form: Form Entity is null";
|
|
|
+ errorDetails = $"Form parent is null; Form Type: {formInstance.GetType()}; Parent Type: {parenttype}; Form ID: {formInstance.ID}";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
+ {
|
|
|
error = "No layout found for form!";
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
- if (!String.IsNullOrWhiteSpace(error))
|
|
|
+ if (!error.IsNullOrWhiteSpace())
|
|
|
{
|
|
|
- MessageBox.Show(error);
|
|
|
+ if(errorDetails is null)
|
|
|
+ {
|
|
|
+ MessageWindow.ShowError(error, error, shouldLog: false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MessageWindow.ShowError(error, errorDetails);
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -444,7 +453,7 @@ public partial class DynamicFormEditWindow : Window, IDynamicFormWindow
|
|
|
{
|
|
|
if (DialogResult != true && HasUnsavedChanges)
|
|
|
{
|
|
|
- if (MessageBox.Show("This form has unsaved changes. Do you wish to discard them?", "Discard Changes?", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
|
|
+ if (!MessageWindow.ShowYesNo("This form has unsaved changes. Do you wish to discard them?", "Discard Changes?"))
|
|
|
{
|
|
|
e.Cancel = true;
|
|
|
}
|