using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MP.SPEC.Components; using MP.SPEC.Data; namespace MP.SPEC.Pages { public partial class PARAMS { #region Protected Fields #if false protected string _selFlux = "*"; protected string _selMacchina = "*"; protected string lastUpdate = "-"; protected bool reqNew = false; [Inject] protected IJSRuntime JSRuntime { get; set; } [Inject] protected MpDataService MDService { get; set; } #endif protected DataPager pagerODL; #endregion Protected Fields #region Protected Properties #if false protected bool liveUpdate { get; set; } = true; #endif [Inject] protected MessageService MsgService { get; set; } #if false [Inject] protected NavigationManager NavManager { get; set; } #endif #endregion Protected Properties #region Protected Methods protected void ForceReload(int newNum) { numRecord = newNum; } protected void ForceReloadPage(int newNum) { currPage = newNum; currFilter.LiveUpdate = (currPage == 1); } protected override async Task OnInitializedAsync() { isLoading = true; // abilito ricerca... MsgService.ShowSearch = false; // resetto search MsgService.SearchVal = ""; #if false // carico dati lastUpdate = $"Updated: {DateTime.Now:yyyy/MM/dd HH:mm:ss}"; await reloadFilters(); await reloadData(); #endif isLoading = false; } protected async Task pgResetReq(bool doReset) { if (doReset) { await pagerODL.resetCurrPage(); } } protected void updateTotal(int newTotCount) { //await Task.Delay(1); totalCount = newTotCount; } #endregion Protected Methods #region Private Fields private int _totalCount = 0; #endregion Private Fields #region Private Properties private SelectFluxParams currFilter { get; set; } = new SelectFluxParams(); private int currPage { get => MsgService.currPage; set => MsgService.currPage = value; } private bool isLoading { get; set; } = false; private int numRecord { get => MsgService.numRecord; set => MsgService.numRecord = value; } private int totalCount { get => _totalCount; set => _totalCount = value; //get => MsgService.totalCount; //set => MsgService.totalCount = value; } #endregion Private Properties #region Private Methods #if false private async Task reloadData() { isLoading = true; await Task.Delay(1); if (!liveUpdate) { lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}"; } isLoading = false; await Task.Delay(1); } #endif private async Task updateFilter(SelectFluxParams newParams) { isLoading = true; currFilter = newParams; currFilter.LiveUpdate = !currFilter.LiveUpdate; #if false liveUpdate = newParams.LiveUpdate; #endif await Task.Delay(1); await InvokeAsync(() => StateHasChanged()); //await Task.Delay(1); #if false selMacchina = newParams.IdxMacchina; selFlux = newParams.CodFlux; //ForceReloadPage(); await InvokeAsync(() => StateHasChanged()); #endif isLoading = false; } #endregion Private Methods } }