NotificationService.Notify Question

Will the code that I am displaying below allow me to show and remove a persistent notification dialog before and after a method is executed? If not, do you have a suggestion as to how I might do so?

using Microsoft.JSInterop;
using Radzen;

namespace VisionSuiteShipManagerServer.Components
{
///


/// Class NotificationHelper.
///

public static class NotificationHelper
{
///
/// Shows the notification.
///

/// The JS runtime.
/// The notification service.
/// The summary message.
/// The detail message.
/// The display duration.
/// Type of the message.
/// The millisecondsDelay argument is less than -1.
public static async Task ShowNotification(IJSRuntime jsRuntime, NotificationService notificationService,
string summaryMessage, string detailMessage, double? displayDuration = 0,
NotificationSeverity messageType = NotificationSeverity.Info)
{
// Display the notification message
notificationService.Notify(new NotificationMessage
{
Severity = NotificationSeverity.Info,
Summary = summaryMessage,
Detail = detailMessage,
Duration = displayDuration // Set duration to 0 to make it persistent
});

        await jsRuntime.InvokeVoidAsync("eval", "document.body.style.cursor = 'wait'").ConfigureAwait(false);
        await Task.Delay(100).ConfigureAwait(false);
    }

    /// <summary>
    /// Clears the notification.
    /// </summary>
    /// <param name="jsRuntime">The JS runtime.</param>
    /// <param name="notificationService">The notification service.</param>
    /// <exception cref="ArgumentOutOfRangeException">The millisecondsDelay argument is less than -1.</exception>
    public static async Task ClearNotification(IJSRuntime jsRuntime, NotificationService notificationService)
    {
        // Clear the notification message by displaying an empty notification
        notificationService.Notify(new NotificationMessage
        {
            Severity = NotificationSeverity.Info,
            Summary = "",
            Detail = "",
            Duration = 1 // Set duration to 1 millisecond to clear the notification
        });

        await jsRuntime.InvokeVoidAsync("eval", "document.body.style.cursor = 'default'").ConfigureAwait(false);
        await Task.Delay(100).ConfigureAwait(false);
    }
}

}

Hi @FastTrak,

That's one way to do that. You can also check this approach which uses the dialog: Blazor Dialog Component | Free UI Components by Radzen