Refactor signature popup handling in ReportViewer

Simplified the `OpenSignaturePopupAsync` method by converting it to a synchronous `void` method and removing unnecessary asynchronous calls. Introduced a new `OnPopupShownAsync` method to handle popup initialization logic.

Updated the `<Popup>` component to include the `Shown="OnPopupShownAsync"` attribute and re-added the `CloseOnOutsideClick="false"` attribute. Improved the logic for opening the signature popup by setting the active tab and resetting validation messages inline.

Enhanced the `OnAfterRenderAsync` lifecycle method to include additional checks for `Report`, annotations, and signature state before triggering JavaScript runtime calls. These changes improve the popup's behavior and overall state management.
This commit is contained in:
2026-06-01 02:56:51 +02:00
parent 1bdceb8b42
commit 638c6f3291

View File

@@ -96,7 +96,8 @@ Width="620px"
ShowFooter="true"
CloseOnEscape="false"
ShowCloseButton="false"
CloseOnOutsideClick="false">
CloseOnOutsideClick="false"
Shown="OnPopupShownAsync">
<BodyContentTemplate>
<ul class="nav nav-tabs mb-3">
<li class="nav-item">
@@ -235,7 +236,10 @@ CloseOnOutsideClick="false">
}
else
{
await OpenSignaturePopupAsync();
ActiveSignatureTab = SignatureTabDraw;
SignaturePopupVisible = true;
SignatureValidationMessage = null;
PopupValidationMessage = null;
}
}
@@ -255,6 +259,7 @@ CloseOnOutsideClick="false">
if (firstRender)
_dotNetRef = DotNetObjectReference.Create(this);
if (Report is not null && _annotations.Count > 0
&& _capturedSignature is not null && !SignatureApplied
&& _lastOverlayViewerKey != ViewerKey) {
@@ -274,13 +279,14 @@ CloseOnOutsideClick="false">
await InvokeAsync(StateHasChanged);
}
async Task OpenSignaturePopupAsync() {
void OpenSignaturePopupAsync() {
ActiveSignatureTab = SignatureTabDraw;
SignaturePopupVisible = true;
SignatureValidationMessage = null;
PopupValidationMessage = null;
await InvokeAsync(StateHasChanged);
await Task.Delay(50);
}
async Task OnPopupShownAsync() {
await InitializeActiveSignatureTabAsync();
}