use DI in Godot Nodes

This commit is contained in:
Matt Parker
2025-10-18 14:20:04 +10:00
parent 4d67503e13
commit d285ce1bf2
13 changed files with 136 additions and 44 deletions

View File

@@ -2,6 +2,7 @@ using Godot;
using Microsoft.Build.Locator;
using Microsoft.Extensions.Hosting;
using SharpIDE.Application.Features.Events;
using SharpIDE.Application.Features.FilePersistence;
using SharpIDE.Godot.Features.IdeSettings;
using SharpIDE.Godot.Features.SlnPicker;
@@ -19,9 +20,12 @@ public partial class IdeWindow : Control
private IdeRoot? _ideRoot;
private SlnPicker? _slnPicker;
[Inject] private readonly IdeOpenTabsFileManager _openTabsFileManager = null!;
public override void _Ready()
{
GD.Print("IdeWindow _Ready called");
ResourceLoader.LoadThreadedRequest(SlnPickerScenePath);
ResourceLoader.LoadThreadedRequest(IdeRootScenePath);
MSBuildLocator.RegisterDefaults();
@@ -45,7 +49,7 @@ public partial class IdeWindow : Control
private void OnFocusExited()
{
_ = Task.GodotRun(async () => await Singletons.OpenTabsFileManager.SaveAllOpenFilesAsync());
_ = Task.GodotRun(async () => await _openTabsFileManager.SaveAllOpenFilesAsync());
}
public void PickSolution(bool fullscreen = false)