From 71c5850b378cc509975c061de67dff7b6e17a51a Mon Sep 17 00:00:00 2001 From: wxl0430 <141288415+wxl0430@users.noreply.github.com> Date: Sat, 19 Apr 2025 12:02:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B7=84=E5=8D=9A=E7=AB=99?= =?UTF-8?q?=E5=BB=8A=E6=A1=A5=E7=9C=8B=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Converters/LocationToStringConverter.cs | 40 +++- .../Zibo/ConcourseBridgeScreenViewModel.cs | 36 ++++ .../Views/Zibo/ConcourseBridgeScreenView.xaml | 174 ++++++++++++++++++ .../Zibo/ConcourseBridgeScreenView.xaml.cs | 36 ++++ CRSim/App.xaml.cs | 2 + .../Zibo/ConcourseBridgeScreen.png | Bin 0 -> 2351 bytes CRSim/CRSim.csproj | 1 + CRSim/Models/StylesInfoData.json | 13 ++ 8 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 CRSim.ScreenSimulator/ViewModels/Zibo/ConcourseBridgeScreenViewModel.cs create mode 100644 CRSim.ScreenSimulator/Views/Zibo/ConcourseBridgeScreenView.xaml create mode 100644 CRSim.ScreenSimulator/Views/Zibo/ConcourseBridgeScreenView.xaml.cs create mode 100644 CRSim/Assets/StyleImages/Zibo/ConcourseBridgeScreen.png diff --git a/CRSim.ScreenSimulator/Converters/LocationToStringConverter.cs b/CRSim.ScreenSimulator/Converters/LocationToStringConverter.cs index b666a0d..ea2c844 100644 --- a/CRSim.ScreenSimulator/Converters/LocationToStringConverter.cs +++ b/CRSim.ScreenSimulator/Converters/LocationToStringConverter.cs @@ -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) diff --git a/CRSim.ScreenSimulator/ViewModels/Zibo/ConcourseBridgeScreenViewModel.cs b/CRSim.ScreenSimulator/ViewModels/Zibo/ConcourseBridgeScreenViewModel.cs new file mode 100644 index 0000000..66d16ef --- /dev/null +++ b/CRSim.ScreenSimulator/ViewModels/Zibo/ConcourseBridgeScreenViewModel.cs @@ -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 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()); + } + }); + } + } +} diff --git a/CRSim.ScreenSimulator/Views/Zibo/ConcourseBridgeScreenView.xaml b/CRSim.ScreenSimulator/Views/Zibo/ConcourseBridgeScreenView.xaml new file mode 100644 index 0000000..cb75ddf --- /dev/null +++ b/CRSim.ScreenSimulator/Views/Zibo/ConcourseBridgeScreenView.xaml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CRSim.ScreenSimulator/Views/Zibo/ConcourseBridgeScreenView.xaml.cs b/CRSim.ScreenSimulator/Views/Zibo/ConcourseBridgeScreenView.xaml.cs new file mode 100644 index 0000000..16d6f6d --- /dev/null +++ b/CRSim.ScreenSimulator/Views/Zibo/ConcourseBridgeScreenView.xaml.cs @@ -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 +{ + /// + /// SecondaryScreen.xaml 的交互逻辑 + /// + 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(); + } + } + } +} diff --git a/CRSim/App.xaml.cs b/CRSim/App.xaml.cs index 965347c..d6b57c4 100644 --- a/CRSim/App.xaml.cs +++ b/CRSim/App.xaml.cs @@ -65,6 +65,8 @@ services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/CRSim/Assets/StyleImages/Zibo/ConcourseBridgeScreen.png b/CRSim/Assets/StyleImages/Zibo/ConcourseBridgeScreen.png new file mode 100644 index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r;}$ZY_+;ZUwMU-Nz;=O=i(QCHz|gH{WRpat038WOTh5CU~3U*n1X|d#dfoU zC+cX>zMndUGh#G+xq}Eb5a3Bw(h4zJFGaxxWtpr1=aSv+!}!q{t2zt1g!I!YbF=T* zcn>{glxqrpE6>CPrj_($>ik1xu5pif6k>m*^_erFyC+j$#=xi5q}IFC=)XY%cWagu z*+M_{xGi{hgR={Ql3LAn$+o+fd|3L!$w6_0(lvFn!osw#Qoj`pd6uVSRMHxS&Hq+~ z8<>H%X3wFp!p5%->kZ{+uF50Q@i4x>}$}{P(QS_T9CJGNG=>JImOoXw`KKb@r!Zv=p z;xXrZ29U)Xr!`Tv!Fz}L$}tP<3C10h^y5tPu={#5-BCZVSJ@A8(G#z7MNsPEoFn&tIz%VK;^j!px_mNJSce7A{gi@HCZy= zuNr;(4Hg@R>u2n597XG>E^fYK&6jNtOgAt2A{0~8C(>Sad80lGg%#&=i7}Gxl!7EcFw0;+8nvetx5PZPhXN{VaZRG{45_>bzU|m4*8mYP|O2NC9GJAb4n=tXj>=WmTK2udzr8TJdTc~ zHu`{J;T1{e4AK_PAFFjrecEi3`2SHc=;BNgg2fW?24Ry?`*fiL3UyFTm{Go|VzikY zX@Qg^cup4)!tB25#}BUKxsUllvy0(J`9YA}6EQg7N?ahd*@ZC8&+v8pVi#r%;=dYR zUv-e1ATXdXI!SQzUv1_`__oX+S*n`+-$yS@@30@V)KF5EyT$+H01z-oyILC`;=k%# Bb3gz9 literal 0 HcmV?d00001 diff --git a/CRSim/CRSim.csproj b/CRSim/CRSim.csproj index 8b9cc6b..d130a36 100644 --- a/CRSim/CRSim.csproj +++ b/CRSim/CRSim.csproj @@ -71,6 +71,7 @@ + diff --git a/CRSim/Models/StylesInfoData.json b/CRSim/Models/StylesInfoData.json index bdc42e2..71a59c0 100644 --- a/CRSim/Models/StylesInfoData.json +++ b/CRSim/Models/StylesInfoData.json @@ -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": "济南西站小屏看板",