Vixen
02b45cc4
csharp
public sealed class ConsoleView

The panel that is looked at most often when something has gone wrong.

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

Remarks

Doc 20 calls the Console "the least built thing in the shell" and the largest single item in its Part A, and both were true: it was a TextBlock saying "Nothing logged yet." What replaces it is doc 20's A7 in full — a virtualised list over the ring the diagnostics layer already keeps, level toggles carrying counts, a category filter, a search box, collapse-duplicates, clear, clear-on-play, and a detail pane showing the whole record and its stack.

⚠ It does not allocate per line. Doc 20 is blunt about why — "a game logging per frame into a panel that keeps strings is a leak with a UI" — and there are two halves to it. ConsoleModel pulls only what is new out of the ring and keeps indices rather than text; VirtualizingPanel keeps about thirty row elements whatever the list holds. A hundred thousand lines is a hundred thousand records the sink had already allocated, and thirty elements.

⚠ Rows are rebuilt from the model on Tick, not from an event. The sink is written from every thread the editor runs work on — a content import logs from the pool — so a subscription would rebuild the panel from a background thread. One pull per frame on the thread that owns the document is the same bargain ContentTasks makes.

⚠ Selecting a row is not the same as it staying selected. The list scrolls as records arrive, and the detail pane is holding a record rather than a row index — so a line selected and then pushed off the top by a burst still has its stack on screen.

Fields and properties (10)

  • 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 ConsoleModel? Model

    What it is showing.

  • public UiElement Toolbar

    The strip along the top.

  • public VirtualizingPanel List

    The list itself.

  • public UiElement Detail

    The pane under it showing the whole of the selected record.

  • public SearchBox Search

    The search box.

  • public Select Categories

    The category picker.

  • public bool ClearsOnPlay

    Whether the console throws itself away when play mode is entered.

  • public LogRecord? Selected

    Which record the detail pane is showing, or .

Events (1)

  • public Action<ConsoleView, LogRecord>? Activated

    Raised when a row is activated, for a host that can open a source file.

Methods (5)

  • public void Show(ConsoleModel model)

    Points the console at a sink's records.

  • public void Tick(TimeSpan now = default(TimeSpan))

    Takes whatever has been logged and brings the rows up to date.

  • 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 void Clear()

    Empties the console, which empties the ring behind it.

Used by (4)

  • ChromeFixtureVixen.Editor.Ui.Tests
  • ConsolePanelTestsVixen.Editor.App.Tests
  • ConsoleViewTestsVixen.Editor.Ui.Tests
  • EditorApplicationVixen.Editor.App