mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-10 11:36:07 +08:00
feat: 添加了济南西站的商务座候车室显示屏样式
feat: 添加了济南西站的商务座候车室显示屏样式
This commit is contained in:
@@ -55,6 +55,8 @@
|
||||
services.AddTransient<Views.Zibo.PrimaryScreenView>();
|
||||
services.AddTransient<ViewModels.Zibo.SecondaryScreenViewModel>();
|
||||
services.AddTransient<Views.Zibo.SecondaryScreenView>();
|
||||
services.AddTransient<ViewModels.Jinanxi.SmallScreenViewModel>();
|
||||
services.AddTransient<Views.Jinanxi.SmallScreenView>();
|
||||
}).Build();
|
||||
|
||||
[STAThread]
|
||||
|
||||
BIN
CRSim/Assets/StyleImages/Jinanxi/SmallScreen.png
Normal file
BIN
CRSim/Assets/StyleImages/Jinanxi/SmallScreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
@@ -14,13 +14,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Remove="App.xaml" />
|
||||
<None Remove="Assets\HomeHeaderTiles\Header-Afdian.png" />
|
||||
<None Remove="Assets\StyleImages\ChengduDong\PrimaryTicketCheckScreen.png" />
|
||||
<None Remove="Assets\StyleImages\Hanzhong\Image.png" />
|
||||
<None Remove="Assets\StyleImages\Hanzhong\PlatformScreen.png" />
|
||||
<None Remove="Assets\StyleImages\Harbin\PrimaryScreen.png" />
|
||||
<None Remove="Assets\StyleImages\Zibo\PrimaryScreen.png" />
|
||||
<None Remove="Assets\StyleImages\Zibo\SecondaryScreen.png" />
|
||||
<None Remove="Assets\StyleImages\Jinanxi\SmallScreen.png" />
|
||||
<Content Include="Assets\Advertisement.mp4">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@@ -46,6 +40,7 @@
|
||||
<Resource Include="Assets\StyleImages\Hanzhong\Image.png" />
|
||||
<Resource Include="Assets\StyleImages\Hanzhong\PlatformScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Harbin\PrimaryScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Jinanxi\SmallScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Shanghai\OutsideScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Zibo\PrimaryScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Zibo\SecondaryScreen.png" />
|
||||
@@ -98,6 +93,9 @@
|
||||
<Compile Update="Views\Windows\Stations\Zibo\SecondaryScreenView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Windows\Stations\Jinanxi\PrimaryScreen.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -105,5 +105,15 @@
|
||||
"Parameters": [
|
||||
"Station"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "Jinanxi SmallScreen",
|
||||
"Title": "济南西站小屏看板",
|
||||
"Station": "Jinanxi",
|
||||
"StyleName": "SmallScreenView",
|
||||
"ImagePath": "Assets/StyleImages/Jinanxi/SmallScreen.png",
|
||||
"Parameters": [
|
||||
"Station"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -15,6 +15,8 @@ namespace CRSim.ViewModels
|
||||
private string _currentSecond;
|
||||
[ObservableProperty]
|
||||
private string _text = "";
|
||||
[ObservableProperty]
|
||||
private Station _thisStation;
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public List<TrainInfo> TrainInfo { get; set; } = [];
|
||||
@@ -56,6 +58,7 @@ namespace CRSim.ViewModels
|
||||
|
||||
public void LoadData(Station station,string ticketCheck,string platform)
|
||||
{
|
||||
ThisStation = station;
|
||||
var trains = station.StationStops;
|
||||
foreach (var trainNumber in trains)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
namespace CRSim.ViewModels.Jinanxi
|
||||
{
|
||||
public class SmallScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public ObservableCollection<TrainInfo> Screen { get; private set; } = [];
|
||||
public SmallScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 9;
|
||||
PageCount = 1;
|
||||
timeService.RefreshSecondsElapsed += RefreshDisplay;
|
||||
Initialize();
|
||||
}
|
||||
private async void Initialize()
|
||||
{
|
||||
await WaitForDataLoadAsync();
|
||||
Text = $"{string.Join(" ", ThisStation.Name.ToCharArray())} 站 欢 迎 您";
|
||||
RefreshDisplay(null,null);
|
||||
}
|
||||
private void RefreshDisplay(object? sender, EventArgs e)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
int pageCount = (int)Math.Ceiling((double)TrainInfo.Count / (ItemsPerPage * PageCount));
|
||||
Screen.Clear();
|
||||
int startIndex = CurrentPageIndex * ItemsPerPage * PageCount;
|
||||
var Items = TrainInfo.Skip(startIndex).Take(ItemsPerPage).ToList();
|
||||
while (Items.Count < ItemsPerPage) // Fill up with new object() if not enough items
|
||||
{
|
||||
Items.Add(new TrainInfo());
|
||||
}
|
||||
foreach (var item in Items)
|
||||
{
|
||||
Screen.Add(item);
|
||||
}
|
||||
|
||||
CurrentPageIndex = CurrentPageIndex + 1 >= Math.Min(_settings.MaxPages, pageCount) ? 0 : CurrentPageIndex + 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
214
CRSim/Views/Windows/Stations/Jinanxi/SmallScreenView.xaml
Normal file
214
CRSim/Views/Windows/Stations/Jinanxi/SmallScreenView.xaml
Normal file
@@ -0,0 +1,214 @@
|
||||
<Window x:Class="CRSim.Views.Jinanxi.SmallScreenView"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:CRSim.Views.Jinanxi"
|
||||
mc:Ignorable="d"
|
||||
xmlns:converters="clr-namespace:CRSim.Converters"
|
||||
Title="引导屏" SizeToContent="WidthAndHeight"
|
||||
WindowStyle="None" AllowsTransparency="True" Background="Transparent"
|
||||
KeyDown="Window_KeyDown" ResizeMode="NoResize" MouseDown="Window_MouseDown"
|
||||
FontFamily="黑体" FontSize="20">
|
||||
<Window.Resources>
|
||||
<SolidColorBrush x:Key="WhiteBorderBrush" Color="White"/>
|
||||
<SolidColorBrush x:Key="BuleBorderBrush" Color="#46b4ff" />
|
||||
|
||||
<converters:TicketCheckConverter x:Key="TicketCheckConverter" Separator=" - " />
|
||||
<converters:EmptyToVisibilityConverter x:Key="EmptyToVisibilityConverter" />
|
||||
<converters:DateTimeToStringConverter x:Key="DateTimeToStringConverter" Format="HH:mm" />
|
||||
<converters:TrainStateConverter x:Key="TrainStateConverter" WaitingText="正在候车"/>
|
||||
<converters:TrainStateColorConverter x:Key="TrainStateColorConverter" WaitingColor="#ffffff" CheckingTicketsColor="#00ff00" StopCheckingTicketsColor="#ff0000"/>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource WhiteBorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0,0,0,4"/>
|
||||
</Style>
|
||||
<Style x:Key="CommonTextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="4,3,5,4"/>
|
||||
</Style>
|
||||
<Style x:Key="CommonRowStyle" TargetType="DataGridRow">
|
||||
<Setter Property="BorderBrush" Value="{StaticResource WhiteBorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0,2,0,0"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BuleBorderBrush}"/>
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=AlternationIndex}" Value="0">
|
||||
<Setter Property="Background" Value="#015ce9"/>
|
||||
<Setter Property="Foreground" Value="#ffffff"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="CommonHeaderStyle" TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#015ce9"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="White"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- <Style x:Key="CommonRowColorStyle" TargetType="DataGridColumnHeader">
|
||||
<Setter Property="BorderBrush" Value="White"/>
|
||||
<Setter Property="BorderThickness" Value="0,0,0,1"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
</Style> -->
|
||||
</Window.Resources>
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
<Grid Background="#005ae4" HorizontalAlignment="Stretch" Margin="0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Canvas Grid.Column="0" HorizontalAlignment="Right" Width="45" Height="45" Margin="4,0,0,0">
|
||||
<Path Fill="White">
|
||||
<Path.Data>
|
||||
<PathGeometry>
|
||||
<PathFigure StartPoint="45,0" IsClosed="True">
|
||||
<LineSegment Point="0,0" />
|
||||
<ArcSegment Point="45,45" Size="45,45"
|
||||
SweepDirection="Counterclockwise" />
|
||||
</PathFigure>
|
||||
</PathGeometry>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Canvas>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Text}" Foreground="#005ae4" Margin="0,2" HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
FontFamily="楷体" FontWeight="Bold" FontSize="40" Background="White" Name="WelcomeTextBlock" Height="45" TextAlignment="Center"/>
|
||||
<Canvas Grid.Column="2" HorizontalAlignment="Left" Width="45" Height="45" Margin="0,0,4,0">
|
||||
<Path Fill="White">
|
||||
<Path.Data>
|
||||
<PathGeometry>
|
||||
<PathFigure StartPoint="0,0" IsClosed="True">
|
||||
<LineSegment Point="45,0" />
|
||||
<ArcSegment Point="0,45" Size="45,45"
|
||||
SweepDirection="Clockwise" />
|
||||
</PathFigure>
|
||||
</PathGeometry>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
<DataGrid ItemsSource="{Binding Screen, Mode=OneWay}" AutoGenerateColumns="False"
|
||||
CanUserResizeColumns="False" CanUserSortColumns="False" CanUserAddRows="False"
|
||||
CanUserResizeRows="False" CanUserReorderColumns="False"
|
||||
IsReadOnly="True" GridLinesVisibility="None" RowHeight="28"
|
||||
RowStyle="{StaticResource CommonRowStyle}"
|
||||
AlternationCount="1" HeadersVisibility="Column" IsEnabled="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding TrainNumber}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="100">
|
||||
<TextBlock Text="车 次" Style="{StaticResource CommonHeaderStyle}" FontSize="24" Padding="0,2,0,0" FontFamily="楷体"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}"/>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Origin}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="115">
|
||||
<TextBlock Text="始发站" Style="{StaticResource CommonHeaderStyle}" FontSize="24" Padding="0,2,0,0" FontFamily="楷体"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}"/>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding Terminal}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="115">
|
||||
<TextBlock Text="终到站" Style="{StaticResource CommonHeaderStyle}" FontSize="24" Padding="0,2,0,0" FontFamily="楷体"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}"/>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding DepartureTime, Converter={StaticResource DateTimeToStringConverter}}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="100">
|
||||
<TextBlock Text="开 点" Style="{StaticResource CommonHeaderStyle}" FontSize="24" Padding="0,2,0,0" FontFamily="楷体"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}"/>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding TicketChecks,Converter={StaticResource TicketCheckConverter}}">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" MinWidth="100">
|
||||
<TextBlock Text="检票口" Style="{StaticResource CommonHeaderStyle}" FontSize="24" Padding="0,2,0,0" FontFamily="楷体"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}"/>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn>
|
||||
<DataGridTextColumn.Binding>
|
||||
<MultiBinding Mode="OneWay" Converter="{StaticResource TrainStateConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</DataGridTextColumn.Binding>
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="100">
|
||||
<TextBlock Text="状 态" Style="{StaticResource CommonHeaderStyle}" FontSize="24" Padding="0,2,0,0" FontFamily="楷体"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource TrainStateColorConverter}">
|
||||
<Binding Path="ArrivalTime" />
|
||||
<Binding Path="DepartureTime" />
|
||||
<Binding Path="State" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</StackPanel>
|
||||
</Window>
|
||||
33
CRSim/Views/Windows/Stations/Jinanxi/SmallScreenView.xaml.cs
Normal file
33
CRSim/Views/Windows/Stations/Jinanxi/SmallScreenView.xaml.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using CRSim.ViewModels.Jinanxi;
|
||||
|
||||
namespace CRSim.Views.Jinanxi
|
||||
{
|
||||
/// <summary>
|
||||
/// SecondaryScreen.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SmallScreenView : Window
|
||||
{
|
||||
public SmallScreenViewModel ViewModel { get; }
|
||||
public SmallScreenView(SmallScreenViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user