添加淄博站廊桥看板

This commit is contained in:
wxl0430
2025-04-19 12:02:06 +08:00
committed by GitHub
parent 1cfc64694c
commit 71c5850b37
8 changed files with 301 additions and 1 deletions

View File

@@ -6,10 +6,48 @@ namespace CRSim.ScreenSimulator.Converters
public class LocationToStringConverter : IMultiValueConverter
{
public string DisplayMode { get; set; } = "normal";
/*
normal: 正常
less: 简化
least极简适用于廊桥屏幕
*/
object IMultiValueConverter.Convert(object[] values, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
{
// return $"{values[0]},{values[1]},{values[2]}";
if (values[0] is int Length && values[1] is int Location)
{
if(DisplayMode == "least" && values[2] is string Direction){
// return Direction;
if(Direction == "left")
{
if(Location <= Length)
{
return $"←1~{Location}";
}
else if(Length == 1)
{
return "←1";
}
else
{
return $"←1~{Length}";
}
}
if(Direction == "right")
{
if(Location+1 > Length){
return string.Empty;
}
else if(Location+1 == Length)
{
return $"{Length}→";
}
else{
return $"{Location+1}~{Length}→";
}
}
return string.Empty;
}
if (DisplayMode == "less")
{
if (Location > Length)

View File

@@ -0,0 +1,36 @@
using CRSim.Core.Models;
using CRSim.Core.Services;
using CRSim.ScreenSimulator.Models;
using System.Collections.ObjectModel;
using System.Windows;
namespace CRSim.ScreenSimulator.ViewModels.Zibo
{
public class ConcourseBridgeScreenViewModel : ScreenViewModel
{
public ObservableCollection<TrainInfo> Screen { get; set; } = [];
public ConcourseBridgeScreenViewModel(ITimeService timeService, ISettingsService settingsService)
: base(timeService, settingsService)
{
StationType = StationType.Departure;
timeService.RefreshSecondsElapsed += RefreshDisplay;
Initialize();
}
private async void Initialize()
{
ItemsPerPage = 2;
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());
}
});
}
}
}

View File

@@ -0,0 +1,174 @@
<Window x:Class="CRSim.ScreenSimulator.Views.Zibo.ConcourseBridgeScreenView"
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:pp="https://www.cnblogs.com/pumbaa"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CRSim.ScreenSimulator.Views.Zibo"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
xmlns:converters="clr-namespace:CRSim.ScreenSimulator.Converters"
xmlns:converters1="clr-namespace:CRSim.Shared.Converters;assembly=CRSim.Shared"
FontFamily="等线" FontSize="25" FontWeight="Bold"
Title="引导屏" SizeToContent="WidthAndHeight"
WindowStyle="None" AllowsTransparency="True" Background="#0006ff"
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="#0006ff"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<converters:TrainStateConverter x:Key="TrainStateConverter"/>
<converters:TrainStateColorConverter x:Key="TrainStateColorConverter"/>
<converters:LandmarkToStringConverter x:Key="LandmarkToStringConverter"/>
<converters1:EmptyToVisibilityConverter x:Key="EmptyToVisibilityConverter" />
<converters:LocationToStringConverter x:Key="LocationToStringConverter" DisplayMode="least" />
<converters:NumberToStringConverter x:Key="NumberToStringConverter"/>
<converters1:DateTimeToStringConverter x:Key="DateTimeToStringConverter" Format="HH:mm" />
</Window.Resources>
<StackPanel Orientation="Horizontal">
<Grid Background="#000000" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" MinWidth="220">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Width="40" Height="30" Margin="-70,0,30,0">
<Path Data="M1221 2752 c-470 -449 -856 -822 -858 -828 -2 -6 329 -338 735 -737 l740 -726 692 -31 c381 -17 694 -29 695 -28 1 2 -208 275 -465 608 l-467 605 1453 3 1454 2 0 375 0 375 -1477 0 -1478 0 580 580 c472 472 575 580 555 580 -14 0 -304 9 -645 20 -341 11 -629 19 -640 19 -12 0 -343 -310 -874 -817z" Stroke="White" Fill="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Stretch="Uniform"/>
</Grid>
<TextBlock Text="{Binding ThisPlatform}" FontSize="60" TextAlignment="Center" VerticalAlignment="Center" FontFamily="黑体" FontWeight="Black" Foreground="#ffffff" Margin="10,0,0,0">
<TextBlock.LayoutTransform>
<ScaleTransform ScaleX="1.25" ScaleY="1"/>
</TextBlock.LayoutTransform>
</TextBlock>
<TextBlock Text="站台" FontSize="23" TextAlignment="Left" VerticalAlignment="Center" FontFamily="黑体" FontWeight="Black" Foreground="#ffffff" Margin="140,0,0,12" />
<TextBlock Text="Platfrom" FontSize="16" TextAlignment="Left" VerticalAlignment="Center" FontFamily="黑体" FontWeight="Black" Foreground="#ffffff" Margin="140,23,0,0" />
</Grid>
<StackPanel Orientation="Vertical">
<DataGrid ItemsSource="{Binding Screen}" AutoGenerateColumns="False"
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>
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="车厢" Padding="2" HorizontalAlignment="Stretch" TextAlignment="Center" Background="#0006ff" Width="120"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="Visibility" Value="{Binding TrainNumber,Converter={StaticResource EmptyToVisibilityConverter}}"/>
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn.Binding>
<MultiBinding Converter="{StaticResource LocationToStringConverter}">
<Binding Path="Length" />
<Binding Path="DataContext.Location" RelativeSource="{RelativeSource AncestorType={x:Type DataGrid}}" />
<Binding Source="left" />
</MultiBinding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding TrainNumber}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="车次" Padding="2" HorizontalAlignment="Stretch" TextAlignment="Center" Background="#0006ff" Width="120"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<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" Background="#0006ff" Width="120"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<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" Background="#0006ff" Width="120"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<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" Background="#0006ff" Width="120"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn>
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="车厢" Padding="2" HorizontalAlignment="Stretch" TextAlignment="Center" Background="#0006ff" Width="120"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="Visibility" Value="{Binding TrainNumber,Converter={StaticResource EmptyToVisibilityConverter}}"/>
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn.Binding>
<MultiBinding Converter="{StaticResource LocationToStringConverter}">
<Binding Path="Length" />
<Binding Path="DataContext.Location" RelativeSource="{RelativeSource AncestorType={x:Type DataGrid}}" />
<Binding Source="right" />
</MultiBinding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="#0009ff"/>
</Style>
</DataGrid.RowStyle>
</DataGrid>
</StackPanel>
<Grid Background="#000000" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" MinWidth="220">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding ThisPlatform}" FontSize="60" TextAlignment="Center" VerticalAlignment="Center" FontFamily="黑体" FontWeight="Black" Foreground="#ffffff" Margin="-100,0,0,0">
<TextBlock.LayoutTransform>
<ScaleTransform ScaleX="1.25" ScaleY="1"/>
</TextBlock.LayoutTransform>
</TextBlock>
<TextBlock Text="站台" FontSize="23" TextAlignment="Right" VerticalAlignment="Center" FontFamily="黑体" FontWeight="Black" Foreground="#ffffff" Margin="0,0,70,12" />
<TextBlock Text="Platfrom" FontSize="16" TextAlignment="Right" VerticalAlignment="Center" FontFamily="黑体" FontWeight="Black" Foreground="#ffffff" Margin="0,23,70,0" />
<Grid Width="40" Height="30" Margin="130,0,0,0">
<Path Data="M3235 3549 c-291 -9 -555 -18 -585 -18 l-55 -1 580 -580 580 -580 -1478 0 -1477 0 0 -375 0 -375 1454 -2 1453 -3 -467 -605 c-257 -333 -466 -606 -465 -608 1 -1 314 11 695 28 l692 31 739 725 c407 399 739 730 739 734 0 5 -387 378 -860 830 l-860 820 -77 -1 c-43 -1 -316 -10 -608 -20z" Stroke="White" Fill="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Stretch="Uniform"/>
</Grid>
</Grid>
</StackPanel>
</Window>

View File

@@ -0,0 +1,36 @@
using CRSim.ScreenSimulator.ViewModels.Zibo;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace CRSim.ScreenSimulator.Views.Zibo
{
/// <summary>
/// SecondaryScreen.xaml 的交互逻辑
/// </summary>
public partial class ConcourseBridgeScreenView : Window
{
public ConcourseBridgeScreenViewModel ViewModel { get; }
public ConcourseBridgeScreenView(ConcourseBridgeScreenViewModel 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();
}
}
}
}

View File

@@ -65,6 +65,8 @@
services.AddTransient<ScreenSimulator.Views.Zibo.TicketCheckScreenView>();
services.AddTransient<ScreenSimulator.ViewModels.Zibo.PlatformScreenViewModel>();
services.AddTransient<ScreenSimulator.Views.Zibo.PlatformScreenView>();
services.AddTransient<ScreenSimulator.ViewModels.Zibo.ConcourseBridgeScreenViewModel>();
services.AddTransient<ScreenSimulator.Views.Zibo.ConcourseBridgeScreenView>();
services.AddTransient<ScreenSimulator.ViewModels.Jinanxi.SmallScreenViewModel>();
services.AddTransient<ScreenSimulator.Views.Jinanxi.SmallScreenView>();
services.AddTransient<ScreenSimulator.ViewModels.GuangdongIntercity.SecondaryScreenViewModel>();

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -71,6 +71,7 @@
<Resource Include="Assets\StyleImages\Zibo\SecondaryScreen.png" />
<Resource Include="Assets\StyleImages\Zibo\TicketCheckScreen.png" />
<Resource Include="Assets\StyleImages\Zibo\PlatformScreen.png" />
<Resource Include="Assets\StyleImages\Zibo\ConcourseBridgeScreen.png" />
<Resource Include="Assets\win11-dashboard.dark.png" />
<Resource Include="Assets\win11-dashboard.light.png" />
<EmbeddedResource Include="Models\StylesInfoData.json" />

View File

@@ -212,6 +212,19 @@
"Text"
]
},
{
"UniqueId": "Zibo.ConcourseBridgeScreen",
"Title": "淄博站廊桥看板",
"Station": "淄博",
"Author": "wxl0430",
"Type": "站台屏",
"ImagePath": "Assets/StyleImages/Zibo/ConcourseBridgeScreen.png",
"Parameters": [
"Station",
"Platform",
"Location"
]
},
{
"UniqueId": "Jinanxi.SmallScreen",
"Title": "济南西站小屏看板",