|
|
|
@ -8,43 +8,45 @@ using Model;
|
|
|
|
|
|
|
|
|
|
namespace ConsoleApp
|
|
|
|
|
{
|
|
|
|
|
internal class ResearchMenuRecipe
|
|
|
|
|
internal class SearcherRecipe
|
|
|
|
|
{
|
|
|
|
|
internal string displayText = "";
|
|
|
|
|
public int CurrentLine
|
|
|
|
|
{
|
|
|
|
|
get => currentLine;
|
|
|
|
|
get => _currentLine;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
currentLine = value;
|
|
|
|
|
if (currentLine > maxLines)
|
|
|
|
|
_currentLine = value;
|
|
|
|
|
if (_currentLine > _maxLines)
|
|
|
|
|
{
|
|
|
|
|
currentLine = maxLines;
|
|
|
|
|
_currentLine = _maxLines;
|
|
|
|
|
}
|
|
|
|
|
if (currentLine < 0)
|
|
|
|
|
if (_currentLine < 0)
|
|
|
|
|
{
|
|
|
|
|
currentLine = 0;
|
|
|
|
|
_currentLine = 0;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private int currentLine = 0;
|
|
|
|
|
private int maxLines = 0;
|
|
|
|
|
private Recipe? currentSelected;
|
|
|
|
|
|
|
|
|
|
public void UpdateDisplay(string researchStr, Recipe[] researchResult)
|
|
|
|
|
public Recipe? CurrentSelected { get; private set; }
|
|
|
|
|
|
|
|
|
|
private int _currentLine = 0;
|
|
|
|
|
private int _maxLines = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdateDisplay(string researchStr, RecipeCollection researchResult)
|
|
|
|
|
{
|
|
|
|
|
maxLines = researchResult.Length - 1;
|
|
|
|
|
_maxLines = researchResult.Count - 1;
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
sb.AppendLine("---------------------------------------------------------");
|
|
|
|
|
sb.AppendLine($" Research: {researchStr}");
|
|
|
|
|
sb.AppendLine("---------------------------------------------------------");
|
|
|
|
|
for (int i = 0; i < researchResult.Length; i++)
|
|
|
|
|
for (int i = 0; i < researchResult.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i == CurrentLine)
|
|
|
|
|
{
|
|
|
|
|
currentSelected = researchResult[i];
|
|
|
|
|
CurrentSelected = researchResult[i];
|
|
|
|
|
sb.Append($">");
|
|
|
|
|
}
|
|
|
|
|
sb.AppendLine($" [ {researchResult[i].Id} ]: {researchResult[i].Title} ");
|
|
|
|
@ -62,10 +64,5 @@ namespace ConsoleApp
|
|
|
|
|
{
|
|
|
|
|
return --CurrentLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Recipe? ReturnSelected()
|
|
|
|
|
{
|
|
|
|
|
return currentSelected;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|