diff --git a/CRSim/CRSim.csproj b/CRSim/CRSim.csproj
index eeee04d..facf08f 100644
--- a/CRSim/CRSim.csproj
+++ b/CRSim/CRSim.csproj
@@ -45,7 +45,7 @@
-
+
diff --git a/CRSim/ViewModels/StationManagementPageViewModel.cs b/CRSim/ViewModels/StationManagementPageViewModel.cs
index 8eb3c0b..b92717d 100644
--- a/CRSim/ViewModels/StationManagementPageViewModel.cs
+++ b/CRSim/ViewModels/StationManagementPageViewModel.cs
@@ -14,6 +14,9 @@ public partial class StationManagementPageViewModel : ObservableObject
[ObservableProperty]
public partial string SearchText { get; set; } = "";
+ [ObservableProperty]
+ public partial string SearchTrainNumberText { get; set; } = "";
+
[ObservableProperty]
public partial bool IsSelected { get; set; } = false;
@@ -29,6 +32,7 @@ public partial class StationManagementPageViewModel : ObservableObject
public ObservableCollection Platforms { get; private set; } = [];
public ObservableCollection TrainStops { get; private set; } = [];
+ public ObservableCollection FilteredTrainStops =>[.. TrainStops.Where(x => x.Number.ToUpper().Contains(SearchTrainNumberText.ToUpper()))];
private readonly IDatabaseService _databaseService = App.AppHost.Services.GetService();
@@ -37,6 +41,8 @@ public partial class StationManagementPageViewModel : ObservableObject
private readonly INetworkService _networkService = App.AppHost.Services.GetService();
public StationManagementPageViewModel()
{
+ TrainStops.CollectionChanged += (sender, e) =>
+ OnPropertyChanged(nameof(FilteredTrainStops));
RefreshStations();
}
private void UpdateInfoItems()
@@ -87,6 +93,7 @@ public partial class StationManagementPageViewModel : ObservableObject
WaitingAreas.Clear();
Platforms.Clear();
TrainStops.Clear();
+ SearchTrainNumberText = string.Empty;
if (args is SelectionChangedEventArgs selectedStation && selectedStation.AddedItems.Count > 0)
{
SelectedStation = _databaseService.GetStationByName(selectedStation.AddedItems[0].ToString());
@@ -352,6 +359,12 @@ public partial class StationManagementPageViewModel : ObservableObject
#endregion
#region TrainStop
+ [RelayCommand]
+ public void SearchTrainNumber()
+ {
+ OnPropertyChanged(nameof(FilteredTrainStops));
+ }
+
[RelayCommand]
public async Task ImportFromTrainNumbers()
{
diff --git a/CRSim/Views/StationManagementPage.xaml b/CRSim/Views/StationManagementPage.xaml
index ecec83b..d0ba63b 100644
--- a/CRSim/Views/StationManagementPage.xaml
+++ b/CRSim/Views/StationManagementPage.xaml
@@ -167,8 +167,16 @@
+
+
+
+
+
+
+
-
+