FindMyFiles

FindMyFiles.Services

IDispatcher Interface

UI-thread dispatch boundary. The single seam that lets the search pipeline and the virtualized list run under unit tests without a real DispatcherQueue — two implementations by necessity: DispatcherQueueDispatcher (production) and a manual fake in the test project.

public interface IDispatcher

Derived
DispatcherQueueDispatcher

Properties

IDispatcher.HasThreadAccess Property

True when the caller is already on the UI thread.

bool HasThreadAccess { get; }

Property Value

System.Boolean

Methods

IDispatcher.CreateOneShotTimer(TimeSpan, Action) Method

One-shot timer: fires tick once per Start(). Start() while pending restarts the interval (debounce semantics).

FindMyFiles.Services.IDispatcherTimer CreateOneShotTimer(System.TimeSpan interval, System.Action tick);

Parameters

interval System.TimeSpan

Delay between Start() and the tick.

tick System.Action

Callback fired on the UI thread when the interval elapses.

Returns

IDispatcherTimer
A restartable timer handle bound to this dispatcher.

IDispatcher.TryEnqueue(Action) Method

Queue action to run on the UI thread. Returns false if the queue is shutting down and the work was not accepted.

bool TryEnqueue(System.Action action);

Parameters

action System.Action

Work to marshal onto the UI thread.

Returns

System.Boolean
True if enqueued; false if the dispatcher is no longer accepting work.