public async Task <bool> NotifySubmit(IStringLocalizer <MComponentsLocalization> pLocalizer) { if (OnFormSubmit == null) { return(true); } bool submitSuccessful = true; try { await mLocker.WaitAsync(); var args = new MFormContainerContextSubmitArgs() { UserInterated = true }; foreach (AsyncEventHandler <MFormContainerContextSubmitArgs> handler in OnFormSubmit.GetInvocationList()) { try { await handler(this, args); } catch (Exception e) { Console.WriteLine("Error in the handler {0}: {1}", handler.Method.Name, e.Message); string msg = e.ToString(); if (e is TargetInvocationException te) { msg = te.InnerException.ToString(); if (te.InnerException is UserMessageException ue) { msg = ue.Message; } } Notificator.InvokeNotification(true, msg); submitSuccessful = false; } } if (FormContainer.OnAfterAllFormsSubmitted.HasDelegate) { await FormContainer.OnAfterAllFormsSubmitted.InvokeAsync(new MFormContainerAfterAllFormsSubmittedArgs() { AllFormsSuccessful = submitSuccessful }); } Notificator.InvokeNotification(false, pLocalizer["Gespeichert!"]); } finally { mLocker.Release(); } return(submitSuccessful); }