protected void ShowMenu() { if (string.IsNullOrEmpty(DoorPlate)) { Console.WriteLine(GetDoorPlateBoard()); } Console.ForegroundColor = ConsoleColor.Yellow; if (SonList.Count() > 0) { Console.WriteLine("请选择功能:"); SonList.ForEach((c) => { Console.WriteLine(c.MenuStr); }); } else { Console.WriteLine("该节点无下属功能"); } if (Parent != null) { Console.WriteLine("输入b返回上级"); } else { Console.WriteLine("输入q退出程序"); } Console.WriteLine(); }
public HomeNavigator() : base() { SonList.Add(new FunctionItem(this, () => { }, "用户登录")); SonList.Add(new FunctionItem(this, () => { }, "注册账户")); }
public MainNavigator() : base() { SonList.Add(new FunctionItem(this, () => { string account; string password; bool isSuccess = GetInput("请输入用户名", out account, (input) => { if (string.IsNullOrEmpty(input)) { Console.WriteLine("用户名不可为空"); return(false); } return(true); }) && GetInput("请输入密码", out password, (input) => { if (string.IsNullOrEmpty(input)) { Console.WriteLine("密码不可为空"); return(false); } return(true); }) && CommonService.CreateAccount(new TAccount() { AccountName = account, Password = password }).IsSuccess; if (!isSuccess) { return; } //new HomeNavigator() }, "用户登录")); SonList.Add(new FunctionItem(this, () => { }, "注册账户")); }