fix: 修复显示对象

This commit is contained in:
denglihong2007
2025-04-05 16:56:43 +08:00
parent e81155efe4
commit 66618f4c55
2 changed files with 7 additions and 7 deletions

View File

@@ -32,21 +32,21 @@ namespace CRSim.ScreenSimulator.ViewModels.Zibo
LeftScreen.Clear();
RightScreen.Clear();
int startIndex = CurrentPageIndex * ItemsPerPage * PageCount;
var leftItems = TrainInfo.Skip(startIndex).Take(ItemsPerPage).ToList();
var rightItems = TrainInfo.Skip(startIndex+1).Take(ItemsPerPage).ToList();
while (leftItems.Count+rightItems.Count < ItemsPerPage*2)
var ItemsToShow = TrainInfo.Skip(startIndex).Take(ItemsPerPage * PageCount).ToList();
var leftItems = ItemsToShow.Where((item, index) => index % 2 == 0).ToList();
var rightItems = ItemsToShow.Where((item, index) => index % 2 == 1).ToList();
while (leftItems.Count < ItemsPerPage)
{
leftItems.Add(new TrainInfo());
}
while (rightItems.Count < ItemsPerPage)
{
rightItems.Add(new TrainInfo());
}
foreach (var item in leftItems)
{
LeftScreen.Add(item);
}
// while (rightItems.Count < ItemsPerPage)
// {
// rightItems.Add(new TrainInfo());
// }
foreach (var item in rightItems)
{
RightScreen.Add(item);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 28 KiB