using Microsoft.AspNetCore.Components; using MP.SPEC.Components; using MP.SPEC.Data; namespace MP.SPEC.Pages { public partial class PARAMS { #region Protected Fields protected DataPager pagerODL = null!; #endregion Protected Fields #region Protected Properties [Inject] protected MessageService MsgService { get; set; } = null!; #endregion Protected Properties #region Protected Methods protected void ForceReload(int newNum) { numRecord = newNum; } protected void ForceReloadPage(int newNum) { currPage = newNum; currFilter.lastUpdate= $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}"; currFilter.LiveUpdate = (currPage == 1); StateHasChanged(); } protected override async Task OnInitializedAsync() { isLoading = true; isFiltering = true; // disabilito ricerca... MsgService.SearchVal = ""; MsgService.ShowSearch = false; // fix pagina await Task.Delay(1); var modFilter = currFilter; modFilter.CurrPage = 1; modFilter.LiveUpdate = (currPage == 1); currFilter = modFilter; await Task.Delay(1); isFiltering = false; } protected async Task pgResetReq(bool doReset) { if (doReset) { await pagerODL.resetCurrPage(); } } protected void updateTotal(int newTotCount) { totalCount = newTotCount; } #endregion Protected Methods #region Private Fields #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; } = true; private bool isFiltering { get; set; } = false; private int numRecord { get => MsgService.numRecord; set => MsgService.numRecord = value; } private int totalCount { get; set; } = 0; #endregion Private Properties #region Private Methods private async Task updateFilter(SelectFluxParams newParams) { isFiltering = false; isLoading = true; await Task.Delay(1); currPage = 1; if (newParams.CurrPage == 0) { newParams.CurrPage = 1; newParams.LiveUpdate = false; } else { newParams.LiveUpdate = (currPage == 1); } await Task.Delay(1); await InvokeAsync(() => StateHasChanged()); currFilter = newParams; isLoading = false; } #endregion Private Methods } }