Message service

The IMessageService is a powerful helper utility built on top of Modal component and is used for showing the messages and confirmation dialogs to the user.

Usage

Wrapper

IMessageService is automatically registered by Blazorise but it needs just one thing on your side to make it work. You need to place <MessageAlert> somewhere in your application razor code. It can be placed anywhere, but a good approach is to place it in App.razor like in the following example.
<Router AppAssembly="typeof(App).Assembly">
    ...
</Router>

<MessageAlert />

Basic example

<Button Color="Color.Primary" Clicked="@ShowInfoMessage">Say hi!</Button>
<Button Color="Color.Danger" Clicked="@ShowConfirmMessage">Confirm</Button>
@code{
    [Inject] IMessageService MessageService { get; set; }

    Task ShowInfoMessage()
    {
        return MessageService.Info( "This is a simple info message!", "Hello" );
    }

    async Task ShowConfirmMessage()
    {
        if ( await MessageService.Confirm( "Are you sure you want to confirm?", "Confirmation" ) )
        {
            Console.WriteLine( "OK Clicked" );
        }
        else
        {
            Console.WriteLine( "Cancel Clicked" );
        }
    }
}