mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-07 10:05:49 +08:00
feat: 添加了淄博站出站口看板
This commit is contained in:
@@ -142,7 +142,14 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
|
||||
}
|
||||
}
|
||||
TrainInfo = [.. TrainInfo.OrderBy(x => x.DepartureTime??x.ArrivalTime)];
|
||||
if(StationType == StationType.Arrival)
|
||||
{
|
||||
TrainInfo = [.. TrainInfo.OrderBy(x => x.ArrivalTime??x.DepartureTime)];
|
||||
}
|
||||
else
|
||||
{
|
||||
TrainInfo = [.. TrainInfo.OrderBy(x => x.DepartureTime??x.ArrivalTime)];
|
||||
}
|
||||
RefreshData(null, null);
|
||||
DataLoaded.SetResult(true);
|
||||
}
|
||||
|
||||
48
CRSim.ScreenSimulator/ViewModels/Zibo/ExitScreenViewModel.cs
Normal file
48
CRSim.ScreenSimulator/ViewModels/Zibo/ExitScreenViewModel.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.ScreenSimulator.Models;
|
||||
using System.Windows;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Zibo
|
||||
{
|
||||
public class ExitScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public ExitScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"温馨提示:请接站的旅客在出站口外耐心等候";
|
||||
ItemsPerPage = 6;
|
||||
ScreenCount = 2;
|
||||
StationType = StationType.Arrival;
|
||||
}
|
||||
public override void RefreshDisplay(object? sender, EventArgs? e)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
int pageCount = (int)Math.Ceiling((double)TrainInfo.Count / (ItemsPerPage * ScreenCount.Value));
|
||||
ScreenA.Clear();
|
||||
ScreenB.Clear();
|
||||
int startIndex = CurrentPageIndex * ItemsPerPage * ScreenCount.Value;
|
||||
var ItemsToShow = TrainInfo.Skip(startIndex).Take(ItemsPerPage * ScreenCount.Value).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)
|
||||
{
|
||||
ScreenA.Add(item);
|
||||
}
|
||||
foreach (var item in rightItems)
|
||||
{
|
||||
ScreenB.Add(item);
|
||||
}
|
||||
CurrentPageIndex = CurrentPageIndex + 1 >= Math.Min(_settings.MaxPages, pageCount) ? 0 : CurrentPageIndex + 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user