feat: implement dynamic knowledge graph updates and state management services
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using NexusReader.Application.Queries.Graph;
|
||||
|
||||
namespace NexusReader.UI.Shared.Services;
|
||||
|
||||
public sealed class KnowledgeGraphService : IKnowledgeGraphService
|
||||
{
|
||||
public GraphDataDto? CurrentGraphData { get; private set; }
|
||||
public string? ActiveNodeId { get; private set; }
|
||||
|
||||
public event Action? OnGraphUpdated;
|
||||
public event Action<string>? OnActiveNodeChanged;
|
||||
|
||||
public void UpdateGraph(GraphDataDto newData)
|
||||
{
|
||||
CurrentGraphData = newData;
|
||||
OnGraphUpdated?.Invoke();
|
||||
}
|
||||
|
||||
public void SetActiveNode(string nodeId)
|
||||
{
|
||||
if (ActiveNodeId == nodeId) return;
|
||||
ActiveNodeId = nodeId;
|
||||
OnActiveNodeChanged?.Invoke(nodeId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user