diff --git a/CRSim/CRSim.csproj b/CRSim/CRSim.csproj index d201ef1..c4486d7 100644 --- a/CRSim/CRSim.csproj +++ b/CRSim/CRSim.csproj @@ -9,7 +9,7 @@ 13.0 CRSim.App Assets\CRSimIcon.ico - 1.2.7.0 + 1.2.7.1 diff --git a/CRSim/Models/ControlsInfoDataSource.cs b/CRSim/Models/ControlsInfoDataSource.cs index f181603..f735af2 100644 --- a/CRSim/Models/ControlsInfoDataSource.cs +++ b/CRSim/Models/ControlsInfoDataSource.cs @@ -101,7 +101,7 @@ namespace CRSim.Models public ICollection GetGroupedControlsInfo() { - return ControlsInfo.Where(x => x.IsGroup == true).ToList(); + return [.. ControlsInfo.Where(x => x.IsGroup == true)]; } } } diff --git a/CRSim/ViewModels/Pages/DataManagement/StationManagementPageViewModel.cs b/CRSim/ViewModels/Pages/DataManagement/StationManagementPageViewModel.cs index 000ea91..e798a22 100644 --- a/CRSim/ViewModels/Pages/DataManagement/StationManagementPageViewModel.cs +++ b/CRSim/ViewModels/Pages/DataManagement/StationManagementPageViewModel.cs @@ -365,7 +365,7 @@ public partial class StationManagementPageViewModel : ObservableObject Length = firstColumn.StartsWith('G') || firstColumn.StartsWith('D') || firstColumn.StartsWith('C') ? Math.Abs(firstColumn.GetHashCode()) % 3 == 0 ? 8 : 16 : 18, Landmark = new[] { "ºìÉ«", "ÂÌÉ«", "ºÖÉ«", "À¶É«", "×ÏÉ«", "»ÆÉ«", "³ÈÉ«", null }[new Random().Next(8)] }; - trainStop.TicketChecks = TicketChecks.Where(x => x.Name == trainStop.Platform + "A" || x.Name == trainStop.Platform + "B").Select(x => x.Name).ToList(); + trainStop.TicketChecks = [.. TicketChecks.Where(x => x.Name == trainStop.Platform + "A" || x.Name == trainStop.Platform + "B").Select(x => x.Name)]; if (trainStop.TicketChecks.Count == 0) trainStop.TicketChecks = [TicketChecks[new Random().Next(TicketChecks.Count)].Name]; TrainStops.Add(trainStop); } @@ -544,7 +544,7 @@ public partial class StationManagementPageViewModel : ObservableObject t.Platform = Platforms[new Random().Next(Platforms.Count)].Name; t.Landmark = new[] { "ºìÉ«", "ÂÌÉ«", "ºÖÉ«", "À¶É«", "×ÏÉ«", "»ÆÉ«", "³ÈÉ«", null }[new Random().Next(8)]; t.Length = t.Number.StartsWith('G') || t.Number.StartsWith('D') || t.Number.StartsWith('C') ? Math.Abs(t.Number.GetHashCode()) % 3 == 0 ? 8 : 16 : 18; - t.TicketChecks = TicketChecks.Where(x => x.Name == t.Platform + "A" || x.Name == t.Platform + "B").Select(x => x.Name).ToList(); + t.TicketChecks = [.. TicketChecks.Where(x => x.Name == t.Platform + "A" || x.Name == t.Platform + "B").Select(x => x.Name)]; if (t.TicketChecks.Count == 0) t.TicketChecks = [TicketChecks[new Random().Next(TicketChecks.Count)].Name]; TrainStops.Add(t); } diff --git a/CRSim/Views/Windows/Dialogs/TicketCheckDialog.xaml.cs b/CRSim/Views/Windows/Dialogs/TicketCheckDialog.xaml.cs index b322af7..26806fa 100644 --- a/CRSim/Views/Windows/Dialogs/TicketCheckDialog.xaml.cs +++ b/CRSim/Views/Windows/Dialogs/TicketCheckDialog.xaml.cs @@ -90,7 +90,7 @@ namespace CRSim.Views int min = Math.Min(startNum, endNum); int max = Math.Max(startNum, endNum); - List numbers = Enumerable.Range(min, max - min + 1).ToList(); + List numbers = [.. Enumerable.Range(min, max - min + 1)]; List result = []; diff --git a/CRSim/Views/Windows/Dialogs/TrainStopDialog.xaml.cs b/CRSim/Views/Windows/Dialogs/TrainStopDialog.xaml.cs index 6c52794..ad21cd0 100644 --- a/CRSim/Views/Windows/Dialogs/TrainStopDialog.xaml.cs +++ b/CRSim/Views/Windows/Dialogs/TrainStopDialog.xaml.cs @@ -124,7 +124,7 @@ namespace CRSim.Views Origin = DepartureTextBox.Text, ArrivalTime = StartHour.IsEnabled ? TimeSpan.Parse($"{StartHour.Text}:{StartMinute.Text}") : null, DepartureTime = EndHour.IsEnabled ? TimeSpan.Parse($"{EndHour.Text}:{EndMinute.Text}") : null, - TicketChecks = TicketChecksList.Where(x => x.Checked).Select(x => x.TicketCheck).ToList(), + TicketChecks = [.. TicketChecksList.Where(x => x.Checked).Select(x => x.TicketCheck)], Platform = (string)PlatformComboBox.SelectedItem, Length = int.Parse(LengthTextBox.Text), Landmark = (string)LandmarkComboBox.SelectedItem == "æ— " ? null: (string)LandmarkComboBox.SelectedItem,