mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-07 10:05:49 +08:00
@@ -5,23 +5,44 @@ namespace CRSim.ScreenSimulator.Converters
|
||||
{
|
||||
public class LocationToStringConverter : IMultiValueConverter
|
||||
{
|
||||
public string DisplayMode { get; set; } = "normal";
|
||||
object IMultiValueConverter.Convert(object[] values, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (values[0] is int Length&& values[1] is int Location)
|
||||
if (values[0] is int Length && values[1] is int Location)
|
||||
{
|
||||
if (Location > Length)
|
||||
if (DisplayMode == "less")
|
||||
{
|
||||
return $"当前无车,1-{Length}车向后。";
|
||||
if (Location > Length)
|
||||
{
|
||||
return $"当前无车厢,1~{Length}车厢向前。";
|
||||
}
|
||||
if (Location == Length)
|
||||
{
|
||||
return $"当前{Length}车厢,1车厢向前。";
|
||||
}
|
||||
if (Location == 1)
|
||||
{
|
||||
return $"当前1车厢,{Length}车厢向后。";
|
||||
}
|
||||
return $"1车厢向前,{Length}车厢向后。";
|
||||
}
|
||||
if (Location == Length)
|
||||
if (DisplayMode == "normal")
|
||||
{
|
||||
return $"当前{Length}车,1-{Length-1}车向后。";
|
||||
if (Location > Length)
|
||||
{
|
||||
return $"当前无车,1-{Length}车向后。";
|
||||
}
|
||||
if (Location == Length)
|
||||
{
|
||||
return $"当前{Length}车,1-{Length-1}车向后。";
|
||||
}
|
||||
if (Location == 1)
|
||||
{
|
||||
return $"当前1车,2-{Length}车向前。";
|
||||
}
|
||||
return $"当前{Location}车,1-{Location - 1}车向前,{Location + 1}-{Length}车向后。";
|
||||
}
|
||||
if (Location == 1)
|
||||
{
|
||||
return $"当前1车,2-{Length}车向前。";
|
||||
}
|
||||
return $"当前{Location}车,1-{Location - 1}车向前,{Location + 1}-{Length}车向后。";
|
||||
return string.Empty;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
using CRSim.Core.Services;
|
||||
using CRSim.ScreenSimulator.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
namespace CRSim.ScreenSimulator.ViewModels.Zibo
|
||||
{
|
||||
public class PlatformScreenViewModel : ScreenViewModel
|
||||
{
|
||||
private ITimeService _timeService;
|
||||
public ObservableCollection<TrainInfo> Screen { get; set; } = [];
|
||||
public PlatformScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
_timeService = timeService;
|
||||
timeService.RefreshSecondsElapsed += RefreshDisplay;
|
||||
Text = $"请站在白色安全线以内排队候车";
|
||||
Initialize();
|
||||
}
|
||||
private async void Initialize()
|
||||
{
|
||||
await WaitForDataLoadAsync();
|
||||
RefreshDisplay(null,null);
|
||||
}
|
||||
private void RefreshDisplay(object? sender, EventArgs e)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Screen.Add(TrainInfo.Count > 0 ? TrainInfo[0] : new());
|
||||
if (Screen.Count == 1) return;
|
||||
Screen.RemoveAt(0);
|
||||
});
|
||||
}
|
||||
public override void RefreshData(object? sender, EventArgs e)
|
||||
{
|
||||
if (CurrentPageIndex == 0)
|
||||
{
|
||||
List<TrainInfo> itemsToRemove = [];
|
||||
foreach (TrainInfo trainInfo in TrainInfo)
|
||||
{
|
||||
if (trainInfo.DepartureTime == null)
|
||||
{
|
||||
if (trainInfo.ArrivalTime.Value.Add(_settings.StopDisplayFromArrivalDuration) < _timeService.GetDateTimeNow())
|
||||
{
|
||||
itemsToRemove.Add(trainInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (trainInfo.DepartureTime.Value < _timeService.GetDateTimeNow())
|
||||
{
|
||||
itemsToRemove.Add(trainInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var item in itemsToRemove)
|
||||
{
|
||||
TrainInfo.Remove(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<Window x:Class="CRSim.ScreenSimulator.Views.Zibo.PlatformScreenView"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
xmlns:converters="clr-namespace:CRSim.ScreenSimulator.Converters"
|
||||
xmlns:converters1="clr-namespace:CRSim.Shared.Converters;assembly=CRSim.Shared"
|
||||
FontFamily="黑体" FontSize="28" FontWeight="Bold"
|
||||
Title="引导屏" SizeToContent="WidthAndHeight"
|
||||
WindowStyle="None" AllowsTransparency="True" Background="Black"
|
||||
KeyDown="Window_KeyDown"
|
||||
ResizeMode="NoResize" MouseDown="Window_MouseDown">
|
||||
<Window.Resources>
|
||||
<converters1:DateTimeToStringConverter x:Key="DateTimeToStringConverter" Format="HH:mm" />
|
||||
<converters:LocationToStringConverter x:Key="LocationToStringConverter" DisplayMode="less" />
|
||||
<converters1:EmptyToVisibilityConverter x:Key="EmptyToVisibilityConverter" />
|
||||
</Window.Resources>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Grid Background="#161e41">
|
||||
|
||||
<TextBlock Text="{Binding ThisPlatform}" Foreground="#c5d4e1" Background="#161e41" FontSize="110" MinWidth="100"
|
||||
FontFamily="黑体" TextAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock.LayoutTransform>
|
||||
<ScaleTransform ScaleX="1.25" ScaleY="1"/>
|
||||
</TextBlock.LayoutTransform>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
<Grid Margin="4" Background="#1b15ff" MinWidth="278">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Margin="0,10,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding Screen[0].TrainNumber}" Foreground="#ffffff" Margin="15,0,0,0" FontSize="18" />
|
||||
<TextBlock Grid.Column="1" Text="次" Foreground="#ffffff" FontSize="16" Margin="20,0,0,0"/>
|
||||
<TextBlock Grid.Column="3" Text="{Binding Screen[0].ArrivalTime,Converter={StaticResource DateTimeToStringConverter}}" Foreground="#ffffff" FontSize="18"/>
|
||||
<TextBlock Grid.Column="4" Text="到" Foreground="#ffffff" FontSize="18" Margin="10,0"/>
|
||||
<TextBlock Grid.Column="5" Text="{Binding Screen[0].DepartureTime,Converter={StaticResource DateTimeToStringConverter}}" Foreground="#ffffff" FontSize="18"/>
|
||||
<TextBlock Grid.Column="6" Text="开" Foreground="#ffffff" FontSize="18" Margin="10,0"/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="1" Margin="0,10,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Screen[0].Origin}" Foreground="#ffffff" FontSize="20"/>
|
||||
<TextBlock Grid.Column="3" Text=" — " Foreground="#ffffff" FontSize="20"/>
|
||||
<TextBlock Grid.Column="5" Text="{Binding Screen[0].Terminal}" Foreground="#ffffff" FontSize="20"/>
|
||||
<TextBlock Grid.Column="7" Text="{Binding ThisPlatform}" Foreground="#ffffff" FontSize="20"/>
|
||||
<TextBlock Grid.Column="9" Text="台" Foreground="#ffffff" FontSize="20" Margin="0,0,10,0"/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Text}" Foreground="#ffffff" FontSize="18" TextAlignment="Center" HorizontalAlignment="Center" Margin="10,0"/>
|
||||
</Grid>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" TextAlignment="Center" Foreground="White" FontSize="18" Padding="2" Margin="0,5,0,5">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Mode="OneWay" Converter="{StaticResource LocationToStringConverter}">
|
||||
<Binding Path="Screen[0].Length" />
|
||||
<Binding Path="Location" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,38 @@
|
||||
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 PlatformScreenView : Window
|
||||
{
|
||||
public PlatformScreenViewModel ViewModel { get; }
|
||||
public PlatformScreenView(PlatformScreenViewModel 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,8 @@
|
||||
services.AddTransient<ScreenSimulator.Views.Zibo.SecondaryScreenView>();
|
||||
services.AddTransient<ScreenSimulator.ViewModels.Zibo.TicketCheckScreenViewModel>();
|
||||
services.AddTransient<ScreenSimulator.Views.Zibo.TicketCheckScreenView>();
|
||||
services.AddTransient<ScreenSimulator.ViewModels.Zibo.PlatformScreenViewModel>();
|
||||
services.AddTransient<ScreenSimulator.Views.Zibo.PlatformScreenView>();
|
||||
services.AddTransient<ScreenSimulator.ViewModels.Jinanxi.SmallScreenViewModel>();
|
||||
services.AddTransient<ScreenSimulator.Views.Jinanxi.SmallScreenView>();
|
||||
services.AddTransient<ScreenSimulator.ViewModels.GuangdongIntercity.SecondaryScreenViewModel>();
|
||||
|
||||
BIN
CRSim/Assets/StyleImages/Zibo/PlatformScreen.png
Normal file
BIN
CRSim/Assets/StyleImages/Zibo/PlatformScreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -57,6 +57,7 @@
|
||||
<Resource Include="Assets\StyleImages\Zibo\PrimaryScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Zibo\SecondaryScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Zibo\TicketCheckScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Zibo\PlatformScreen.png" />
|
||||
<Resource Include="Assets\win11-dashboard.dark.png" />
|
||||
<Resource Include="Assets\win11-dashboard.light.png" />
|
||||
<EmbeddedResource Include="Models\StylesInfoData.json" />
|
||||
|
||||
@@ -144,6 +144,31 @@
|
||||
"Station"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Zibo TicketCheckScreen",
|
||||
"Title": "淄博站检票口看板",
|
||||
"Station": "Zibo",
|
||||
"StyleName": "TicketCheckScreenView",
|
||||
"ImagePath": "Assets/StyleImages/Zibo/TicketCheckScreen.png",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"TicketCheck",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Zibo PlatformScreen",
|
||||
"Title": "淄博站站台看板",
|
||||
"Station": "Zibo",
|
||||
"StyleName": "PlatformScreenView",
|
||||
"ImagePath": "Assets/StyleImages/Zibo/PlatformScreen.png",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"Platform",
|
||||
"Location",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Jinanxi SmallScreen",
|
||||
"Title": "济南西站小屏看板",
|
||||
@@ -175,17 +200,5 @@
|
||||
"Station",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Zibo TicketCheckScreen",
|
||||
"Title": "淄博站检票口看板",
|
||||
"Station": "Zibo",
|
||||
"StyleName": "TicketCheckScreenView",
|
||||
"ImagePath": "Assets/StyleImages/Zibo/TicketCheckScreen.png",
|
||||
"Parameters": [
|
||||
"Station",
|
||||
"TicketCheck",
|
||||
"Text"
|
||||
]
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user