Load sceneries in parallel and skip the splash on a fast start

Scenery parsing runs on Parallel.ForEach and the reload button does it off
the UI thread. The splash window only appears when loading passes 300ms, so
a warm start goes straight to the main window. The log button moves into the
navigation row, dropping the separate caption strip; timetable and info use
the shared MonoFont family instead of a hard-coded Consolas.
This commit is contained in:
maj00r
2026-08-25 20:58:15 +02:00
parent a15044233e
commit a93af4bd44
7 changed files with 143 additions and 59 deletions

View File

@@ -6,6 +6,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
@@ -488,18 +489,26 @@ public partial class Scenarios : UserControl
ShowSceneryInfo(AppState.Instance.CurrentScenery);
}
private void ReloadSceneries_OnClick(object? sender, RoutedEventArgs e)
private async void ReloadSceneries_OnClick(object? sender, RoutedEventArgs e)
{
string? selected = AppState.Instance.CurrentScenery?.Path;
GameData.Instance.ReloadSceneries();
Sceneries = GameData.Instance.Sceneries;
BuildSceneryTree();
if (!string.IsNullOrEmpty(selected))
reloadButton.IsEnabled = false;
try
{
StarterNG.Classes.Settings.Instance.LastScenery =
Path.GetFileNameWithoutExtension(selected);
string? selected = AppState.Instance.CurrentScenery?.Path;
await Task.Run(() => GameData.Instance.ReloadSceneries());
Sceneries = GameData.Instance.Sceneries;
BuildSceneryTree();
if (!string.IsNullOrEmpty(selected))
{
StarterNG.Classes.Settings.Instance.LastScenery =
Path.GetFileNameWithoutExtension(selected);
}
RestoreLastScenery();
}
finally
{
reloadButton.IsEnabled = true;
}
RestoreLastScenery();
}
private void OpenSceneryDir_OnClick(object? sender, RoutedEventArgs e)