|
|
@ -20,8 +20,12 @@ namespace ConsoleApp.Menu
|
|
|
|
|
|
|
|
|
|
|
|
private int _currentLine;
|
|
|
|
private int _currentLine;
|
|
|
|
public int CurrentLine {
|
|
|
|
public int CurrentLine {
|
|
|
|
get => _currentLine;
|
|
|
|
get
|
|
|
|
private set
|
|
|
|
{
|
|
|
|
|
|
|
|
if (_currentLine >= _selectList.Count) _currentLine = _selectList.Count - 1;
|
|
|
|
|
|
|
|
return _currentLine;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
protected set
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_currentLine = value;
|
|
|
|
_currentLine = value;
|
|
|
|
if (_currentLine <= 0) _currentLine = 0;
|
|
|
|
if (_currentLine <= 0) _currentLine = 0;
|
|
|
@ -53,9 +57,21 @@ namespace ConsoleApp.Menu
|
|
|
|
CurrentSelected = _selectList[0].Item;
|
|
|
|
CurrentSelected = _selectList[0].Item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public abstract void Update();
|
|
|
|
public abstract IMenu? Return();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected abstract List<Selector<T>> SearchInSelection();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Update()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_selectList = SearchInSelection();
|
|
|
|
|
|
|
|
|
|
|
|
public abstract void Return();
|
|
|
|
if (_selectList == null || _selectList.Count == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CurrentSelected = default;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CurrentSelected = _selectList[CurrentLine].Item;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual void Display()
|
|
|
|
public virtual void Display()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -84,12 +100,14 @@ namespace ConsoleApp.Menu
|
|
|
|
if (_selectList == null || _selectList.Count == 0)
|
|
|
|
if (_selectList == null || _selectList.Count == 0)
|
|
|
|
_screenDisplay.AppendLine("Empty...");
|
|
|
|
_screenDisplay.AppendLine("Empty...");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_screenDisplay.AppendLine(
|
|
|
|
|
|
|
|
"\n\nHint:\n^:previous, v:next, <:ret, -enter-:select, r:search mode, -escape-:exit search mode");
|
|
|
|
Console.WriteLine(_screenDisplay);
|
|
|
|
Console.WriteLine(_screenDisplay);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SelectNext() => CurrentSelected = _selectList[CurrentLine++].Item;
|
|
|
|
public void SelectNext() => ++CurrentLine;
|
|
|
|
|
|
|
|
|
|
|
|
public void SelectPrevious() => CurrentSelected = _selectList[CurrentLine--].Item;
|
|
|
|
public void SelectPrevious() => --CurrentLine;
|
|
|
|
|
|
|
|
|
|
|
|
public void EnableWriteMode() => WriteMode = true;
|
|
|
|
public void EnableWriteMode() => WriteMode = true;
|
|
|
|
|
|
|
|
|
|
|
|