mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-12 04:35:39 +08:00
feat: #140 添加柳州站主要看板
This commit is contained in:
BIN
CRSim.ScreenSimulator/Assets/Niuzhou/PrimaryScreen.png
Normal file
BIN
CRSim.ScreenSimulator/Assets/Niuzhou/PrimaryScreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
@@ -11,6 +11,7 @@
|
||||
<None Remove="Assets\ChengduDong\cdcz.png" />
|
||||
<None Remove="Assets\ChengduDong\PillarTicketCheckScreen.png" />
|
||||
<None Remove="Assets\ChengduDong\TicketCheck.png" />
|
||||
<None Remove="Assets\Niuzhou\PrimaryScreen.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -53,6 +54,9 @@
|
||||
<Compile Update="Views\ChengduDong\SecondaryScreenView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Niuzhou\PrimaryScreenView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\XuzhouMetro\PlatformScreenView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -114,6 +118,7 @@
|
||||
<Resource Include="Assets\HarbinXi\PlatformScreen.png" />
|
||||
<Resource Include="Assets\Jinanxi\SmallScreen.png" />
|
||||
<Resource Include="Assets\Mianyang\PlatformScreen.png" />
|
||||
<Resource Include="Assets\Niuzhou\PrimaryScreen.png" />
|
||||
<Resource Include="Assets\Shanghai\OutsideScreen.png" />
|
||||
<Resource Include="Assets\Tianjin\image.png" />
|
||||
<Resource Include="Assets\Tianjin\PlatformScreen.png" />
|
||||
|
||||
@@ -250,6 +250,17 @@
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Niuzhou.PrimaryScreen",
|
||||
"Title": "柳州站主要看板",
|
||||
"Station": "柳州",
|
||||
"Author": "电排骨",
|
||||
"Type": "车站大屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Beijing.ArrivalScreen",
|
||||
"Title": "北京站地道到达看板",
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using CRSim.Core.Models;
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.ScreenSimulator.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Niuzhou
|
||||
{
|
||||
public class PrimaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public ObservableCollection<TrainInfo> LeftScreen { get; private set; } = [];
|
||||
public PrimaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
Text = $"开车前{settingsService.GetSettings().PassingCheckInAdvanceDuration.TotalMinutes}分钟开始检票,开车前{settingsService.GetSettings().StopCheckInAdvanceDuration.TotalMinutes}分钟停止检票。";
|
||||
ItemsPerPage = 10;
|
||||
PageCount = 1;
|
||||
StationType = StationType.Departure;
|
||||
timeService.RefreshSecondsElapsed += RefreshDisplay;
|
||||
Initialize();
|
||||
}
|
||||
private async void Initialize()
|
||||
{
|
||||
await WaitForDataLoadAsync();
|
||||
RefreshDisplay(null,null);
|
||||
}
|
||||
private void RefreshDisplay(object? sender, EventArgs e)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
int pageCount = (int)Math.Ceiling((double)TrainInfo.Count / (ItemsPerPage * PageCount));
|
||||
LeftScreen.Clear();
|
||||
int startIndex = CurrentPageIndex * ItemsPerPage * PageCount;
|
||||
var leftItems = TrainInfo.Skip(startIndex).Take(ItemsPerPage).ToList();
|
||||
while (leftItems.Count < ItemsPerPage) // Fill up with new object() if not enough items
|
||||
{
|
||||
leftItems.Add(new TrainInfo());
|
||||
}
|
||||
foreach (var item in leftItems)
|
||||
{
|
||||
LeftScreen.Add(item);
|
||||
}
|
||||
CurrentPageIndex = CurrentPageIndex + 1 >= Math.Min(_settings.MaxPages, pageCount) ? 0 : CurrentPageIndex + 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
155
CRSim.ScreenSimulator/Views/Niuzhou/PrimaryScreenView.xaml
Normal file
155
CRSim.ScreenSimulator/Views/Niuzhou/PrimaryScreenView.xaml
Normal file
@@ -0,0 +1,155 @@
|
||||
<views:BaseScreenView x:Class="CRSim.ScreenSimulator.Views.Niuzhou.PrimaryScreenView"
|
||||
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.Niuzhou"
|
||||
mc:Ignorable="d"
|
||||
xmlns:converters="clr-namespace:CRSim.ScreenSimulator.Converters"
|
||||
xmlns:converters1="clr-namespace:CRSim.Shared.Converters;assembly=CRSim.Shared"
|
||||
Title="引导屏" SizeToContent="WidthAndHeight" FontWeight="Bold"
|
||||
WindowStyle="None" AllowsTransparency="True" Background="Transparent"
|
||||
xmlns:views="clr-namespace:CRSim.ScreenSimulator.Views" ResizeMode="NoResize"
|
||||
FontFamily="宋体" FontSize="20">
|
||||
<Window.Resources>
|
||||
<converters1:ListToStringConverter x:Key="ListToStringConverter" Separator=", " />
|
||||
<converters1:EmptyToVisibilityConverter x:Key="EmptyToVisibilityConverter" />
|
||||
<converters1:DateTimeToStringConverter x:Key="DateTimeToStringConverter" Format="HH:mm" />
|
||||
<converters1:DateTimeToStringConverter x:Key="DateTimeToStringTimeConverter" Format="yyyy/MM/dd HH:mm:ss" />
|
||||
<converters:TrainStateConverter x:Key="TrainStateConverter" WaitingText="正在候车"/>
|
||||
<converters:TrainStateColorConverter x:Key="TrainStateColorConverter" WaitingColor="#E2E3C3"/>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style>
|
||||
<Style x:Key="CommonTextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style x:Key="CommonHeaderStyle" TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="FontFamily" Value="黑体"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="Black"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#E13936"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="CommonRowStyle" TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="Black"/>
|
||||
<Setter Property="Foreground" Value="#E2E3C3"/>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<DataGrid ItemsSource="{Binding LeftScreen, Mode=OneWay}" AutoGenerateColumns="False"
|
||||
CanUserResizeColumns="False" CanUserSortColumns="False" CanUserAddRows="False"
|
||||
CanUserResizeRows="False" CanUserReorderColumns="False"
|
||||
IsReadOnly="True" GridLinesVisibility="None" RowHeight="36" RowStyle="{StaticResource CommonRowStyle}"
|
||||
HeadersVisibility="Column" IsEnabled="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding TrainNumber}" MinWidth="130">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="车次" Style="{StaticResource CommonHeaderStyle}" FontSize="22" Padding="0,2,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}">
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding TicketChecks,Converter={StaticResource ListToStringConverter}}" MinWidth="100">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="检票口" Style="{StaticResource CommonHeaderStyle}" FontSize="22" Padding="0,2,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}">
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding DepartureTime, Converter={StaticResource DateTimeToStringConverter}}" MinWidth="120">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="开点" Style="{StaticResource CommonHeaderStyle}" FontSize="22" Padding="0,2,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}">
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn MinWidth="160">
|
||||
<DataGridTextColumn.Binding>
|
||||
<MultiBinding Mode="OneWay" Converter="{StaticResource TrainStateConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</DataGridTextColumn.Binding>
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="状 态" Style="{StaticResource CommonHeaderStyle}" FontSize="22" Padding="0,2,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource TrainStateColorConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Binding="{Binding Terminal}" MinWidth="140">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="终到站" Style="{StaticResource CommonHeaderStyle}" FontSize="22" Padding="0,2,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}">
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<Grid Background="Black" HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding Text}" Margin="18,4,0,4"
|
||||
Foreground="LawnGreen" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding CurrentTime,Converter={StaticResource DateTimeToStringTimeConverter}}"
|
||||
Foreground="Red" VerticalAlignment="Center" Margin="0,0,8,0" FontSize="18"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</views:BaseScreenView>
|
||||
@@ -0,0 +1,15 @@
|
||||
using CRSim.ScreenSimulator.ViewModels.Niuzhou;
|
||||
|
||||
namespace CRSim.ScreenSimulator.Views.Niuzhou
|
||||
{
|
||||
public partial class PrimaryScreenView : BaseScreenView
|
||||
{
|
||||
public PrimaryScreenViewModel ViewModel { get; }
|
||||
public PrimaryScreenView(PrimaryScreenViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = viewModel;
|
||||
DataContext = viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user