diff --git a/CRSim.ScreenSimulator/Assets/BeijingNan/PrimaryPlatformScreen.png b/CRSim.ScreenSimulator/Assets/BeijingNan/PrimaryPlatformScreen.png new file mode 100644 index 0000000..9c9fb41 Binary files /dev/null and b/CRSim.ScreenSimulator/Assets/BeijingNan/PrimaryPlatformScreen.png differ diff --git a/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj b/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj index 7261487..9fbea31 100644 --- a/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj +++ b/CRSim.ScreenSimulator/CRSim.ScreenSimulator.csproj @@ -8,6 +8,7 @@ + @@ -23,6 +24,7 @@ + @@ -93,6 +95,7 @@ + diff --git a/CRSim.ScreenSimulator/Converters/ChineseToPinyinConverter.cs b/CRSim.ScreenSimulator/Converters/ChineseToPinyinConverter.cs new file mode 100644 index 0000000..b3286c9 --- /dev/null +++ b/CRSim.ScreenSimulator/Converters/ChineseToPinyinConverter.cs @@ -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 + { + /// + /// 将中文字符串转换为拼音(带声调或不带声调) + /// + /// 要转换的中文字符串 + /// 拼音字符串 + 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(); + } + } +} diff --git a/CRSim.ScreenSimulator/Models/StylesInfoData.json b/CRSim.ScreenSimulator/Models/StylesInfoData.json index 9a5a8db..e690660 100644 --- a/CRSim.ScreenSimulator/Models/StylesInfoData.json +++ b/CRSim.ScreenSimulator/Models/StylesInfoData.json @@ -343,6 +343,18 @@ "TicketCheck" ] }, + { + "UniqueId": "BeijingNan.PrimaryPlatformScreen", + "Title": "北京南站站台主要看板", + "Region": "北京", + "Author": "电排骨", + "Type": "站台屏", + "Parameters": [ + "Station", + "Platform", + "Location" + ] + }, { "UniqueId": "BeijingNan.SecondaryPlatformScreen", "Title": "北京南站站台次要看板", diff --git a/CRSim.ScreenSimulator/ViewModels/BeijingNan/PrimaryPlatformScreenViewModel.cs b/CRSim.ScreenSimulator/ViewModels/BeijingNan/PrimaryPlatformScreenViewModel.cs new file mode 100644 index 0000000..dde1e42 --- /dev/null +++ b/CRSim.ScreenSimulator/ViewModels/BeijingNan/PrimaryPlatformScreenViewModel.cs @@ -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; + } + } +} diff --git a/CRSim.ScreenSimulator/Views/BeijingNan/PrimaryPlatformScreenView.xaml b/CRSim.ScreenSimulator/Views/BeijingNan/PrimaryPlatformScreenView.xaml new file mode 100644 index 0000000..88d9c84 --- /dev/null +++ b/CRSim.ScreenSimulator/Views/BeijingNan/PrimaryPlatformScreenView.xaml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CRSim.ScreenSimulator/Views/BeijingNan/PrimaryPlatformScreenView.xaml.cs b/CRSim.ScreenSimulator/Views/BeijingNan/PrimaryPlatformScreenView.xaml.cs new file mode 100644 index 0000000..c5994cd --- /dev/null +++ b/CRSim.ScreenSimulator/Views/BeijingNan/PrimaryPlatformScreenView.xaml.cs @@ -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; + } + } +}