diff --git a/CRSim.ScreenSimulator/Assets/DaqingDong/PlatformScreen.png b/CRSim.ScreenSimulator/Assets/DaqingDong/PlatformScreen.png new file mode 100644 index 0000000..e485ca6 Binary files /dev/null and b/CRSim.ScreenSimulator/Assets/DaqingDong/PlatformScreen.png differ diff --git a/CRSim.ScreenSimulator/Assets/HarbinXi/PlatformScreen.png b/CRSim.ScreenSimulator/Assets/HarbinXi/PlatformScreen.png new file mode 100644 index 0000000..a071b05 Binary files /dev/null and b/CRSim.ScreenSimulator/Assets/HarbinXi/PlatformScreen.png differ diff --git a/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj b/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj index 7bb15db..5ba60b0 100644 --- a/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj +++ b/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj @@ -91,6 +91,7 @@ + @@ -98,6 +99,7 @@ + diff --git a/CRSim.ScreenSimulator/Models/StylesInfoData.json b/CRSim.ScreenSimulator/Models/StylesInfoData.json index f7635c6..c268a50 100644 --- a/CRSim.ScreenSimulator/Models/StylesInfoData.json +++ b/CRSim.ScreenSimulator/Models/StylesInfoData.json @@ -261,5 +261,30 @@ "Platform", "Location" ] + }, + { + "UniqueId": "DaqingDong.PlatformScreen", + "Title": "大庆东站站台看板", + "Station": "大庆东", + "Author": "wxl0430", + "Type": "站台屏", + "Parameters": [ + "Station", + "Platform", + "Location" + ] + }, + { + "UniqueId": "HarbinXi.PlatformScreen", + "Title": "哈尔滨西站站台看板", + "Station": "哈尔滨西", + "Author": "wxl0430", + "Type": "站台屏", + "Parameters": [ + "Station", + "Platform", + "Location", + "Text" + ] } ] \ No newline at end of file diff --git a/CRSim.ScreenSimulator/ViewModels/DaqingDong/PlatformScreenViewModel.cs b/CRSim.ScreenSimulator/ViewModels/DaqingDong/PlatformScreenViewModel.cs new file mode 100644 index 0000000..0841574 --- /dev/null +++ b/CRSim.ScreenSimulator/ViewModels/DaqingDong/PlatformScreenViewModel.cs @@ -0,0 +1,62 @@ +using CRSim.Core.Services; +using CRSim.ScreenSimulator.Models; +using System.Collections.ObjectModel; +using System.Windows; +namespace CRSim.ScreenSimulator.ViewModels.DaqingDong +{ + public class PlatformScreenViewModel : ScreenViewModel + { + private ITimeService _timeService; + public ObservableCollection Screen { get; set; } = []; + public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService) + : base(timeService, settingsService) + { + _timeService = timeService; + timeService.RefreshSecondsElapsed += RefreshDisplay; + Text = $"请站在白色安全线以内排队候车"; + Initialize(); + } + private async void Initialize() + { + await WaitForDataLoadAsync(); + RefreshDisplay(null,null); + } + private void RefreshDisplay(object? sender, EventArgs e) + { + Application.Current.Dispatcher.Invoke(() => + { + Screen.Add(TrainInfo.Count > 0 ? TrainInfo[0] : new()); + if (Screen.Count == 1) return; + Screen.RemoveAt(0); + }); + } + public override void RefreshData(object? sender, EventArgs e) + { + if (CurrentPageIndex == 0) + { + List itemsToRemove = []; + foreach (TrainInfo trainInfo in TrainInfo) + { + if (trainInfo.DepartureTime == null) + { + if (trainInfo.ArrivalTime.Value.Add(_settings.StopDisplayFromArrivalDuration) < _timeService.GetDateTimeNow()) + { + itemsToRemove.Add(trainInfo); + } + } + else + { + if (trainInfo.DepartureTime.Value < _timeService.GetDateTimeNow()) + { + itemsToRemove.Add(trainInfo); + } + } + } + foreach (var item in itemsToRemove) + { + TrainInfo.Remove(item); + } + } + } + } +} diff --git a/CRSim.ScreenSimulator/ViewModels/HarbinXi/PlatformScreenViewModel.cs b/CRSim.ScreenSimulator/ViewModels/HarbinXi/PlatformScreenViewModel.cs new file mode 100644 index 0000000..ce99dfb --- /dev/null +++ b/CRSim.ScreenSimulator/ViewModels/HarbinXi/PlatformScreenViewModel.cs @@ -0,0 +1,62 @@ +using CRSim.Core.Services; +using CRSim.ScreenSimulator.Models; +using System.Collections.ObjectModel; +using System.Windows; +namespace CRSim.ScreenSimulator.ViewModels.HarbinXi +{ + public class PlatformScreenViewModel : ScreenViewModel + { + private ITimeService _timeService; + public ObservableCollection Screen { get; set; } = []; + public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService) + : base(timeService, settingsService) + { + _timeService = timeService; + timeService.RefreshSecondsElapsed += RefreshDisplay; + Text = $"请在白线内行走,乘降列车时注意脚下站台与列车之间的空隙,看护好老人和儿童。"; + Initialize(); + } + private async void Initialize() + { + await WaitForDataLoadAsync(); + RefreshDisplay(null,null); + } + private void RefreshDisplay(object? sender, EventArgs e) + { + Application.Current.Dispatcher.Invoke(() => + { + Screen.Add(TrainInfo.Count > 0 ? TrainInfo[0] : new()); + if (Screen.Count == 1) return; + Screen.RemoveAt(0); + }); + } + public override void RefreshData(object? sender, EventArgs e) + { + if (CurrentPageIndex == 0) + { + List itemsToRemove = []; + foreach (TrainInfo trainInfo in TrainInfo) + { + if (trainInfo.DepartureTime == null) + { + if (trainInfo.ArrivalTime.Value.Add(_settings.StopDisplayFromArrivalDuration) < _timeService.GetDateTimeNow()) + { + itemsToRemove.Add(trainInfo); + } + } + else + { + if (trainInfo.DepartureTime.Value < _timeService.GetDateTimeNow()) + { + itemsToRemove.Add(trainInfo); + } + } + } + foreach (var item in itemsToRemove) + { + TrainInfo.Remove(item); + } + } + } + } +} diff --git a/CRSim.ScreenSimulator/Views/DaqingDong/PlatformScreenView.xaml b/CRSim.ScreenSimulator/Views/DaqingDong/PlatformScreenView.xaml new file mode 100644 index 0000000..811edb2 --- /dev/null +++ b/CRSim.ScreenSimulator/Views/DaqingDong/PlatformScreenView.xaml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CRSim.ScreenSimulator/Views/DaqingDong/PlatformScreenView.xaml.cs b/CRSim.ScreenSimulator/Views/DaqingDong/PlatformScreenView.xaml.cs new file mode 100644 index 0000000..adb32e2 --- /dev/null +++ b/CRSim.ScreenSimulator/Views/DaqingDong/PlatformScreenView.xaml.cs @@ -0,0 +1,38 @@ +using CRSim.ScreenSimulator.ViewModels.DaqingDong; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; + +namespace CRSim.ScreenSimulator.Views.DaqingDong +{ + /// + /// SecondaryScreen.xaml 的交互逻辑 + /// + public partial class PlatformScreenView : Window + { + public PlatformScreenViewModel ViewModel { get; } + public PlatformScreenView(PlatformScreenViewModel viewModel) + { + + InitializeComponent(); + RenderOptions.SetEdgeMode(this, EdgeMode.Aliased); + ViewModel = viewModel; + DataContext = viewModel; + } + 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(); + } + } + } +} diff --git a/CRSim.ScreenSimulator/Views/HarbinXi/PlatformScreenView.xaml b/CRSim.ScreenSimulator/Views/HarbinXi/PlatformScreenView.xaml new file mode 100644 index 0000000..0cffb4c --- /dev/null +++ b/CRSim.ScreenSimulator/Views/HarbinXi/PlatformScreenView.xaml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CRSim.ScreenSimulator/Views/HarbinXi/PlatformScreenView.xaml.cs b/CRSim.ScreenSimulator/Views/HarbinXi/PlatformScreenView.xaml.cs new file mode 100644 index 0000000..a288fa9 --- /dev/null +++ b/CRSim.ScreenSimulator/Views/HarbinXi/PlatformScreenView.xaml.cs @@ -0,0 +1,38 @@ +using CRSim.ScreenSimulator.ViewModels.HarbinXi; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; + +namespace CRSim.ScreenSimulator.Views.HarbinXi +{ + /// + /// SecondaryScreen.xaml 的交互逻辑 + /// + public partial class PlatformScreenView : Window + { + public PlatformScreenViewModel ViewModel { get; } + public PlatformScreenView(PlatformScreenViewModel viewModel) + { + + InitializeComponent(); + RenderOptions.SetEdgeMode(this, EdgeMode.Aliased); + ViewModel = viewModel; + DataContext = viewModel; + } + 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(); + } + } + } +}