Esempio n. 1
0
 /// <summary>
 ///Prints a list of the items in collection of T and asks user to choose one of the items.
 ///Returns the T chosen.
 /// </summary>
 /// <param name="items">Collection of T. </param>
 /// <param name="items">Collection of T. </param>
 /// <param name="keyFactory">How to get the key</param>
 /// <param name="lowestNr">Lowest accepted number</param>
 /// <param name="highestNumber">Highest accepted number</param>
 /// <param name="errorMessage">Displayed if input does not parse to in</param>
 /// <param name="clearScreen">Should screen be cleared before asking for input? Default is true.</param>
 /// <returns>The chosen item of type T</returns>
 public static T ChooseFromList <T>(IEnumerable <T> items, Func <T, string> keyFactory, ViewStyle style = null)
 => Choose.ChooseFromList(items, keyFactory, style);
Esempio n. 2
0
 /// <summary>
 /// Prints a list and asks user to choose one of the items. If input doesnt parse to int the user will be asked again.
 /// This overload clears screen before printing.
 /// </summary>
 /// <param name="message">Message displayed on screen when asking for input</param>
 /// <param name="errorMessage">Displayed if input does not parse to in</param>
 /// <param name="clearScreen">Should screen be cleared before asking for input?</param>
 /// <returns>the parsed input as int</returns>
 public static int ChooseFromList(params string[] menuItems)
 {
     return(Choose.ChooseFromList(null, menuItems));
 }