Class
NavigationHistory<T>
ConsoleMonster.Interactive
Back and forward through places a reader went, as a browser keeps them: NavigationHistory<T>.Visit before leaving for a new place, NavigationHistory<T>.TryBack and NavigationHistory<T>.TryForward to return. A place is whatever the caller needs to restore: a screen and scroll position, a document and section, a selected row.
Inheritance
- object
- NavigationHistory<T>
Type Parameters
- T
- A place.
Constructors
public NavigationHistory<T>(int capacity = 100) #Creates an empty history.
Parameters
- capacity int = 100
- The most places kept going back; the oldest are dropped first.
Methods
public bool TryBack(T? current, out T? place) #Goes back, remembering the current place for going forward.
Parameters
- current T?
- Where the reader is now.
- place T?
- The place to return to.
Returns
bool Whether there was a place to go back to.public bool TryForward(T? current, out T? place) #Goes forward again, remembering the current place for going back.
Parameters
- current T?
- Where the reader is now.
- place T?
- The place to return to.
Returns
bool Whether there was a place to go forward to.public void Visit(T? leaving) #Records the place being left for a new one; going forward is no longer possible.
Parameters
- leaving T?
- Where the reader is now.
Inherited Methods
Properties
public bool CanGoForward { get; } #Whether there is a place to go forward to.