QueryText() public static method

public static QueryText ( string prompt, string defaultValue ) : string
prompt string
defaultValue string
return string
Example #1
0
        // ----------------------------------------------------------------------
        public bool QueryCulture()
        {
            string cultureName = ConsoleTool.QueryText("Culture [enter=" + CultureInfo.CurrentCulture.Name + "]: ", CultureInfo.CurrentCulture.Name);

            if (cultureName == null)
            {
                return(false);
            }
            if (UpdateCulture(cultureName) == false)
            {
                return(false);
            }
            return(true);
        }         // QueryCulture
Example #2
0
        }         // Main

        // ----------------------------------------------------------------------
        private static bool QueryPeriodData(ref string periodType, TimePeriodDemoData demoData)
        {
            ConsoleTool.WriteSeparatorLine();
            do
            {
                string input = ConsoleTool.QueryText("Period type (y/by/hy/q/m/bm/w/bw/d/h/min) [enter=" + periodType + "]: ", periodType);
                if (string.IsNullOrEmpty(input))
                {
                    return(false);
                }

                switch (input)
                {
                case "Y":
                    Console.Clear();
                    goto case "y";

                case "y":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearBaseMonth());

                case "BY":
                    Console.Clear();
                    goto case "by";

                case "by":
                    periodType = input;
                    return
                        (demoData.QueryYear());

                case "HY":
                    Console.Clear();
                    goto case "hy";

                case "hy":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearBaseMonth() &&
                         demoData.QueryYearHalfyear());

                case "Q":
                    Console.Clear();
                    goto case "q";

                case "q":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearBaseMonth() &&
                         demoData.QueryYearQuarter());

                case "M":
                    Console.Clear();
                    goto case "m";

                case "m":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearMonth());

                case "BM":
                    Console.Clear();
                    goto case "bm";

                case "bm":
                    periodType = input;
                    return
                        (demoData.QueryYear() &&
                         demoData.QueryYearMonth());

                case "W":
                    Console.Clear();
                    goto case "w";

                case "w":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearWeekType() &&
                         demoData.QueryWeek());

                case "BW":
                    Console.Clear();
                    goto case "bw";

                case "bw":
                    periodType = input;
                    return
                        (demoData.QueryYear() &&
                         demoData.QueryWeek());

                case "D":
                    Console.Clear();
                    goto case "d";

                case "d":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearMonth() &&
                         demoData.QueryDay());

                case "H":
                    Console.Clear();
                    goto case "h";

                case "h":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearMonth() &&
                         demoData.QueryDay() &&
                         demoData.QueryHour());

                case "Min":
                    Console.Clear();
                    goto case "min";

                case "min":
                    periodType = input;
                    return
                        (demoData.QueryPeriodCount() &&
                         demoData.QueryYear() &&
                         demoData.QueryYearMonth() &
                         demoData.QueryDay() &&
                         demoData.QueryHour() &&
                         demoData.QueryMinute());
                }
            } while (true);
        }         // QueryPeriodData