mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-10 19:46:08 +08:00
feat: 添加福州南站检票口看板
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.ScreenSimulator.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
using CRSim.Core.Models;
|
||||
using System.Windows;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.FuzhouNan
|
||||
{
|
||||
public class TicketCheckScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public ObservableCollection<TrainInfo> Screen { get; set; } = [];
|
||||
public TicketCheckScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"开车前{settingsService.GetSettings().StopCheckInAdvanceDuration.TotalMinutes}分钟停止检票";
|
||||
StationType = StationType.Departure;
|
||||
timeService.RefreshSecondsElapsed += RefreshDisplay;
|
||||
Initialize();
|
||||
}
|
||||
private async void Initialize()
|
||||
{
|
||||
ItemsPerPage = 6;
|
||||
await WaitForDataLoadAsync();
|
||||
RefreshDisplay(null,null);
|
||||
}
|
||||
private void RefreshDisplay(object? sender, EventArgs e)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Screen.Clear();
|
||||
for (int i = 0; i < ItemsPerPage; i++)
|
||||
{
|
||||
Screen.Add(TrainInfo.Count > i ? TrainInfo[i] : new());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user