mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-05 00:45:51 +08:00
feat: #123 添加北京南站站台主要看板
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -8,6 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\BeijingNan\PrimaryPlatformScreen.png" />
|
||||
<None Remove="Assets\ChengduDong\cdcz.png" />
|
||||
<None Remove="Assets\ChengduDong\PillarTicketCheckScreen.png" />
|
||||
<None Remove="Assets\ChengduDong\TicketCheck.png" />
|
||||
@@ -23,6 +24,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
|
||||
<PackageReference Include="PinYinConverterCore" Version="1.0.2" />
|
||||
<PackageReference Include="PP.Wpf" Version="1.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -93,6 +95,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Assets\Ankang\ExitScreen.png" />
|
||||
<Resource Include="Assets\BeijingNan\PrimaryPlatformScreen.png" />
|
||||
<Resource Include="Assets\BeijingXi\PrimaryScreen.png" />
|
||||
<Resource Include="Assets\BeijingNan\PrimaryScreen.png" />
|
||||
<Resource Include="Assets\BeijingNan\TicketCheckScreen.png" />
|
||||
|
||||
53
CRSim.ScreenSimulator/Converters/ChineseToPinyinConverter.cs
Normal file
53
CRSim.ScreenSimulator/Converters/ChineseToPinyinConverter.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using Microsoft.International.Converters.PinYinConverter;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace CRSim.ScreenSimulator.Converters
|
||||
{
|
||||
public class ChineseToPinyinConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// 将中文字符串转换为拼音(带声调或不带声调)
|
||||
/// </summary>
|
||||
/// <param name="value">要转换的中文字符串</param>
|
||||
/// <returns>拼音字符串</returns>
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value == null) return string.Empty;
|
||||
string chineseText = value.ToString();
|
||||
if (string.IsNullOrWhiteSpace(chineseText))
|
||||
return string.Empty;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
foreach (char c in chineseText)
|
||||
{
|
||||
if (ChineseChar.IsValidChar(c))
|
||||
{
|
||||
var chineseChar = new ChineseChar(c);
|
||||
var pinyins = chineseChar.Pinyins;
|
||||
if (pinyins != null && pinyins.Count > 0)
|
||||
{
|
||||
var pinyin = pinyins[0][..^1];
|
||||
sb.Append(pinyin);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(c);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(c);
|
||||
}
|
||||
}
|
||||
var result = sb.ToString().ToLower();
|
||||
return char.ToUpper(result[0], culture) + result[1..];
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,6 +343,18 @@
|
||||
"TicketCheck"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "BeijingNan.PrimaryPlatformScreen",
|
||||
"Title": "北京南站站台主要看板",
|
||||
"Region": "北京",
|
||||
"Author": "电排骨",
|
||||
"Type": "站台屏",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Platform",
|
||||
"Location"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "BeijingNan.SecondaryPlatformScreen",
|
||||
"Title": "北京南站站台次要看板",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using CRSim.Core.Services;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.BeijingNan
|
||||
{
|
||||
public class PrimaryPlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public PrimaryPlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<views:BaseScreenView x:Class="CRSim.ScreenSimulator.Views.BeijingNan.PrimaryPlatformScreenView"
|
||||
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.BeijingNan"
|
||||
mc:Ignorable="d" Foreground="#df3a38" Background="Black"
|
||||
xmlns:converters="clr-namespace:CRSim.ScreenSimulator.Converters"
|
||||
xmlns:converters1="clr-namespace:CRSim.Shared.Converters;assembly=CRSim.Shared"
|
||||
FontFamily="宋体" FontSize="25" FontWeight="Bold"
|
||||
xmlns:views="clr-namespace:CRSim.ScreenSimulator.Views">
|
||||
<views:BaseScreenView.Resources>
|
||||
<converters1:DateTimeToStringConverter x:Key="DateTimeToStringConverter" Format="HH:mm" />
|
||||
<converters1:EmptyToVisibilityConverter x:Key="EmptyToVisibilityConverter" />
|
||||
<converters:LocationToStringConverter x:Key="LocationToStringConverter"/>
|
||||
<converters:ChineseToPinyinConverter x:Key="ChineseToPinyinConverter"/>
|
||||
</views:BaseScreenView.Resources>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel Orientation="Vertical" MinWidth="140">
|
||||
<TextBlock Text="{Binding ThisPlatform}" Foreground="#B1C5D4" FontSize="76" FontFamily="黑体" TextAlignment="Center"/>
|
||||
<TextBlock Text="站台" Foreground="#B1C5D4" FontSize="40" FontFamily="黑体" FontWeight="Normal" TextAlignment="Center"/>
|
||||
<TextBlock Text="Platform" Foreground="#B1C5D4" FontSize="17" FontFamily="黑体" TextAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical" Background="#26241E" MinWidth="450" Margin="8">
|
||||
<Grid Margin="0,6,0,3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="←" Foreground="#eef4c9" TextAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding ScreenA[0].TrainNumber}" FontFamily="黑体"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding ScreenA[0].DepartureTime,Converter={StaticResource DateTimeToStringConverter}}" TextAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Text="终到" Foreground="#eef4c9"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding ScreenA[0].Terminal}" TextAlignment="Center"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding ScreenA[0].Origin,Converter={StaticResource ChineseToPinyinConverter}}" TextAlignment="Center" FontFamily="黑体" FontWeight="Normal"/>
|
||||
<TextBlock Grid.Column="1" Text="to" TextAlignment="Center" Foreground="#eef4c9" FontFamily="黑体" FontWeight="Normal"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding ScreenA[0].Terminal,Converter={StaticResource ChineseToPinyinConverter}}" TextAlignment="Center" FontFamily="黑体" FontWeight="Normal"/>
|
||||
</Grid>
|
||||
<TextBlock Margin="0,3,0,6" Foreground="#eef4c9" TextAlignment="Center">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{StaticResource LocationToStringConverter}">
|
||||
<Binding Path="ScreenA[0].Length" />
|
||||
<Binding Path="Location" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</views:BaseScreenView>
|
||||
@@ -0,0 +1,15 @@
|
||||
using CRSim.ScreenSimulator.ViewModels.BeijingNan;
|
||||
|
||||
namespace CRSim.ScreenSimulator.Views.BeijingNan
|
||||
{
|
||||
public partial class PrimaryPlatformScreenView : BaseScreenView
|
||||
{
|
||||
public PrimaryPlatformScreenViewModel ViewModel { get; }
|
||||
public PrimaryPlatformScreenView(PrimaryPlatformScreenViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = viewModel;
|
||||
DataContext = viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user