blazor-utilities icon indicating copy to clipboard operation
blazor-utilities copied to clipboard

Syncfusion Toast

Open JasminSAB opened this issue 2 years ago • 1 comments

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.

JasminSAB avatar Nov 12 '23 17:11 JasminSAB

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.

mxmissile avatar Apr 04 '24 17:04 mxmissile