public static int WaitRows(string startingText, Func <int> updateOrDelete) { SafeConsole.WriteColor(ConsoleColor.Gray, startingText); int result = 0; WaitExecute(() => { result = updateOrDelete(); lock (SafeConsole.SyncKey) { SafeConsole.WriteColor(ConsoleColor.White, " {0} ", result); SafeConsole.WriteLineColor(ConsoleColor.DarkGray, "rows afected"); } }); return(result); }
public WithDescription <V>?ChooseTuple(int?numberOfOptions = null) { Console.WriteLine(welcomeMessage); var noOfOptsPerScreen = numberOfOptions ?? dictionary.Count; PrintOptions(0, noOfOptsPerScreen); var noOfOptsPrinted = noOfOptsPerScreen; do { var input = Console.ReadLine().Trim(); if (input == "+") { if (noOfOptsPrinted >= dictionary.Count) { continue; } PrintOptions(noOfOptsPrinted, noOfOptsPerScreen); } else { if (string.IsNullOrWhiteSpace(input)) { return(null); } var val = TryGetValue(input); if (val != null) { return(val); } SafeConsole.WriteLineColor(ConsoleColor.Red, "Plase choose a valid option!"); noOfOptsPrinted = 0; PrintOptions(noOfOptsPrinted, noOfOptsPerScreen); } noOfOptsPrinted += noOfOptsPerScreen; } while (true); }