mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-06 01:06:27 +08:00
feat: 添加福州南站检票口看板
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.ScreenSimulator.Models;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace CRSim.ScreenSimulator.Converters
|
||||
{
|
||||
public class TrainInfoToTicketCheckTimeConverter : IValueConverter
|
||||
{
|
||||
private ITimeService _timeService;
|
||||
private Settings _settings;
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is TrainInfo trainInfo && trainInfo.DepartureTime!=null)
|
||||
{
|
||||
var serviceProvider = (IServiceProvider)Application.Current.Resources["ServiceProvider"];
|
||||
_timeService = serviceProvider.GetRequiredService<ITimeService>();
|
||||
_settings = serviceProvider.GetRequiredService<ISettingsService>().GetSettings();
|
||||
if (trainInfo.ArrivalTime == null)
|
||||
{
|
||||
return trainInfo.DepartureTime.Value.Subtract(_settings.DepartureCheckInAdvanceDuration).ToString("HH:mm");//始发车
|
||||
}
|
||||
return trainInfo.DepartureTime.Value.Subtract(_settings.PassingCheckInAdvanceDuration).ToString("HH:mm");//过路车
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
<Window x:Class="CRSim.ScreenSimulator.Views.FuzhouNan.TicketCheckScreenView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:CRSim.ScreenSimulator.Views.FuzhouNan"
|
||||
mc:Ignorable="d"
|
||||
xmlns:converters="clr-namespace:CRSim.ScreenSimulator.Converters"
|
||||
xmlns:converters1="clr-namespace:CRSim.Shared.Converters;assembly=CRSim.Shared"
|
||||
FontFamily="宋体" FontSize="20" FontWeight="Bold"
|
||||
Title="引导屏" SizeToContent="WidthAndHeight"
|
||||
WindowStyle="None" AllowsTransparency="True" Background="Black"
|
||||
KeyDown="Window_KeyDown"
|
||||
ResizeMode="NoResize" MouseDown="Window_MouseDown">
|
||||
<Window.Resources>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<!-- 去除列头的间距 -->
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="BorderBrush" Value="Black"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="SeparatorBrush" Value="Black"/>
|
||||
<Setter Property="SeparatorVisibility" Value="Collapsed"/>
|
||||
</Style>
|
||||
<converters:TrainStateConverter x:Key="TrainStateConverter" WaitingText="正在候车"/>
|
||||
<converters:TrainStateColorConverter x:Key="TrainStateColorConverter" WaitingColor="#FAFAB2" CheckingTicketsColor="#36F8C4"/>
|
||||
<converters:LandmarkToStringConverter x:Key="LandmarkToStringConverter"/>
|
||||
<converters:NumberToStringConverter x:Key="NumberToStringConverter"/>
|
||||
<converters:TrainInfoToTicketCheckTimeConverter x:Key="TrainInfoToTicketCheckTimeConverter"/>
|
||||
<converters1:DateTimeToStringConverter x:Key="DateTimeToStringTimeConverter" Format="F" />
|
||||
<converters1:DateTimeToStringConverter x:Key="DateTimeToStringConverter" Format="HH:mm" />
|
||||
</Window.Resources>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel Orientation="Vertical" Background="#1249FC">
|
||||
<Grid MinWidth="125" Margin="0,20,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{Binding ThisTicketCheck}" Foreground="White" FontFamily="Arial" FontSize="78" TextAlignment="Center">
|
||||
<TextBlock.LayoutTransform>
|
||||
<ScaleTransform ScaleX="1.4" ScaleY="1.1"/>
|
||||
</TextBlock.LayoutTransform>
|
||||
</TextBlock>
|
||||
<TextBlock Grid.Row="1" Text="检票口" Foreground="White" TextAlignment="Center" FontFamily="黑体" FontSize="30"/>
|
||||
<TextBlock Grid.Row="2" Text="Ticket Check" Foreground="White" FontSize="16"
|
||||
TextAlignment="Center" FontFamily="Arial"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<DataGrid ItemsSource="{Binding Screen}" AutoGenerateColumns="False" BorderThickness="0.1"
|
||||
CanUserResizeColumns="False" CanUserSortColumns="False" CanUserAddRows="False"
|
||||
CanUserResizeRows="False" CanUserReorderColumns="False" ClipToBounds="False"
|
||||
IsReadOnly="True" GridLinesVisibility="None" RowHeight="28" Foreground="White"
|
||||
HeadersVisibility="Column" IsEnabled="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding TrainNumber}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="车次" Padding="2" HorizontalAlignment="Stretch" TextAlignment="Center" Foreground="Red" Background="Black" MinWidth="160"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource TrainStateColorConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Terminal}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="终到站" Padding="2" HorizontalAlignment="Stretch" TextAlignment="Center" Foreground="Red" Background="Black" MinWidth="160"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource TrainStateColorConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding DepartureTime, Converter={StaticResource DateTimeToStringConverter}}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="开点" Padding="2" HorizontalAlignment="Stretch" TextAlignment="Center" Foreground="Red" Background="Black" MinWidth="140"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource TrainStateColorConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding .,Converter={StaticResource TrainInfoToTicketCheckTimeConverter}}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="检票时间" Padding="2" HorizontalAlignment="Stretch" TextAlignment="Center" Foreground="Red" Background="Black" MinWidth="140"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource TrainStateColorConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Platform}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="站台" Padding="2" HorizontalAlignment="Stretch" TextAlignment="Center" Foreground="Red" Background="Black" MinWidth="95"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource TrainStateColorConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Landmark,Converter={StaticResource LandmarkToStringConverter}}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="地标" Padding="2" HorizontalAlignment="Stretch" TextAlignment="Center" Foreground="Red" Background="Black" MinWidth="85"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource TrainStateColorConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn>
|
||||
<DataGridTextColumn.Binding>
|
||||
<MultiBinding Mode="OneWay" Converter="{StaticResource TrainStateConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</DataGridTextColumn.Binding>
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="状态" Padding="2" HorizontalAlignment="Stretch" TextAlignment="Center" Foreground="Red" Background="Black" MinWidth="125"/>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource TrainStateColorConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="Black"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
</DataGrid>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" Background="Black" Foreground="Red" TextAlignment="Center" Margin="0,4" Text="{Binding Text}" FontSize="18"/>
|
||||
<TextBlock Grid.Column="3" Background="Black" Foreground="Red" TextAlignment="Center" Margin="0,4,10,4" Text="{Binding CurrentTime,Converter={StaticResource DateTimeToStringTimeConverter}}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,37 @@
|
||||
using CRSim.ScreenSimulator.ViewModels.FuzhouNan;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace CRSim.ScreenSimulator.Views.FuzhouNan
|
||||
{
|
||||
/// <summary>
|
||||
/// SecondaryScreen.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TicketCheckScreenView : Window
|
||||
{
|
||||
public TicketCheckScreenViewModel ViewModel { get; }
|
||||
public TicketCheckScreenView(TicketCheckScreenViewModel 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,8 @@
|
||||
services.AddTransient<ScreenSimulator.Views.Mianyang.PlatformScreenView>();
|
||||
services.AddTransient<ScreenSimulator.ViewModels.Fuzhou.TicketCheckScreenViewModel>();
|
||||
services.AddTransient<ScreenSimulator.Views.Fuzhou.TicketCheckScreenView>();
|
||||
services.AddTransient<ScreenSimulator.ViewModels.FuzhouNan.TicketCheckScreenViewModel>();
|
||||
services.AddTransient<ScreenSimulator.Views.FuzhouNan.TicketCheckScreenView>();
|
||||
services.AddTransient<ScreenSimulator.ViewModels.Ankang.ExitScreenViewModel>();
|
||||
services.AddTransient<ScreenSimulator.Views.Ankang.ExitScreenView>();
|
||||
}).Build();
|
||||
|
||||
BIN
CRSim/Assets/StyleImages/FuzhouNan/TicketCheckScreen.png
Normal file
BIN
CRSim/Assets/StyleImages/FuzhouNan/TicketCheckScreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -17,6 +17,7 @@
|
||||
<None Remove="Assets\HomeHeaderTiles\Header-docs.png" />
|
||||
<None Remove="Assets\HomeHeaderTiles\Header-docs.svg" />
|
||||
<None Remove="Assets\StyleImages\Ankang\ExitScreen.png" />
|
||||
<None Remove="Assets\StyleImages\FuzhouNan\TicketCheckScreen.png" />
|
||||
<None Remove="Assets\StyleImages\Fuzhou\TicketCheckScreen.png" />
|
||||
<None Remove="Assets\StyleImages\Mianyang\PlatformScreen.png" />
|
||||
<None Remove="Assets\StyleImages\Tianjin\image.png" />
|
||||
@@ -43,6 +44,7 @@
|
||||
<Resource Include="Assets\StyleImages\ChengduDong\SecondaryScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\ChengduMetro\ChengduMetro-Icon.png" />
|
||||
<Resource Include="Assets\StyleImages\ChengduMetro\PlatformScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\FuzhouNan\TicketCheckScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Fuzhou\TicketCheckScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\GuangdongIntercity\SecondaryScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Guangyuan\PrimaryScreen.png" />
|
||||
|
||||
@@ -34,6 +34,18 @@
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "FuzhouNan TicketCheckScreen",
|
||||
"Title": "福州南站检票口看板",
|
||||
"Station": "FuzhouNan",
|
||||
"StyleName": "TicketCheckScreenView",
|
||||
"ImagePath": "Assets/StyleImages/FuzhouNan/TicketCheckScreen.png",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"TicketCheck",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "BeijingXi PrimaryScreen",
|
||||
"Title": "北京西站主要看板",
|
||||
|
||||
Reference in New Issue
Block a user