Take the remaining I/O out of the domain and drop AppState.Instance

Scenery translations and load weights get repositories; AppState moves to the
application layer.
This commit is contained in:
maj00r
2026-09-04 21:06:23 +02:00
parent 0444070e12
commit 8e5fe01104
16 changed files with 479 additions and 216 deletions

View File

@@ -6,6 +6,7 @@ using System.Linq;
using StarterNG.Classes;
using StarterNG.Domain.Sceneries;
using StarterNG.Domain.Vehicles;
using StarterNG.Application;
namespace StarterNG.Domain;
@@ -170,7 +171,7 @@ public sealed class Consist : IReadOnlyList<ConsistItem>
var driven = item.Cars.FirstOrDefault(c =>
c.DriverType is eDriverType.Headdriver or eDriverType.Reardriver);
AppState.Instance.StartingVehicleName = (driven ?? item.Cars[0]).Name;
AppServices.Current.State.StartingVehicleName = (driven ?? item.Cars[0]).Name;
}
public Dynamic MakeDynamic(VehicleTexture texture, Scenery? scenery)
@@ -324,7 +325,7 @@ public sealed class Consist : IReadOnlyList<ConsistItem>
if (ReferenceEquals(Selected, item))
SyncStartingVehicle();
Raise();
AppState.Instance.NotifyChanged();
AppServices.Current.State.NotifyChanged();
}
public void Split(ConsistItem item)