Vixen
02b45cc4
csharp
public sealed class ToastHost

The corner of the screen toasts stack up in.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A host rather than a static queue, because a document may have more than one — an editor with two windows has two corners, and a global list would put both windows' messages in whichever one happened to be created first.

⚠ Newest at the top, and it is the opposite of what a naive append gives. A toast added to the end of a bottom-anchored stack pushes the older ones up, which moves a message somebody is halfway through reading. Adding at the front leaves them where they are — which is why this moves each new toast to index zero rather than letting it land at the end.

Fields and properties (3)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public IReadOnlyList<Toast> Live

    The toasts currently showing, newest first.

Methods (5)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • protected override void OnRemoved()

    Called once, as the element leaves the document.

  • public Toast Show(string? message, ControlVariant variant = Default, TimeSpan duration = default(TimeSpan))

    Shows a message.

  • public bool Dismiss(Toast toast)

    Takes one away.

  • public void Tick(TimeSpan now)

    Tells the host what time it is, so that expired toasts go away.

Used by (10)

  • ShellHelloUi
  • ControlVisualTestsVixen.Ui.Controls.Tests
  • OverlayInteractionTestsVixen.Ui.Controls.Tests
  • OverlayLifetimeTestsVixen.Ui.Controls.Tests
  • SurfaceTestsVixen.Ui.Controls.Tests
  • EditorSessionVixen.Editor.Testing
  • EditorShellVixen.Editor.Ui
  • EditorShellTestsVixen.Editor.Ui.Tests
  • NotificationCenterVixen.Editor.Ui
  • ServiceTestsVixen.Editor.Ui.Tests