diff --git a/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj b/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj
index 2ffa811..6799b35 100644
--- a/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj
+++ b/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj
@@ -31,6 +31,9 @@
Code
+
+ Code
+
Code
diff --git a/CRSim.ScreenSimulator/Converters/MetroDateTimeToStringConverter.cs b/CRSim.ScreenSimulator/Converters/MetroDateTimeToStringConverter.cs
index 91d247b..4349e1a 100644
--- a/CRSim.ScreenSimulator/Converters/MetroDateTimeToStringConverter.cs
+++ b/CRSim.ScreenSimulator/Converters/MetroDateTimeToStringConverter.cs
@@ -10,6 +10,9 @@ namespace CRSim.ScreenSimulator.Converters
public class MetroDateTimeToStringConverter : IValueConverter
{
private ITimeService _timeService;
+ public string WaitingText { get; set; } = "请耐心等待";
+ public string ComingText { get; set; } = "即将进站";
+ public string ArrivedText { get; set; } = "列车进站";
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
var serviceProvider = (IServiceProvider)Application.Current.Resources["ServiceProvider"];
@@ -18,7 +21,7 @@ namespace CRSim.ScreenSimulator.Converters
{
if(trainInfo.TrainNumber == null)
{
- return "请耐心等待";
+ return WaitingText;
}
var timeDifference = (trainInfo.ArrivalTime ?? DateTime.MinValue) - _timeService.GetDateTimeNow();
bool isArrivalTimeNull = trainInfo.ArrivalTime == null;
@@ -31,10 +34,10 @@ namespace CRSim.ScreenSimulator.Converters
{
if(trainInfo.ArrivalTime - _timeService.GetDateTimeNow() > TimeSpan.Zero)
{
- return "即将进站";
+ return ComingText;
}
}
- return "列车进站";
+ return ArrivedText;
}
}
else
diff --git a/CRSim.ScreenSimulator/ViewModels/Windows/Stations/ChengduMetro/PlatformScreenViewModel.cs b/CRSim.ScreenSimulator/ViewModels/Windows/Stations/ChengduMetro/PlatformScreenViewModel.cs
index 2cbaa68..03b3fef 100644
--- a/CRSim.ScreenSimulator/ViewModels/Windows/Stations/ChengduMetro/PlatformScreenViewModel.cs
+++ b/CRSim.ScreenSimulator/ViewModels/Windows/Stations/ChengduMetro/PlatformScreenViewModel.cs
@@ -16,7 +16,7 @@ namespace CRSim.ScreenSimulator.ViewModels.ChengduMetro
[ObservableProperty]
private string _text = "不吃火锅,就吃烤匠。 建设成渝地区双城经济圈,共同唱好新时代西部“双城记”。 2018年2月8日,复兴号列车首次担当G89次列车,正式开进四川,标志着“复兴号”高速列车正式走上蜀道。然而,在行驶至西安北站时,发生了突发设备故障,车轴出现过热报警,导致车号为CR400BF-5033的复兴号列车被迫停运并进行检修。相关工作人员迅速展开故障排查,并确保乘客安全无虞。";
[ObservableProperty]
- private Uri _video = new("Assets\\Advertisement.mp4", UriKind.Relative);
+ private Uri _video = new("Assets\\Advertisement-1.mp4", UriKind.Relative);
public List TrainInfos { get; set; } = [];
public PlatformScreenViewModel(ITimeService timeService)
@@ -24,12 +24,12 @@ namespace CRSim.ScreenSimulator.ViewModels.ChengduMetro
_timeService = timeService;
timeService.OneSecondElapsed += RefreshDisplay;
}
- public void LoadData(Station station,string _ticketCheck,string _platform)
+ public void LoadData(Station station,string _ticketCheck,string platform)
{
var trains = station.TrainStops;
foreach (var trainNumber in trains)
{
- if (trainNumber != null && trainNumber.DepartureTime != null)
+ if (trainNumber != null && trainNumber.DepartureTime != null && trainNumber.Platform==platform)
{
var now = _timeService.GetDateTimeNow();
var today = now.Date;
diff --git a/CRSim.ScreenSimulator/ViewModels/Windows/Stations/XuzhouMetro/PlatformScreenViewModel.cs b/CRSim.ScreenSimulator/ViewModels/Windows/Stations/XuzhouMetro/PlatformScreenViewModel.cs
new file mode 100644
index 0000000..82f9528
--- /dev/null
+++ b/CRSim.ScreenSimulator/ViewModels/Windows/Stations/XuzhouMetro/PlatformScreenViewModel.cs
@@ -0,0 +1,68 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using CRSim.Core.Models;
+using CRSim.Core.Services;
+using CRSim.ScreenSimulator.Models;
+namespace CRSim.ScreenSimulator.ViewModels.XuzhouMetro
+{
+ public partial class PlatformScreenViewModel : ObservableObject
+ {
+ private readonly ITimeService _timeService;
+ [ObservableProperty]
+ private DateTime _currentTime = new();
+ [ObservableProperty]
+ private TrainInfo _firstTrain = new();
+ [ObservableProperty]
+ private TrainInfo _secondTrain = new();
+ [ObservableProperty]
+ private string _text = "徐州,一座镌刻华夏文明印记的英雄之城。这里是大汉王朝的摇篮,楚风汉韵流淌在云龙山水间,龟山汉墓诉说着千年的传奇,汉画像石馆定格了古人的智慧光影。九里山前古战场,戏马台边秋风烈,历史的豪情从未褪色。作为五省通衢的枢纽,徐州以开放的胸怀连接南北,高铁飞驰、运河如练,现代脉动与古朴底蕴在此交融。登云龙山俯瞰一城青山半城湖,泛舟云龙湖感受水墨诗意;户部山的街巷藏着老徐州的烟火气,回龙窝的灯火点亮了夜色温柔。从地锅鸡的鲜香到饣它汤的醇厚,从酥脆的烙馍到清甜的蜜三刀,舌尖上的彭城满是热情滋味。这里是淮海之芯,用智造之光照亮未来,用楚汉气魄续写新章——徐州,等你共赴一场跨越时空的约定!";
+ [ObservableProperty]
+ private Uri _video = new("Assets\\Advertisement-2.mp4", UriKind.Relative);
+
+ public List TrainInfos { get; set; } = [];
+ public PlatformScreenViewModel(ITimeService timeService)
+ {
+ _timeService = timeService;
+ timeService.OneSecondElapsed += RefreshDisplay;
+ }
+ public void LoadData(Station station,string _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 today = now.Date;
+
+ DateTime? AdjustTime(TimeSpan? time) =>
+ time.HasValue ? (today.Add(time.Value) > now ? today.Add(time.Value) : today.Add(time.Value).AddDays(1)) : null;
+
+ TrainInfos.Add(new TrainInfo
+ {
+ TrainNumber = trainNumber.Number,
+ Terminal = trainNumber.Terminal,
+ ArrivalTime = AdjustTime(trainNumber.ArrivalTime),
+ DepartureTime = AdjustTime(trainNumber.DepartureTime),
+ State = TimeSpan.Zero
+ });
+ }
+ }
+ TrainInfos = [.. TrainInfos.OrderBy(x => x.ArrivalTime ?? x.DepartureTime)];
+ }
+
+ private void RefreshDisplay(object? sender, EventArgs e)
+ {
+ CurrentTime = _timeService.GetDateTimeNow();
+ List itemsToRemove = [.. TrainInfos.Where(info => info.DepartureTime < _timeService.GetDateTimeNow())];
+ foreach (var item in itemsToRemove)
+ {
+ TrainInfos.Remove(item);
+ }
+ FirstTrain = TrainInfos.Count > 0 ? TrainInfos[0] : new();
+ SecondTrain = TrainInfos.Count > 1 ? TrainInfos[1] : new();
+
+ OnPropertyChanged(nameof(FirstTrain));
+ OnPropertyChanged(nameof(SecondTrain));
+ }
+ }
+}
diff --git a/CRSim.ScreenSimulator/Views/Windows/Stations/XuzhouMetro/PlatformScreenView.xaml b/CRSim.ScreenSimulator/Views/Windows/Stations/XuzhouMetro/PlatformScreenView.xaml
new file mode 100644
index 0000000..7b61c81
--- /dev/null
+++ b/CRSim.ScreenSimulator/Views/Windows/Stations/XuzhouMetro/PlatformScreenView.xaml
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CRSim.ScreenSimulator/Views/Windows/Stations/XuzhouMetro/PlatformScreenView.xaml.cs b/CRSim.ScreenSimulator/Views/Windows/Stations/XuzhouMetro/PlatformScreenView.xaml.cs
new file mode 100644
index 0000000..6318d92
--- /dev/null
+++ b/CRSim.ScreenSimulator/Views/Windows/Stations/XuzhouMetro/PlatformScreenView.xaml.cs
@@ -0,0 +1,45 @@
+using CRSim.ScreenSimulator.ViewModels.XuzhouMetro;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Media;
+
+namespace CRSim.ScreenSimulator.Views.XuzhouMetro
+{
+ ///
+ /// SecondaryScreen.xaml 的交互逻辑
+ ///
+ public partial class PlatformScreenView : Window
+ {
+ public PlatformScreenViewModel ViewModel { get; }
+ public PlatformScreenView(PlatformScreenViewModel viewModel)
+ {
+ InitializeComponent();
+ ViewModel = viewModel;
+ RenderOptions.SetEdgeMode(this, EdgeMode.Aliased);
+ DataContext = this;
+ player.Play();
+ }
+ private void Window_MouseDown(object sender, MouseButtonEventArgs e)
+ {
+ if (e.ChangedButton == MouseButton.Left)
+ {
+ DragMove();
+ }
+ }
+
+ private void Window_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Escape)
+ {
+ Close();
+ }
+ }
+
+ private void MediaElement_MediaEnded(object sender, RoutedEventArgs e)
+ {
+ player.Position = TimeSpan.Zero;
+ player.Play();
+ }
+
+ }
+}
diff --git a/CRSim/App.xaml.cs b/CRSim/App.xaml.cs
index 9343b68..965347c 100644
--- a/CRSim/App.xaml.cs
+++ b/CRSim/App.xaml.cs
@@ -51,6 +51,8 @@
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
diff --git a/CRSim/Assets/Advertisement.mp4 b/CRSim/Assets/Advertisement-1.mp4
similarity index 100%
rename from CRSim/Assets/Advertisement.mp4
rename to CRSim/Assets/Advertisement-1.mp4
diff --git a/CRSim/Assets/Advertisement-2.mp4 b/CRSim/Assets/Advertisement-2.mp4
new file mode 100644
index 0000000..c369f08
Binary files /dev/null and b/CRSim/Assets/Advertisement-2.mp4 differ
diff --git a/CRSim/Assets/StyleImages/XuzhouMetro/Background.jpg b/CRSim/Assets/StyleImages/XuzhouMetro/Background.jpg
new file mode 100644
index 0000000..77b9d4d
Binary files /dev/null and b/CRSim/Assets/StyleImages/XuzhouMetro/Background.jpg differ
diff --git a/CRSim/Assets/StyleImages/XuzhouMetro/Metro.png b/CRSim/Assets/StyleImages/XuzhouMetro/Metro.png
new file mode 100644
index 0000000..5c47b77
Binary files /dev/null and b/CRSim/Assets/StyleImages/XuzhouMetro/Metro.png differ
diff --git a/CRSim/Assets/StyleImages/XuzhouMetro/PlatformScreen.png b/CRSim/Assets/StyleImages/XuzhouMetro/PlatformScreen.png
new file mode 100644
index 0000000..3f12412
Binary files /dev/null and b/CRSim/Assets/StyleImages/XuzhouMetro/PlatformScreen.png differ
diff --git a/CRSim/Assets/StyleImages/XuzhouMetro/XuzhouMetro-Icon.png b/CRSim/Assets/StyleImages/XuzhouMetro/XuzhouMetro-Icon.png
new file mode 100644
index 0000000..ee8306d
Binary files /dev/null and b/CRSim/Assets/StyleImages/XuzhouMetro/XuzhouMetro-Icon.png differ
diff --git a/CRSim/CRSim.csproj b/CRSim/CRSim.csproj
index 30c848f..5130f3c 100644
--- a/CRSim/CRSim.csproj
+++ b/CRSim/CRSim.csproj
@@ -9,11 +9,12 @@
13.0
CRSim.App
Assets\CRSimIcon.ico
- 2.1.3.0
+ 2.2.0.0
+
@@ -22,7 +23,13 @@
-
+
+
+
+
+ PreserveNewest
+
+
PreserveNewest
@@ -42,6 +49,9 @@
+
+
+
@@ -56,6 +66,7 @@
+
diff --git a/CRSim/Models/StylesInfoData.json b/CRSim/Models/StylesInfoData.json
index e55373a..20708ca 100644
--- a/CRSim/Models/StylesInfoData.json
+++ b/CRSim/Models/StylesInfoData.json
@@ -76,7 +76,21 @@
"Parameters": [
"Station",
"Text",
- "Video"
+ "Video",
+ "Platform"
+ ]
+ },
+ {
+ "UniqueId": "XuzhouMetro PlatformScreen",
+ "Title": "徐州地铁站台看板",
+ "Station": "XuzhouMetro",
+ "StyleName": "PlatformScreenView",
+ "ImagePath": "Assets/StyleImages/XuzhouMetro/PlatformScreen.png",
+ "Parameters": [
+ "Station",
+ "Text",
+ "Video",
+ "Platform"
]
},
{