using Microsoft.AspNetCore.Components; using MP.Data.DatabaseModels; using MP.Stats.Data; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace MP.Stats.Components { public partial class TaskExeList { #region Public Properties [Parameter] public TaskListModel? CurrRecord { get; set; } = null; #endregion Public Properties #region Protected Fields protected bool isLoading = false; #endregion Protected Fields #region Protected Properties [Inject] protected NavigationManager NavManager { get; set; } /// /// Show error mode: 0 = tutti 1 = solo errori 2 = solo ok /// protected int ShowErrorMode { get; set; } = 0; [Inject] protected MpStatsService StatService { get; set; } protected int totalCount { get; set; } = 0; #endregion Protected Properties #region Protected Methods protected async Task ForceReload(int newNum) { numRecord = newNum; await ReloadData(); } protected async Task ForceReloadPage(int newNum) { currPage = newNum; await ReloadData(); } protected override async Task OnInitializedAsync() { await ReloadData(); } #endregion Protected Methods #region Private Fields private List ListRecords; private List SearchRecords; #endregion Private Fields #region Private Properties private int currPage { get; set; } = 1; private int numRecord { get; set; } = 10; #endregion Private Properties #region Private Methods private async Task ReloadData() { SearchRecords = await StatService.TaskExecGetFilt(CurrRecord.TaskId, 1000, ""); totalCount = SearchRecords.Count; ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); } #endregion Private Methods } }