/// <summary>
        /// This example creates instances for each input value and sets different label colors.
        /// Each instance reads a different type of value (string, int, DateTime, float)
        /// </summary>
        private static void RunExample()
        {
            // Create the input controls
            ValueControl <int> ageControl = new ValueControl <int>("Age:");

            ageControl.Label.ForegroundColor = ConsoleColor.DarkGreen;

            // Read values using the input controls
            int age = ageControl.Read();

            // Display th read values.
            CustomConsole.WriteLine();
            CustomConsole.WriteLine("You are {0} years old.", age);
        }
        private static void RunExample()
        {
            ValueControl <int> numberControl = new ValueControl <int>("Number ({0}):");

            numberControl.AcceptDefaultValue = true;
            numberControl.DefaultValue       = 42;

            CustomConsole.WriteLine("Just hit enter. The default value, 42, is returned by the ValueControl control.");
            CustomConsole.WriteLine();

            int number = numberControl.Read();

            CustomConsole.WriteLine();
            CustomConsole.WriteLine("You selected {0}.", number);
        }
        /// <summary>
        /// This example creates instances for each input value and sets different label colors.
        /// Each instance reads a different type of value (string, int, DateTime, float)
        /// </summary>
        private static void RunExample()
        {
            // Create the input controls

            ValueControl <string> firstNameControl = new ValueControl <string>("First Name:");

            firstNameControl.Label.ForegroundColor = ConsoleColor.Cyan;

            ValueControl <string> lastNameControl = new ValueControl <string>("Last Name:");

            lastNameControl.Label.ForegroundColor = ConsoleColor.Cyan;

            // Read values using the input controls
            string firstName = firstNameControl.Read();
            string lastName  = lastNameControl.Read();

            // Display the read values.
            CustomConsole.WriteLine();
            CustomConsole.WriteLine("Hi, {0} {1}!", firstName, lastName);
        }
示例#4
0
        private void ChangePrompter()
        {
            ValueControl <string> valueControl = new ValueControl <string>("New Prompter Text:");

            prompter.Text = valueControl.Read();
        }