public void ShowMenuWithResult() { ShowMenu(); string input; while (!string.Equals(input = Console.ReadLine().ToLower(), "b")) { if (Parent == null && string.Equals(input, "q")) { //退出程序 break; } int index = -1; if (int.TryParse(input, out index)) { HelperBase son = SonList[index]; if (son != null) { son.Execute(); } } ShowMenu(); } }
protected void SetParent(HelperBase parent) { Parent = parent; Index = parent.SonList.Count(); }
public HelperBase(HelperBase parent, string description = "") { Description = description; SetParent(parent); }
public NavigatorItem(HelperBase parent, string description = "未添加功能描述", string doorPlate = "") : base(parent, description) { DoorPlate = doorPlate; }
public FunctionItem(HelperBase parent, Action action, string description = "未添加功能描述") : base(parent, description) { MyAction = action; IsExecutable = true; }