public async Task <List <object> > PagingAsync(CancellationToken token, IEnumerable <object> objList, int countPerPage, PagingPosition position) { try { while (!IsHandleCreated) { if (token.IsCancellationRequested || IsDisposed) { return(null); } await Task.Delay(100); } if (countPerPage <= 0) { countPerPage = int.MaxValue; } if (IsDisposed || token.IsCancellationRequested) { return(null); } BeginInvoke(new Action(() => { try { TxtTopCount.ValueChanged -= TxtTopCount_ValueChanged; TxtTopCount.Maximum = int.MaxValue; TxtTopCount.Minimum = 1; TxtTopCount.Value = countPerPage; TxtTopCount.ValueChanged += TxtTopCount_ValueChanged; } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } })); CurrentPage = countPerPage; list = objList?.ToList(); _ = Task.Run(() => PaggerAsync(token, objList, position)); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } return(null); }
/// <summary> /// Constructeur par défaut, initialisation des valeurs par défaut. /// </summary> public ExtGridEntity() { // Format par défaut _Format = FormatConfig.DefaultFormat; // Tri activé _Sortable = true; // 20 items par page, par défaut _PageSize = 20; // Hauteur minimale pour voir quelque chose //(avec 0 barre : 6 entrées; 1 barre : 5 entrées; 2 barres : 4 entrées; -1 s'il y a les barres de défilement) _Height = 200; // Largeur par défaut pour avoir une Top/Bottombar lisible, avec tous ses messages _Width = 375; // Pas de barre de pagination par défaut _PagingPosition = PagingPosition.None; // Pas de masque par défaut _ShowMask = false; _HeightMinus = Int16.MinValue; // Pour éviter les NullReferenceException, au cas où _Columns = new List<ExtGridColumn>(); // Affichage de la tooltip _ShowTooltip = true; _TooltipDelay = 0; _ColTooltipIsColName = false; }