mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-05 17:05:52 +08:00
Keep dev-3.0 content, discard master changes
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.Core.Models;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Ankang
|
||||
{
|
||||
public class ExitScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public ExitScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"西安局集团公司推出西铁行APP站车服务产品,欢迎体验使用。";
|
||||
ItemsPerPage = 7;
|
||||
ScreenCount = 1;
|
||||
StationType = StationType.Arrival;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,17 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.Core.Abstractions;
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.ScreenSimulator.Abstractions;
|
||||
using CRSim.ScreenSimulator.Models;
|
||||
using System.Windows;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace CRSim.ScreenSimulator.ViewModels
|
||||
{
|
||||
public partial class ScreenViewModel : ObservableObject
|
||||
public partial class BaseScreenViewModel : ObservableObject,IScreenViewModel
|
||||
{
|
||||
public readonly ITimeService _timeService;
|
||||
public ITimeService TimeService { get; set; }
|
||||
public readonly Settings _settings;
|
||||
public readonly TaskCompletionSource<bool> DataLoaded = new();
|
||||
[ObservableProperty]
|
||||
@@ -24,23 +26,26 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
private string _thisPlatform;
|
||||
[ObservableProperty]
|
||||
private string _thisTicketCheck;
|
||||
[ObservableProperty]
|
||||
private Uri _video;
|
||||
public ObservableCollection<TrainInfo> ScreenA { get; private set; } = [];
|
||||
public ObservableCollection<TrainInfo> ScreenB { get; private set; } = [];
|
||||
public ObservableCollection<TrainInfo> ScreenB { get; private set; } = [];
|
||||
public System.Windows.Threading.Dispatcher UIDispatcher { get; set; }
|
||||
|
||||
public List<TrainInfo> TrainInfo { get; set; } = [];
|
||||
|
||||
public StationType StationType = StationType.Both;
|
||||
|
||||
protected ScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
protected BaseScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
{
|
||||
|
||||
_timeService = timeService;
|
||||
TimeService = timeService;
|
||||
_settings = settingsService.GetSettings();
|
||||
|
||||
_timeService.OneSecondElapsed += OnTimeElapsed;
|
||||
TimeService.OneSecondElapsed += OnTimeElapsed;
|
||||
|
||||
_timeService.RefreshSecondsElapsed += RefreshData;
|
||||
_timeService.RefreshSecondsElapsed += RefreshDisplay;
|
||||
TimeService.RefreshSecondsElapsed += RefreshData;
|
||||
TimeService.RefreshSecondsElapsed += RefreshDisplay;
|
||||
Initialize();
|
||||
}
|
||||
[ObservableProperty]
|
||||
@@ -73,14 +78,14 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
{
|
||||
if (trainInfo.DepartureTime == null)
|
||||
{
|
||||
if (trainInfo.ArrivalTime.Value.Add(_settings.StopDisplayFromArrivalDuration) < _timeService.GetDateTimeNow())
|
||||
if (trainInfo.ArrivalTime.Value.Add(_settings.StopDisplayFromArrivalDuration) < TimeService.GetDateTimeNow())
|
||||
{
|
||||
itemsToRemove.Add(trainInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((StationType == StationType.Arrival || StationType == StationType.Both ? trainInfo.DepartureTime.Value : trainInfo.DepartureTime.Value.Subtract(_settings.StopDisplayUntilDepartureDuration)) < _timeService.GetDateTimeNow())
|
||||
if ((StationType == StationType.Arrival || StationType == StationType.Both ? trainInfo.DepartureTime.Value : trainInfo.DepartureTime.Value.Subtract(_settings.StopDisplayUntilDepartureDuration)) < TimeService.GetDateTimeNow())
|
||||
{
|
||||
itemsToRemove.Add(trainInfo);
|
||||
}
|
||||
@@ -95,14 +100,16 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
|
||||
private void OnTimeElapsed(object? sender, EventArgs e)
|
||||
{
|
||||
CurrentTime = _timeService.GetDateTimeNow();
|
||||
CurrentTime = TimeService.GetDateTimeNow();
|
||||
OnPropertyChanged(nameof(ScreenA));
|
||||
OnPropertyChanged(nameof(ScreenB));
|
||||
}
|
||||
|
||||
public void LoadData(Station station, string ticketCheck, string platform)
|
||||
public void LoadData(Station station, TicketCheck? ticketCheck, string platform)
|
||||
{
|
||||
ThisStation = station;
|
||||
ThisPlatform = platform;
|
||||
if (ticketCheck != string.Empty) ThisTicketCheck = ticketCheck.Split(" - ")[1];//重复检票口名称的临时解决方案
|
||||
ThisTicketCheck = ticketCheck?.Name;
|
||||
var trains = station.TrainStops;
|
||||
foreach (var trainNumber in trains)
|
||||
{
|
||||
@@ -111,10 +118,10 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
(StationType == StationType.Both ||
|
||||
trainNumber.StationType == StationType.Both ||
|
||||
StationType == trainNumber.StationType) &&
|
||||
(ticketCheck == string.Empty || (trainNumber.WaitingArea==ticketCheck.Split(" - ")[0] && trainNumber.TicketChecks.Contains(ticketCheck.Split(" - ")[1]))) &&//重复检票口名称的临时解决方案
|
||||
(ticketCheck == null || trainNumber.TicketCheckIds.Contains(ticketCheck.Id)) &&
|
||||
(platform == string.Empty || trainNumber.Platform == platform))
|
||||
{
|
||||
var now = _timeService.GetDateTimeNow();
|
||||
var now = TimeService.GetDateTimeNow();
|
||||
var today = now.Date;
|
||||
|
||||
if (_settings.LoadTodayOnly && today.Add((trainNumber.DepartureTime??trainNumber.ArrivalTime)!.Value) < now)
|
||||
@@ -132,12 +139,15 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
Origin = trainNumber.Origin,
|
||||
ArrivalTime = AdjustTime(trainNumber.ArrivalTime),
|
||||
DepartureTime = AdjustTime(trainNumber.DepartureTime),
|
||||
TicketChecks = trainNumber.TicketChecks,
|
||||
WaitingArea = trainNumber.StationType == StationType.Arrival ? string.Empty : trainNumber.WaitingArea,
|
||||
TicketChecks = [.. station.WaitingAreas
|
||||
.SelectMany(w => w.TicketChecks)
|
||||
.Where(tc => trainNumber.TicketCheckIds.Contains(tc.Id))
|
||||
.Select(tc => tc.Name)],
|
||||
WaitingArea = trainNumber.StationType == StationType.Arrival ? string.Empty : string.Join(" ", station.WaitingAreas.Where(x => x.TicketChecks.Any(y => trainNumber.TicketCheckIds.Contains(y.Id))).Select(x=>x.Name)),
|
||||
Platform = trainNumber.Platform,
|
||||
Length = trainNumber.Length,
|
||||
Landmark = trainNumber.Landmark,
|
||||
State = TimeSpan.Zero
|
||||
State = trainNumber.Status
|
||||
});
|
||||
|
||||
}
|
||||
@@ -155,7 +165,7 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
}
|
||||
public virtual void RefreshDisplay(object? sender, EventArgs e)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
UIDispatcher.Invoke(() =>
|
||||
{
|
||||
if (ScreenCount == null)
|
||||
{
|
||||
@@ -163,7 +173,7 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
{
|
||||
ScreenA.Add(TrainInfo.Count > i ? TrainInfo[i] : new());
|
||||
}
|
||||
if(ScreenA.Count > ItemsPerPage)
|
||||
if (ScreenA.Count > ItemsPerPage)
|
||||
{
|
||||
for (int i = 0; i < ItemsPerPage; i++)
|
||||
{
|
||||
@@ -1,14 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Beijing
|
||||
{
|
||||
public class ArrivalScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public ArrivalScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 2;
|
||||
StationType = StationType.Arrival;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.BeijingNan
|
||||
{
|
||||
public class PrimaryPlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryPlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.BeijingNan
|
||||
{
|
||||
public class PrimaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 10;
|
||||
ScreenCount = 1;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.BeijingNan
|
||||
{
|
||||
public class SecondaryPlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public SecondaryPlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.BeijingNan
|
||||
{
|
||||
public class TicketCheckScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public TicketCheckScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 2;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.BeijingXi
|
||||
{
|
||||
public class PrimaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 13;
|
||||
ScreenCount = 2;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.ScreenSimulator.Models;
|
||||
using System.Windows;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.ChengduDong
|
||||
{
|
||||
public partial class PillarTicketCheckScreenViewModel : ScreenViewModel
|
||||
{
|
||||
[ObservableProperty]
|
||||
private TrainInfo _firstTrain = new();
|
||||
[ObservableProperty]
|
||||
private TrainInfo _secondTrain = new();
|
||||
[ObservableProperty]
|
||||
private TrainInfo _checkingTrain = new();
|
||||
public PillarTicketCheckScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
public override void RefreshDisplay(object? sender, EventArgs e)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (TrainInfo.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var now = _timeService.GetDateTimeNow();
|
||||
var departureTime = TrainInfo[0].DepartureTime!.Value;
|
||||
|
||||
TimeSpan checkInStartOffset = TrainInfo[0].ArrivalTime is DateTime
|
||||
? _settings.PassingCheckInAdvanceDuration // 过路站
|
||||
: _settings.DepartureCheckInAdvanceDuration; // 始发站
|
||||
|
||||
bool checking = now > departureTime - checkInStartOffset && now < departureTime - _settings.StopCheckInAdvanceDuration;
|
||||
|
||||
if (checking)
|
||||
{
|
||||
CheckingTrain = TrainInfo[0];
|
||||
FirstTrain = TrainInfo.ElementAtOrDefault(1);
|
||||
SecondTrain = TrainInfo.ElementAtOrDefault(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckingTrain = null;
|
||||
if(now < departureTime && now > departureTime - _settings.StopCheckInAdvanceDuration)
|
||||
{
|
||||
FirstTrain = TrainInfo.ElementAtOrDefault(1);
|
||||
SecondTrain = TrainInfo.ElementAtOrDefault(2);
|
||||
return;
|
||||
}
|
||||
FirstTrain = TrainInfo.ElementAtOrDefault(0);
|
||||
SecondTrain = TrainInfo.ElementAtOrDefault(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.ChengduDong
|
||||
{
|
||||
public class PrimaryTicketCheckScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryTicketCheckScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = "持户口簿、护照、临时身份证的旅客,请在非居民身份证通道排队。请主动礼让老、弱、病、残、孕的旅客。";
|
||||
ItemsPerPage = 2;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.ChengduDong
|
||||
{
|
||||
public class SecondaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public SecondaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = " 检票口信息请以车站显示屏信息为准。公共场所请妥善保管个人贵重物品。";
|
||||
ItemsPerPage = 12;
|
||||
ScreenCount = 2;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.ChengduMetro
|
||||
{
|
||||
public class PlatformScreenViewModel : MetroPlatformScreenViewModel
|
||||
{
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService,settingsService)
|
||||
{
|
||||
Text = "不吃火锅,就吃烤匠。 建设成渝地区双城经济圈,共同唱好新时代西部“双城记”。 2018年2月8日,复兴号列车首次担当G89次列车,正式开进四川,标志着“复兴号”高速列车正式走上蜀道。然而,在行驶至西安北站时,发生了突发设备故障,车轴出现过热报警,导致车号为CR400BF-5033的复兴号列车被迫停运并进行检修。相关工作人员迅速展开故障排查,并确保乘客安全无虞。";
|
||||
Video = new("Assets\\Advertisement-1.mp4", UriKind.Relative);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.ChengduShuangliuAirport
|
||||
{
|
||||
public class SecondaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public SecondaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"国内航班截载时间为起飞前{settingsService.GetSettings().StopCheckInAdvanceDuration.TotalMinutes}分钟。";
|
||||
ItemsPerPage = 7;
|
||||
ScreenCount = 1;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.DaqingDong
|
||||
{
|
||||
public class ConcourseBridgeScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public ConcourseBridgeScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 3;
|
||||
StationType = StationType.Departure;
|
||||
timeService.RefreshSecondsElapsed += RefreshDisplay;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.DaqingDong
|
||||
{
|
||||
public class PlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 1;
|
||||
Text = $"请站在白色安全线以内排队候车";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.DezhouDong
|
||||
{
|
||||
public class PrimaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 10;
|
||||
ScreenCount = 1;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.Core.Models;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.DezhouDong
|
||||
{
|
||||
public class TicketCheckScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public TicketCheckScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 3;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.Core.Models;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Fuzhou
|
||||
{
|
||||
public class TicketCheckScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public TicketCheckScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"开车前{settingsService.GetSettings().StopCheckInAdvanceDuration.TotalMinutes}分钟停止检票";
|
||||
ItemsPerPage = 4;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.Core.Models;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.FuzhouNan
|
||||
{
|
||||
public class TicketCheckScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public TicketCheckScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"开车前{settingsService.GetSettings().StopCheckInAdvanceDuration.TotalMinutes}分钟停止检票";
|
||||
ItemsPerPage = 6;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.GuangdongIntercity
|
||||
{
|
||||
public class SecondaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public SecondaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"列 车 到 发 信 息";
|
||||
ItemsPerPage = 8;
|
||||
ScreenCount = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.Core.Models;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Guangyuan
|
||||
{
|
||||
public class PrimaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = "成都铁路客服电话:028-12306";
|
||||
ItemsPerPage = 12;
|
||||
ScreenCount = 1;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Hanzhong
|
||||
{
|
||||
public class PlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 1;
|
||||
Text = "请注意列车与站台之间的间隙,请勿携带危险品上车";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Harbin
|
||||
{
|
||||
public class PrimaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"开车前{settingsService.GetSettings().StopCheckInAdvanceDuration.TotalMinutes}分钟停止检票";
|
||||
ItemsPerPage = 6;
|
||||
ScreenCount = 2;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.HarbinXi
|
||||
{
|
||||
public class PlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"请在白线内行走,乘降列车时注意脚下站台与列车之间的空隙,看护好老人和儿童。";
|
||||
ItemsPerPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Jinanxi
|
||||
{
|
||||
public class SmallScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public SmallScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 9;
|
||||
ScreenCount = 1;
|
||||
StationType = StationType.Departure;
|
||||
SetText();
|
||||
}
|
||||
private async Task SetText()
|
||||
{
|
||||
await DataLoaded.Task;
|
||||
Text = $"{string.Join(" ", ThisStation.Name.ToCharArray())} 站 欢 迎 您";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.KunmingChangshuiAirport
|
||||
{
|
||||
public class PrimaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"如需要任何帮助,或有相关建议,请拨打96566。";
|
||||
ItemsPerPage = 20;
|
||||
ScreenCount = 1;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CRSim.Core.Abstractions;
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.ScreenSimulator.Abstractions;
|
||||
using CRSim.ScreenSimulator.Models;
|
||||
|
||||
namespace CRSim.ScreenSimulator.ViewModels
|
||||
{
|
||||
public partial class MetroPlatformScreenViewModel : ObservableObject
|
||||
public partial class MetroPlatformScreenViewModel : ObservableObject, IScreenViewModel
|
||||
{
|
||||
public readonly ITimeService _timeService;
|
||||
public ITimeService TimeService { get; set; }
|
||||
public readonly Settings _settings;
|
||||
[ObservableProperty]
|
||||
private DateTime _currentTime = new();
|
||||
@@ -19,17 +20,20 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
private string _text;
|
||||
[ObservableProperty]
|
||||
private Uri _video;
|
||||
[ObservableProperty]
|
||||
public int _location;
|
||||
public System.Windows.Threading.Dispatcher UIDispatcher { get; set; }
|
||||
public List<TrainInfo> TrainInfos { get; set; } = [];
|
||||
public MetroPlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
{
|
||||
_timeService = timeService;
|
||||
TimeService = timeService;
|
||||
_settings = settingsService.GetSettings();
|
||||
timeService.OneSecondElapsed += RefreshDisplay;
|
||||
}
|
||||
private void RefreshDisplay(object? sender, EventArgs e)
|
||||
{
|
||||
CurrentTime = _timeService.GetDateTimeNow();
|
||||
List<TrainInfo> itemsToRemove = [.. TrainInfos.Where(info => info.DepartureTime < _timeService.GetDateTimeNow())];
|
||||
CurrentTime = TimeService.GetDateTimeNow();
|
||||
List<TrainInfo> itemsToRemove = [.. TrainInfos.Where(info => info.DepartureTime < TimeService.GetDateTimeNow())];
|
||||
foreach (var item in itemsToRemove)
|
||||
{
|
||||
TrainInfos.Remove(item);
|
||||
@@ -40,14 +44,14 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
OnPropertyChanged(nameof(FirstTrain));
|
||||
OnPropertyChanged(nameof(SecondTrain));
|
||||
}
|
||||
public void LoadData(Station station, string _ticketCheck, string platform)
|
||||
public void LoadData(Station station, TicketCheck? _ticketCheck, string platform)
|
||||
{
|
||||
var trains = station.TrainStops;
|
||||
foreach (var trainNumber in trains)
|
||||
{
|
||||
if (trainNumber != null && trainNumber.DepartureTime != null && trainNumber.Platform == platform)
|
||||
{
|
||||
var now = _timeService.GetDateTimeNow();
|
||||
var now = TimeService.GetDateTimeNow();
|
||||
var today = now.Date;
|
||||
if (_settings.LoadTodayOnly && today.Add((trainNumber.DepartureTime ?? trainNumber.ArrivalTime)!.Value) < now)
|
||||
{
|
||||
@@ -62,7 +66,7 @@ namespace CRSim.ScreenSimulator.ViewModels
|
||||
Terminal = trainNumber.Terminal,
|
||||
ArrivalTime = AdjustTime(trainNumber.ArrivalTime),
|
||||
DepartureTime = AdjustTime(trainNumber.DepartureTime),
|
||||
State = TimeSpan.Zero
|
||||
State = trainNumber.Status
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Mianyang
|
||||
{
|
||||
public class PlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Niuzhou
|
||||
{
|
||||
public class PrimaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"开车前{settingsService.GetSettings().PassingCheckInAdvanceDuration.TotalMinutes}分钟开始检票,开车前{settingsService.GetSettings().StopCheckInAdvanceDuration.TotalMinutes}分钟停止检票。";
|
||||
ItemsPerPage = 10;
|
||||
ScreenCount = 1;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.Core.Models;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Shanghai
|
||||
{
|
||||
public class OutsideScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public OutsideScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 9;
|
||||
ScreenCount = 1;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.ShenyangBei
|
||||
{
|
||||
public class PlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Tianjin
|
||||
{
|
||||
public class PlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.TianjinMetro
|
||||
{
|
||||
public class PlatformScreenViewModel : MetroPlatformScreenViewModel
|
||||
{
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = "海河明珠闪耀津门,古今交融绘就华章。五大道镌刻百年风华,滨海新区涌动创新浪潮。狗不理飘香,相声茶馆笑声扬。意式风情街浪漫流淌,古文化街非遗绽放。生态宜居城,开放包容乡。天津卫,邀您共谱新时代乐章!";
|
||||
Video = new("Assets\\Advertisement-3.mp4", UriKind.Relative);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.XuzhouMetro
|
||||
{
|
||||
public class PlatformScreenViewModel : MetroPlatformScreenViewModel
|
||||
{
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = "徐州,一座镌刻华夏文明印记的英雄之城。这里是大汉王朝的摇篮,楚风汉韵流淌在云龙山水间,龟山汉墓诉说着千年的传奇,汉画像石馆定格了古人的智慧光影。九里山前古战场,戏马台边秋风烈,历史的豪情从未褪色。作为五省通衢的枢纽,徐州以开放的胸怀连接南北,高铁飞驰、运河如练,现代脉动与古朴底蕴在此交融。登云龙山俯瞰一城青山半城湖,泛舟云龙湖感受水墨诗意;户部山的街巷藏着老徐州的烟火气,回龙窝的灯火点亮了夜色温柔。从地锅鸡的鲜香到饣它汤的醇厚,从酥脆的烙馍到清甜的蜜三刀,舌尖上的彭城满是热情滋味。这里是淮海之芯,用智造之光照亮未来,用楚汉气魄续写新章——徐州,等你共赴一场跨越时空的约定!";
|
||||
Video = new("Assets\\Advertisement-2.mp4", UriKind.Relative);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Zibo
|
||||
{
|
||||
public class ConcourseBridgeScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public ConcourseBridgeScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
StationType = StationType.Departure;
|
||||
ItemsPerPage = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Zibo
|
||||
{
|
||||
public class PlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"请站在白色安全线以内排队候车";
|
||||
ItemsPerPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Zibo
|
||||
{
|
||||
public class PrimaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 8;
|
||||
ScreenCount = 2;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Zibo
|
||||
{
|
||||
public class SecondaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public SecondaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"开车前{settingsService.GetSettings().StopCheckInAdvanceDuration.TotalMinutes}分钟停止检票";
|
||||
ItemsPerPage = 18;
|
||||
ScreenCount = 1;
|
||||
StationType = StationType.Departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.ScreenSimulator.Models;
|
||||
using System.Windows;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Zibo
|
||||
{
|
||||
public class TicketCheckScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public TicketCheckScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $" 开车前{settingsService.GetSettings().StopCheckInAdvanceDuration.TotalMinutes}分钟停止检票";
|
||||
StationType = StationType.Departure;
|
||||
ItemsPerPage = 5;
|
||||
ScreenCount = 2;
|
||||
}
|
||||
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