Class EditorCommandBar
The editor's top bar: mode, undo and redo, Save and Save all, an unsaved-changes badge and a status line.
public class EditorCommandBar : ContentControl, INotifyPropertyChanging, IBindingTarget, INotifyPropertyChanged, INotifyFocusChanged, IContainerLayout
- Inheritance
-
EditorCommandBar
- Implements
- Inherited Members
- Extension Methods
Remarks
Save writes the selected element's document, or the last edited one when nothing is selected. When that document can't be saved, the Save button is disabled and the status line says why (see SaveBlockedReason). A failed write shows its error in the status line instead of throwing, so the game keeps running.
While the selection's document can't take edits (see BlockedReason), the status line shows why, ahead of any save problem.
The bar listens to its session from the moment Session is set. Set it back to null when the bar is discarded.
Constructors
EditorCommandBar()
Initializes a new instance of the EditorCommandBar class.
public EditorCommandBar()
Properties
CanSave
Gets a value indicating whether Save() would write a file.
public bool CanSave { get; }
Property Value
HasUnsavedChanges
Gets a value indicating whether any tracked document has unsaved changes.
public bool HasUnsavedChanges { get; }
Property Value
Session
Gets or sets the session the bar works on, or null for a disabled bar.
public EditorSession? Session { get; set; }
Property Value
StatusText
Gets the status line's text: the last save's outcome, or why Save is disabled.
public string StatusText { get; }
Property Value
Methods
Save()
Saves the selected element's document, or the last edited one. Never throws for a failed write; the status line shows the outcome.
public void Save()
SaveAll()
Saves every modified document that can be saved, and reports the ones it skipped in the status line.
public void SaveAll()