Files
Samuele Locatelli 62fb0e38b3 SPEC:
- Completo gestione Template KIT
2025-04-10 08:09:11 +02:00

68 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP.SPEC;
using MP.SPEC.Shared;
using MP.SPEC.Components;
using MP.SPEC.Data;
using System.Text;
namespace MP.SPEC.Pages
{
public partial class TestBtn
{
[Inject]
protected MsgServiceSpec MService { get; set; } = null!;
public EventCallback<string> newBcMsg { get; set; }
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
MService.EA_BroadCastMsg += OnNewBCMsg;
}
public async void OnNewBCMsg()
{
await InvokeAsync(() =>
{
StateHasChanged();
});
}
StringBuilder sb = new StringBuilder();
protected async Task addOne()
{
await Task.Delay(1);
sb.Append("1");
countMsg = sb.ToString();
}
public string countMsg
{
get
{
return MService.newBCMsg;
}
set
{
MService.newBCMsg = value;
reportChange();
}
}
private void reportChange()
{
newBcMsg.InvokeAsync(countMsg);
}
}
}