diff --git a/CRSim.ScreenSimulator/ViewModels/Windows/Stations/ChengduMetro/PlatformScreenViewModel.cs b/CRSim.ScreenSimulator/ViewModels/Windows/Stations/ChengduMetro/PlatformScreenViewModel.cs index 6d3b254..f04384d 100644 --- a/CRSim.ScreenSimulator/ViewModels/Windows/Stations/ChengduMetro/PlatformScreenViewModel.cs +++ b/CRSim.ScreenSimulator/ViewModels/Windows/Stations/ChengduMetro/PlatformScreenViewModel.cs @@ -15,6 +15,9 @@ namespace CRSim.ScreenSimulator.ViewModels.ChengduMetro private TrainInfo _secondTrain = new(); [ObservableProperty] private string _text = "不吃火锅,就吃烤匠。 建设成渝地区双城经济圈,共同唱好新时代西部“双城记”。 2018年2月8日,复兴号列车首次担当G89次列车,正式开进四川,标志着“复兴号”高速列车正式走上蜀道。然而,在行驶至西安北站时,发生了突发设备故障,车轴出现过热报警,导致车号为CR400BF-5033的复兴号列车被迫停运并进行检修。相关工作人员迅速展开故障排查,并确保乘客安全无虞。"; + [ObservableProperty] + private Uri _video = new("Assets\\Advertisement.mp4", UriKind.Relative); + public List TrainInfos { get; set; } = []; public PlatformScreenViewModel(ITimeService timeService) { diff --git a/CRSim.ScreenSimulator/Views/Windows/Stations/ChengduMetro/PlatformScreenView.xaml b/CRSim.ScreenSimulator/Views/Windows/Stations/ChengduMetro/PlatformScreenView.xaml index 4fc0a0d..7fd606d 100644 --- a/CRSim.ScreenSimulator/Views/Windows/Stations/ChengduMetro/PlatformScreenView.xaml +++ b/CRSim.ScreenSimulator/Views/Windows/Stations/ChengduMetro/PlatformScreenView.xaml @@ -1,4 +1,4 @@ - - + diff --git a/CRSim.ScreenSimulator/Views/Windows/Stations/ChengduMetro/PlatformScreenView.xaml.cs b/CRSim.ScreenSimulator/Views/Windows/Stations/ChengduMetro/PlatformScreenView.xaml.cs index 923334c..ce9e3c2 100644 --- a/CRSim.ScreenSimulator/Views/Windows/Stations/ChengduMetro/PlatformScreenView.xaml.cs +++ b/CRSim.ScreenSimulator/Views/Windows/Stations/ChengduMetro/PlatformScreenView.xaml.cs @@ -17,7 +17,6 @@ namespace CRSim.ScreenSimulator.Views.ChengduMetro ViewModel = viewModel; RenderOptions.SetEdgeMode(this, EdgeMode.Aliased); DataContext = this; - player.Source = new Uri("Assets\\Advertisement.mp4", UriKind.Relative); player.Play(); } private void Window_MouseDown(object sender, MouseButtonEventArgs e) diff --git a/CRSim/Models/StylesInfoData.json b/CRSim/Models/StylesInfoData.json index b90f63a..8330820 100644 --- a/CRSim/Models/StylesInfoData.json +++ b/CRSim/Models/StylesInfoData.json @@ -63,7 +63,8 @@ "ImagePath": "Assets/StyleImages/ChengduMetro/PlatformScreen.png", "Parameters": [ "Station", - "Text" + "Text", + "Video" ] }, { diff --git a/CRSim/ViewModels/Pages/Simulation/ScreenSimulationPageViewModel.cs b/CRSim/ViewModels/Pages/Simulation/ScreenSimulationPageViewModel.cs index 0b7edd6..9415026 100644 --- a/CRSim/ViewModels/Pages/Simulation/ScreenSimulationPageViewModel.cs +++ b/CRSim/ViewModels/Pages/Simulation/ScreenSimulationPageViewModel.cs @@ -28,12 +28,18 @@ public partial class ScreenSimulationPageViewModel : ObservableObject [ObservableProperty] private bool _textNeeded; + [ObservableProperty] + private bool _videoNeeded; + [ObservableProperty] private bool _locationNeeded; [ObservableProperty] private string _text = ""; + [ObservableProperty] + private string _video = ""; + public string SelectedStationName = ""; public string SelectedTicketCheck = ""; @@ -86,6 +92,7 @@ public partial class ScreenSimulationPageViewModel : ObservableObject StationNeeded = neededParameters.Contains("Station"); TicketCheckNeeded = neededParameters.Contains("TicketCheck"); PlatformNeeded = neededParameters.Contains("Platform"); + VideoNeeded = neededParameters.Contains("Video"); TextNeeded = neededParameters.Contains("Text"); LocationNeeded = neededParameters.Contains("Location"); } @@ -149,6 +156,13 @@ public partial class ScreenSimulationPageViewModel : ObservableObject CheckCanStart(); } [RelayCommand] + public void SelectVideo() + { + string? Path = _dialogService.GetFile("视频文件 (*.mp4)|*.mp4|所有文件 (*.*)|*.*"); + if (Path == null) return; + Video = Path; + } + [RelayCommand] public void StartSimulation() { var Window = _serviceProvider.GetRequiredService(selectedStyle) as dynamic; @@ -161,6 +175,10 @@ public partial class ScreenSimulationPageViewModel : ObservableObject { Window.ViewModel.Location = SelectedLoaction; } + if (VideoNeeded && Video != string.Empty) + { + Window.ViewModel.Video = new Uri(Video, UriKind.Absolute); + } Window.ViewModel.LoadData(_databaseService.GetStationByName(SelectedStationName), TicketCheckNeeded ? SelectedTicketCheck : string.Empty, diff --git a/CRSim/Views/Pages/Simulation/ScreenSimulationPage.xaml b/CRSim/Views/Pages/Simulation/ScreenSimulationPage.xaml index 2184a32..171d914 100644 --- a/CRSim/Views/Pages/Simulation/ScreenSimulationPage.xaml +++ b/CRSim/Views/Pages/Simulation/ScreenSimulationPage.xaml @@ -1,4 +1,4 @@ - - + + + + + + + + + + + + 留空即为默认 + + + +