mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-07 18:15:48 +08:00
@@ -57,6 +57,8 @@
|
||||
services.AddTransient<Views.Zibo.SecondaryScreenView>();
|
||||
services.AddTransient<ViewModels.Jinanxi.SmallScreenViewModel>();
|
||||
services.AddTransient<Views.Jinanxi.SmallScreenView>();
|
||||
services.AddTransient<ViewModels.GuangdongIntercity.SecondaryScreenViewModel>();
|
||||
services.AddTransient<Views.GuangdongIntercity.SecondaryScreenView>();
|
||||
}).Build();
|
||||
|
||||
[STAThread]
|
||||
|
||||
BIN
CRSim/Assets/StyleImages/GuangdongIntercity/SecondaryScreen.png
Normal file
BIN
CRSim/Assets/StyleImages/GuangdongIntercity/SecondaryScreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -14,7 +14,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Remove="App.xaml" />
|
||||
<None Remove="Assets\StyleImages\Jinanxi\SmallScreen.png" />
|
||||
<Content Include="Assets\Advertisement.mp4">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@@ -36,6 +35,7 @@
|
||||
<Resource Include="Assets\StyleImages\ChengduDong\SecondaryScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\ChengduMetro\ChengduMetro-Icon.png" />
|
||||
<Resource Include="Assets\StyleImages\ChengduMetro\PlatformScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\GuangdongIntercity\SecondaryScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Guangyuan\PrimaryScreen.png" />
|
||||
<Resource Include="Assets\StyleImages\Hanzhong\Image.png" />
|
||||
<Resource Include="Assets\StyleImages\Hanzhong\PlatformScreen.png" />
|
||||
@@ -93,7 +93,10 @@
|
||||
<Compile Update="Views\Windows\Stations\Zibo\SecondaryScreenView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Windows\Stations\Jinanxi\PrimaryScreen.xaml.cs">
|
||||
<Compile Update="Views\Windows\Stations\Jinanxi\SmallScreenView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Windows\Stations\GuangdongIntercity\SecondaryScreenView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -115,5 +115,15 @@
|
||||
"Parameters": [
|
||||
"Station"
|
||||
]
|
||||
},
|
||||
{
|
||||
"UniqueId": "GuangdongIntercity SecondaryScreen",
|
||||
"Title": "广东城际次要看板",
|
||||
"Station": "GuangdongIntercity",
|
||||
"StyleName": "SecondaryScreenView",
|
||||
"ImagePath": "Assets/StyleImages/GuangdongIntercity/SecondaryScreen.png",
|
||||
"Parameters": [
|
||||
"Station"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace CRSim.ViewModels
|
||||
{
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
namespace CRSim.ViewModels.GuangdongIntercity
|
||||
{
|
||||
public class SecondaryScreenViewModel : ScreenViewModel
|
||||
{
|
||||
public ObservableCollection<TrainInfo> Screen { get; private set; } = [];
|
||||
public SecondaryScreenViewModel(ITimeService timeService, ISettingsService settingsService)
|
||||
: base(timeService, settingsService)
|
||||
{
|
||||
ItemsPerPage = 8;
|
||||
PageCount = 1;
|
||||
timeService.RefreshSecondsElapsed += RefreshDisplay;
|
||||
Initialize();
|
||||
}
|
||||
private async void Initialize()
|
||||
{
|
||||
await WaitForDataLoadAsync();
|
||||
Text = $"列 车 到 发 信 息";
|
||||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
<Window x:Class="CRSim.Views.GuangdongIntercity.SecondaryScreenView"
|
||||
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.GuangdongIntercity"
|
||||
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="18">
|
||||
<Window.Resources>
|
||||
|
||||
<converters:TicketCheckConverter x:Key="TicketCheckConverter" Separator=" - " />
|
||||
<converters:EmptyToVisibilityConverter x:Key="EmptyToVisibilityConverter" />
|
||||
<converters:DateTimeToStringConverter x:Key="DateTimeToStringConverter" Format="HH:mm" />
|
||||
<converters:TrainStateConverter x:Key="TrainStateConverter"/>
|
||||
<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,0,0,0"/>
|
||||
</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="CommonHeaderStyle" TargetType="TextBlock">
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#ffffff"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="#000000"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="CommonRowStyle" TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=AlternationIndex}" Value="0">
|
||||
<Setter Property="Background" Value="#1a2398"/>
|
||||
<Setter Property="Foreground" Value="#ffffff"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=AlternationIndex}" Value="1">
|
||||
<Setter Property="Background" Value="#1f4dfb"/>
|
||||
<Setter Property="Foreground" Value="#ffffff"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
<Grid Background="#1f4dfb" HorizontalAlignment="Stretch" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Text}" Foreground="#ffffff" Margin="30,2"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center"
|
||||
FontSize="32" FontWeight="Bold">
|
||||
<TextBlock.LayoutTransform>
|
||||
<ScaleTransform ScaleX="1.7" ScaleY="1"/>
|
||||
</TextBlock.LayoutTransform>
|
||||
</TextBlock>
|
||||
<TextBlock Grid.Column="2" Text="{Binding CurrentTime_GuangdongIntercity}" Foreground="#ffffff" Margin="30,2" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Center" FontSize="10"/>
|
||||
</Grid>
|
||||
|
||||
<DataGrid ItemsSource="{Binding Screen, Mode=OneWay}" AutoGenerateColumns="False"
|
||||
CanUserResizeColumns="False" CanUserSortColumns="False" CanUserAddRows="False"
|
||||
CanUserResizeRows="False" CanUserReorderColumns="False"
|
||||
IsReadOnly="True" GridLinesVisibility="None" RowHeight="35"
|
||||
ColumnHeaderHeight="35"
|
||||
RowStyle="{StaticResource CommonRowStyle}"
|
||||
AlternationCount="2" HeadersVisibility="Column" IsEnabled="False">
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding TrainNumber}" MinWidth="100">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="车次" Style="{StaticResource CommonHeaderStyle}" FontSize="18" 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}" MinWidth="115">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="始发站" Style="{StaticResource CommonHeaderStyle}" FontSize="18" 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}" MinWidth="115">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="终到站" Style="{StaticResource CommonHeaderStyle}" FontSize="18" Padding="0,2,0,0" FontFamily="微软雅黑"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}"/>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
|
||||
<DataGridTextColumn Binding="{Binding ArrivalTime, Converter={StaticResource DateTimeToStringConverter}}" MinWidth="100">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="到点" Style="{StaticResource CommonHeaderStyle}" FontSize="18" 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}}" MinWidth="100">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="开点" Style="{StaticResource CommonHeaderStyle}" FontSize="18" 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}}" MinWidth="100">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="检票口" Style="{StaticResource CommonHeaderStyle}" FontSize="18" Padding="0,2,0,0" FontFamily="微软雅黑"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CommonTextBlockStyle}"/>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn MinWidth="100">
|
||||
<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="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}}">
|
||||
<TextBlock Text="状态" Style="{StaticResource CommonHeaderStyle}" FontSize="18" 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>
|
||||
@@ -0,0 +1,33 @@
|
||||
using CRSim.ViewModels.GuangdongIntercity;
|
||||
|
||||
namespace CRSim.Views.GuangdongIntercity
|
||||
{
|
||||
/// <summary>
|
||||
/// SecondaryScreen.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SecondaryScreenView : Window
|
||||
{
|
||||
public SecondaryScreenViewModel ViewModel { get; }
|
||||
public SecondaryScreenView(SecondaryScreenViewModel 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