diff --git a/OpenNest.Avalonia/DesktopSettings.cs b/OpenNest.Avalonia/DesktopSettings.cs index 15ab5861..24cebd24 100644 --- a/OpenNest.Avalonia/DesktopSettings.cs +++ b/OpenNest.Avalonia/DesktopSettings.cs @@ -21,6 +21,20 @@ namespace OpenNest.Avalonia public static MachineSettingsSource Machines { get; } = new(Shared, new MachineUserSettingsFile(UserSettingsFile.DefaultPath)); + /// The storage mode and nest server, read once from storage.json as does. + private static readonly NestStorageSettings Storage = NestStorageSettings.Load(NestStorageSettings.DefaultPath); + + private static RemoteNestRepository repository; + + /// + /// File > New nests, numbered by the nest server in Database mode and otherwise by the + /// counter both apps keep in user-settings.json. + /// + public static NewNestSource NewNests { get; } = new( + Machines, + new NewNestUserSettingsFile(UserSettingsFile.DefaultPath), + () => Storage.IsDatabaseMode ? repository ??= new RemoteNestRepository(Storage.ServerUrl) : null); + /// The post processors loaded from Posts/ beside the app, by load order. public static IReadOnlyList PostProcessors { get; private set; } = []; diff --git a/OpenNest.Avalonia/MainWindow.axaml b/OpenNest.Avalonia/MainWindow.axaml index 84af0654..44f9dbfb 100644 --- a/OpenNest.Avalonia/MainWindow.axaml +++ b/OpenNest.Avalonia/MainWindow.axaml @@ -6,6 +6,7 @@ + @@ -45,6 +46,7 @@ +