internal async void HandleSubmit_Clicked(object? sender, EventArgs e)
{
try
{
bool Valid = await ValidFormAsync();
if (Valid)
{
_dataForm.OnSubmissionComplete(this, new SubmissionCompletedEventArgs(_dataForm.GetData(), _dataForm.Mode));
SubmissionCompleted?.Invoke(this, new SubmissionCompletedEventArgs(_dataForm.GetData(), _dataForm.Mode));
}
}
catch (Exception ex)
{
_logger.LogError("Submission Failed due to: {Exception}", ex.Message);
_dataForm.ShowMessageBox("Submission Failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
protected virtual async Task<bool> ValidFormAsync()
{
_logger.LogCritical("ValidFormAsync is running in parent. Child must override it.");
await Task.Delay(100);
return true;
}
internal async void HandleSubmit_Clicked(object? sender, EventArgs e)
{
try
{
bool Valid = await ValidFormAsync();
if (Valid)
{
_dataForm.OnSubmissionComplete(this, new SubmissionCompletedEventArgs(_dataForm.GetData(), _dataForm.Mode));
SubmissionCompleted?.Invoke(this, new SubmissionCompletedEventArgs(_dataForm.GetData(), _dataForm.Mode));
}
}
catch (Exception ex)
{
_logger.LogError("Submission Failed due to: {Exception}", ex.Message);
_dataForm.ShowMessageBox("Submission Failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
protected virtual async Task<bool> ValidFormAsync()
{
_logger.LogCritical("ValidFormAsync is running in parent. Child must override it.");
await Task.Delay(100);
return true;
}