FindMyFiles

FindMyFiles.ViewModels

ResultsPresenter Class

Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.

public sealed class ResultsPresenter : CommunityToolkit.Mvvm.ComponentModel.ObservableObject

Inheritance System.ObjectCommunityToolkit.Mvvm.ComponentModel.ObservableObject → ResultsPresenter

Constructors

ResultsPresenter(IDispatcher) Constructor

Create the presenter and its lifetime-single VirtualResultList, both bound to dispatcher (the UI thread that publishes and fetches run on).

public ResultsPresenter(FindMyFiles.Services.IDispatcher dispatcher);

Parameters

dispatcher IDispatcher

UI-thread dispatcher that publishes and page fetches run on.

Properties

ResultsPresenter.ResultsSource Property

Lifetime-single ItemsSource — bind with x:Bind OneTime.

public FindMyFiles.Virtualization.VirtualResultList ResultsSource { get; }

Property Value

VirtualResultList

Methods

ResultsPresenter.PresentEmpty() Method

Empty search box → empty screen, idempotently.

public void PresentEmpty();

ResultsPresenter.PresentEngineFailure() Method

Engine failure: the notification carries the details.

public void PresentEngineFailure();

ResultsPresenter.PresentQueryError(string) Method

Show a query problem without touching the published results.

public void PresentQueryError(string message);

Parameters

message System.String

The query-error message to display in the status bar.

ResultsPresenter.PublishAsync(ISearchResult, QueryTraceData, RequeryOrigin, IHighlighter, Func<bool>) Method

Prefetch the viewport pages of result, then publish it. Runs on the UI thread; the page reads themselves are async, so the thread is never blocked and newer keystrokes keep flowing. When isCurrent turns false mid-flight the result is disposed unpublished — the screen keeps showing the previous result.

public System.Threading.Tasks.Task PublishAsync(FindMyFiles.Engine.ISearchResult result, FindMyFiles.Engine.QueryTraceData? trace, FindMyFiles.ViewModels.RequeryOrigin origin, FindMyFiles.Highlighting.IHighlighter highlighter, System.Func<bool> isCurrent);

Parameters

result ISearchResult

The new search result to prefetch and publish.

trace QueryTraceData

Optional query trace used to format the count text; null when no timing is available.

origin RequeryOrigin

Why the requery ran — decides reset vs. position restore.

highlighter IHighlighter

Match highlighter applied to the published rows.

isCurrent System.Func<System.Boolean>

Predicate that returns false once a newer query has superseded this one.

Returns

System.Threading.Tasks.Task
A System.Threading.Tasks.Task representing the asynchronous publish.

Exceptions

StaleResultException
The index was structurally rebuilt while prefetching — the caller decides whether to retry.

ResultsPresenter.RefreshInPlaceAsync(ISearchResult, QueryTraceData, RequeryOrigin, IHighlighter, Func<bool>) Method

Same-results refresh (Unchanged): swap the new handle in without a Reset, so an idle USN requery repaints nothing — only cells whose values actually changed in place (sizes/mtimes of files being written) update. The count text stays untouched on purpose: a churning ms display reads as flicker. Falls back to a full publish if the counts somehow disagree.

public System.Threading.Tasks.Task RefreshInPlaceAsync(FindMyFiles.Engine.ISearchResult result, FindMyFiles.Engine.QueryTraceData? trace, FindMyFiles.ViewModels.RequeryOrigin origin, FindMyFiles.Highlighting.IHighlighter highlighter, System.Func<bool> isCurrent);

Parameters

result ISearchResult

The refreshed search result handle to swap in.

trace QueryTraceData

Optional query trace forwarded to the publish fallback; null when no timing is available.

origin RequeryOrigin

Why the requery ran — forwarded to the publish fallback.

highlighter IHighlighter

Match highlighter applied to the refreshed rows.

isCurrent System.Func<System.Boolean>

Predicate that returns false once a newer query has superseded this one.

Returns

System.Threading.Tasks.Task
A System.Threading.Tasks.Task representing the asynchronous refresh.

Events

ResultsPresenter.ResultsPublished Event

Raised on the UI thread right after each seeded Reset.

public event Action<ResultsPublication>? ResultsPublished;

Event Type

System.Action<ResultsPublication>