public sealed class DialogServiceThe editor's modal questions: confirm, prompt, choose, and one it is handed.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Drawn, not native, and doc 20 is explicit about why. A modal that is an OS window cannot be screenshotted by the golden-image suite and cannot be driven by the automation harness — so every question the editor asks about its own state is a Vixen.Ui.Controls Dialog in the shell's document. The file pickers are the opposite case and go through INativeDialogs: those are about the user's disk rather than the editor's state, and a drawn one has none of the places, tags or sandbox permissions a real picker carries.
⚠ Asynchronous, and the continuation runs on the frame loop. The answer is completed from Pump rather than from the click handler, so an await ConfirmAsync(…) resumes on the thread that owns the document, between two frames, with nothing half-dispatched underneath it. Nothing here posts to the thread pool and nothing here blocks — a dialog that blocked the loop would be a dialog that never drew.
⚠ One at a time, and a second ask waits for the first. Two backdrops over each other is a picture with no answer in it: the lower dialog is visible, unreachable, and still holds the focus scope. Queued rather than refused, because the callers are commands and "your Save prompt was dropped because a rename was open" is the failure that loses work.
Fields and properties (3)
public Dialog? CurrentThe dialog on screen, or .
public bool IsOpenWhether something is being asked.
public int PendingHow many asks are waiting behind it.
Methods (7)
public DialogService(UiDocument document)Creates the service over a document.
public Task<bool> ConfirmAsync(string title, string? message = null, string? confirm = null, string? cancel = null, bool danger = false)Asks a yes-or-no question.
public Task<string?> PromptAsync(string title, string? message = null, string? initial = null, string? confirm = null)Asks for a line of text.
public Task<int> ChooseAsync(string title, string? message, params ReadOnlySpan<string> choices)Asks the user to pick one of several.
public Task<TResult?> ShowAsync<TResult>(string title, Action<DialogSession<TResult>> build, Func<TResult?>? dismissed = null)Shows a dialog a caller fills in.
public void Pump()Opens whatever is waiting, and completes whatever has been answered.
public void CancelAll()Answers the dialog on screen and everything queued behind it, and refuses more.
Used by (9)
- AssetPickerVixen.Editor.App
- AssetPickerTestsVixen.Editor.App.Tests
- ClosingTestsVixen.Editor.App.Tests
- DialogTestsVixen.Editor.Ui.Tests
- EditorApplicationVixen.Editor.App
- EditorSessionVixen.Editor.Testing
- EditorShellVixen.Editor.Ui
- ProjectBrowserTestsVixen.Editor.App.Tests
- ScenarioTestsVixen.Editor.App.Tests