- Ulteriori modifiche a paginazione e filtri nuova finestra apri

This commit is contained in:
Emmanuele Sassi
2023-10-16 18:20:53 +02:00
parent 0c73db4f52
commit 9eb30b0697
5 changed files with 231 additions and 10 deletions
@@ -157,9 +157,9 @@ Public Class NewOpenProjectFileDialogVM
Public Overrides Function UpdatePageList() As Boolean
Dim FilteredList As IEnumerable(Of Core.ProdItem) = m_ProjectList.Where(Function(x)
If m_SelFilterType.Id <> FilterTypes.NULL AndAlso m_SearchText <> String.Empty AndAlso
((m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso x.ProjFileList.Any(Function(y) DirectCast(y, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso x.ProjFileList.Any(Function(y) DirectCast(y, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso x.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then Return False
((m_SelFilterType.Id = FilterTypes.BTLFILENAME AndAlso x.ProjFileList.Any(Function(y) DirectCast(y, ProjFileVM).sBTLFileName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
(m_SelFilterType.Id = FilterTypes.LISTNAME AndAlso x.ProjFileList.Any(Function(y) DirectCast(y, ProjFileVM).sListName.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) OrElse
(m_SelFilterType.Id = FilterTypes.MACHINE AndAlso x.sMachine.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) < 0)) Then Return False
Return True
End Function)
Dim nPageRowQty As Integer = 0
@@ -171,12 +171,17 @@ Public Class NewOpenProjectFileDialogVM
Case RowQuantities.THIRTY
nPageRowQty = 30
End Select
Dim nStart = nPageIndex * nPageRowQty
If (nPageIndex - 1) * nPageRowQty + 1 > FilteredList.Count() Then
Dim nStart = (nPageIndex - 1) * nPageRowQty
Dim nEnd = Math.Min((nPageIndex * nPageRowQty), FilteredList.Count())
If nStart > FilteredList.Count() Then
Return False
End If
' FilteredList = FilteredList.OrderBy(Of ProdItem)()
m_PageList = New ObservableCollection(Of Core.ProdItem)(FilteredList.Skip((nPageIndex - 1) * nPageRowQty + 1).Take(nPageIndex * nPageRowQty).Select(Function(x) x))
m_PageList = New ObservableCollection(Of ProdItem)(FilteredList.Skip(nStart).Take(nPageRowQty).Select(Function(x) x))
'm_PageList.Clear()
'For Index = nStart To nEnd
' m_PageList.Add(FilteredList(Index))
'Next
NotifyPropertyChanged(NameOf(PageList))
Return True