Beispiel #1
0
 /// <summary>
 /// Constructs a Choice object with default configuration values
 /// </summary>
 /// <param name="console"><see cref="IConsole"/> used to output</param>
 /// <param name="text">Text to show as question</param>
 /// <param name="choices">List of possible choices. See remarks for choices rules</param>
 /// <remarks>
 /// Each char of <paramref name="choices"/> is a possible response.
 /// If the char is upper letter is considered as the default response.
 /// If <paramref name="choices"/> has more than one upper letter, only the latest is considered the default response
 /// <para>If no choices is specified, [Y/n] are the default</para>
 /// </remarks>
 public Choice(IConsole console, ColorToken text, string choices = null)
 {
     Options      = new ChoiceOptions();
     Options.Text = text ?? String.Empty;
     if (choices != null)
     {
         Options.SetChoices(choices);
     }
     Console = console ?? PowerConsole.Console.Instance;
 }
Beispiel #2
0
 /// <summary>
 /// Constructs a Choice object with default configuration values
 /// </summary>
 /// <param name="options"><see cref="ChoiceOptions"/> with the configuration to be used</param>
 public Choice(ChoiceOptions options) : this(null, options)
 {
 }
Beispiel #3
0
 /// <summary>
 /// Constructs a Choice object with default configuration values
 /// </summary>
 /// <param name="console"><see cref="IConsole"/> used to output</param>
 /// <param name="options"><see cref="ChoiceOptions"/> with the configuration to be used</param>
 public Choice(IConsole console, ChoiceOptions options)
 {
     Console = console ?? PowerConsole.Console.Instance;
     Options = options ?? throw new ArgumentException(nameof(options));
 }