最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Why is the OnLoggedOn function in XAFBlazor called twice? - Stack Overflow

programmeradmin1浏览0评论

I am building a server sided project in ASP.NET Core Blazor using the DevExpress XAF framework and I wanted to override the OnLoggedOn function to show a SweetAlert2 JavaScript popup.
The problem is that the popup sometimes (doesn't happen every time) loads twice because the OnLoggedOn I guess is called twice? I can't seem to find where the issue is.
Here is my code:

protected override async void OnLoggedOn(LogonEventArgs args)
{
    base.OnLoggedOn(args);
    
    _jsRuntime = ServiceProvider.GetService<IJSRuntime>();
    _userService = ServiceProvider.GetService<UserService>();
    await _jsRuntime.InvokeVoidAsync("showVersionUpdate",CancellationToken.None, version);
    _ = Task.Run(async () =>
    { 
        await _userService.SynchronizeAgents();
    });
}

By the way, is the OnLoggedOn function called every time the page refreshes?

发布评论

评论列表(0)

  1. 暂无评论