Merge nucleic/warm-north-vole-pf37 into dev

This commit is contained in:
2026-08-04 02:46:53 -07:00
parent c34eb1ff61
commit f5ee895d3f
18 changed files with 1515 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
namespace NucleicApp.Services;
/// Isolates WinUI's DispatcherQueue from the renderer state machine and keeps tests portable.
public interface IRendererDispatcher
{
void Post(Action action);
}
public sealed class SynchronizationContextDispatcher : IRendererDispatcher
{
private readonly SynchronizationContext context;
public SynchronizationContextDispatcher(SynchronizationContext? context = null)
{
this.context = context ?? SynchronizationContext.Current
?? throw new InvalidOperationException("renderer has no SynchronizationContext");
}
public void Post(Action action) => context.Post(static state => ((Action)state!).Invoke(), action);
}
public sealed class InlineRendererDispatcher : IRendererDispatcher
{
public static InlineRendererDispatcher Instance { get; } = new();
private InlineRendererDispatcher() { }
public void Post(Action action) => action();
}