mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-04 16:26:24 +08:00
style: 优化代码风格
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<LangVersion>13.0</LangVersion>
|
||||
<StartupObject>CRSim.App</StartupObject>
|
||||
<ApplicationIcon>Assets\CRSimIcon.ico</ApplicationIcon>
|
||||
<Version>1.2.7.0</Version>
|
||||
<Version>1.2.7.1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace CRSim.Models
|
||||
|
||||
public ICollection<ControlInfoDataItem> GetGroupedControlsInfo()
|
||||
{
|
||||
return ControlsInfo.Where(x => x.IsGroup == true).ToList();
|
||||
return [.. ControlsInfo.Where(x => x.IsGroup == true)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace CRSim.Views
|
||||
|
||||
int min = Math.Min(startNum, endNum);
|
||||
int max = Math.Max(startNum, endNum);
|
||||
List<int> numbers = Enumerable.Range(min, max - min + 1).ToList();
|
||||
List<int> numbers = [.. Enumerable.Range(min, max - min + 1)];
|
||||
|
||||
List<string> result = [];
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user