blazor-utilities
blazor-utilities copied to clipboard
Syncfusion Toast
Hi,
I am using WASM 7.0,
protected override async Task OnInitializedAsync()
{
await GetWorkers();
// this part of code works, and the toast notification is displayed
await ToastObj.ShowAsync(new ToastModel { Title = "aaa", Content = "bbb", CssClass = "ff", Icon = "ff", ShowCloseButton = true });
MessagingCenter.Subscribe<WorkersForm, ToastResultNotification>(this, "dodaj_moju_uslugu", async (sender, args) =>
{
// args object = is resolved and subscribe works ok, but, toast notification is not displayed
await ToastObj.ShowAsync(new ToastModel { Title = args.Title, Content = args.Content, CssClass = args.CssClass, Icon = args.Icon, ShowCloseButton = true });
StateHasChanged();
});
}
Need some help :) thank you.
ToastObj.ShowAsync has to be called in the UI thread. MessagingCenter's callback is on a different thread. This can be solved using a static EventHandler somewhere in your app.