use instance for global events

This commit is contained in:
Matt Parker
2025-09-30 20:34:29 +10:00
parent eb88897a2a
commit 41f25ec772
11 changed files with 38 additions and 34 deletions

View File

@@ -25,7 +25,7 @@ public partial class CodeEditorPanel : MarginContainer
var tabBar = _tabContainer.GetTabBar();
tabBar.TabCloseDisplayPolicy = TabBar.CloseButtonDisplayPolicy.ShowAlways;
tabBar.TabClosePressed += OnTabClosePressed;
GlobalEvents.DebuggerExecutionStopped += OnDebuggerExecutionStopped;
GlobalEvents.Instance.DebuggerExecutionStopped += OnDebuggerExecutionStopped;
}
public override void _UnhandledKeyInput(InputEvent @event)

View File

@@ -22,11 +22,11 @@ public partial class DebugPanel : Control
//_tabBar.TabClosePressed
_tabBar.TabClicked += OnTabBarTabClicked;
_tabsPanel = GetNode<MarginContainer>("%TabsPanel");
GlobalEvents.ProjectStartedDebugging += async projectModel =>
GlobalEvents.Instance.ProjectStartedDebugging += async projectModel =>
{
await this.InvokeAsync(() => ProjectStartedDebugging(projectModel));
};
GlobalEvents.ProjectStoppedDebugging += async projectModel =>
GlobalEvents.Instance.ProjectStoppedDebugging += async projectModel =>
{
await this.InvokeAsync(() => ProjectStoppedDebugging(projectModel));
};

View File

@@ -20,7 +20,7 @@ public partial class ThreadsVariablesSubTab : Control
_threadsVboxContainer = GetNode<VBoxContainer>("%ThreadsPanel/VBoxContainer");
_stackFramesVboxContainer = GetNode<VBoxContainer>("%StackFramesPanel/VBoxContainer");
_variablesVboxContainer = GetNode<VBoxContainer>("%VariablesPanel/VBoxContainer");
GlobalEvents.DebuggerExecutionStopped += OnDebuggerExecutionStopped;
GlobalEvents.Instance.DebuggerExecutionStopped += OnDebuggerExecutionStopped;
}

View File

@@ -21,11 +21,11 @@ public partial class RunPanel : Control
//_tabBar.TabClosePressed
_tabBar.TabClicked += OnTabBarTabClicked;
_tabsPanel = GetNode<MarginContainer>("%TabsPanel");
GlobalEvents.ProjectStartedRunning += async projectModel =>
GlobalEvents.Instance.ProjectStartedRunning += async projectModel =>
{
await this.InvokeAsync(() => ProjectStartedRunning(projectModel));
};
GlobalEvents.ProjectStoppedRunning += async projectModel =>
GlobalEvents.Instance.ProjectStoppedRunning += async projectModel =>
{
await this.InvokeAsync(() => ProjectStoppedRunning(projectModel));
};

View File

@@ -2,6 +2,7 @@ using Godot;
using Microsoft.Build.Locator;
using Microsoft.Extensions.Hosting;
using SharpIDE.Application.Features.Analysis;
using SharpIDE.Application.Features.Events;
using SharpIDE.Application.Features.SolutionDiscovery;
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
using SharpIDE.Godot.Features.BottomPanel;
@@ -34,6 +35,7 @@ public partial class IdeRoot : Control
public override void _EnterTree()
{
GodotGlobalEvents.Instance = new GodotGlobalEvents();
GlobalEvents.Instance = new GlobalEvents();
}
public override void _Ready()