You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
41 lines
1.0 KiB
using ConsoleApp.Menu.Core;
|
|
using Model;
|
|
using Model.Managers;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ConsoleApp.Menu
|
|
{
|
|
internal class ImportRecipeMenu : Entry
|
|
{
|
|
MasterManager masterMgr;
|
|
|
|
public ImportRecipeMenu(MasterManager masterManager)
|
|
: base("Import recipe",
|
|
new Entry.EntryStep("Path file: ", typeof(string)))
|
|
{
|
|
masterMgr = masterManager;
|
|
}
|
|
|
|
public override IMenu? Return()
|
|
{
|
|
string path = _selectList[0].Item.Input;
|
|
try
|
|
{
|
|
masterMgr.DataMgr.Import<Recipe>(path);
|
|
}
|
|
catch(ArgumentNullException e)
|
|
{
|
|
Console.ForegroundColor = ConsoleColor.Red;
|
|
Console.WriteLine("error: " + e.Message);
|
|
Console.ResetColor();
|
|
return this;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
}
|