Vixen
dd8b0a81
csharp
public sealed class CloseRequestEvent

An application being asked to close, which anything on the route may refuse.

Read the guide page for this →

Remarks

Routed from the focus outwards, like a key. That is what lets the document object behind the focused view answer — it is the thing that knows whether there is unsaved work — without the head knowing that any such object exists.

⚠ Refusing is Cancel, which is not Handled. They are two questions and a handler needs both: a document that saved silently has dealt with the request and is content to go, and a handler that marked such a request handled while allowing it would be indistinguishable from one that had refused.

⚠ Refusing does not mean "never" — it means "not now". A Save / Don't Save / Cancel prompt is a dialog, and a dialog is answered frames later; a synchronous veto could not wait for one without blocking the loop that draws it. So a handler that needs to ask cancels the request, opens the prompt, and calls the application's own Quit when it has an answer. This is the shape the editor's host has used since save-on-close was built — EditorHost calls RequestClose() and reads IsClosing on the next frame — and the framework host is the copy that had no way to do it at all.

Fields and properties (2)

  • public UiCloseReason Reason

    What prompted it.

  • public bool IsCancelled

    Whether something refused.

Methods (1)

  • public void Cancel()

    Refuses the request, for now.

Used by (6)

  • DocumentClosePromptVixen.Ui.Controls
  • DocumentClosePromptTestsVixen.Ui.Controls.Tests
  • QuitRequestTestsVixen.Ui.Desktop.Tests
  • RemovalVixen.Ui.Controls
  • UiDocumentVixen.Ui
  • UiElementVixen.Ui