示例#1
0
        public static string EnterValue(string promptLabel, string defaultValue, EnterValueOption valueOption)
        {
            string result = defaultValue;

            PromptHelper.ShowPromptHighlight(promptLabel);
            string valueEntered = EnterString();

            if (!string.IsNullOrEmpty(valueEntered))
            {
                result = valueEntered.Trim();
            }

            switch (valueOption)
            {
            case EnterValueOption.UpperCase:
                if (!string.IsNullOrEmpty(result))
                {
                    result = result.ToUpper();
                }
                break;

            case EnterValueOption.None:
            default:
                break;
            }
            return(result);
        }
示例#2
0
        public static bool EnterBooleanValue(string promptLabel, bool defaultValue)
        {
            bool result = defaultValue;

            PromptHelper.ShowPromptInfo(promptLabel);
            string valueEntered = EnterString();

            if (!string.IsNullOrEmpty(valueEntered))
            {
                if (valueEntered.Trim().Equals("Yes", StringComparison.InvariantCultureIgnoreCase))
                {
                    result = true;
                }
                if (valueEntered.Trim().Equals("True", StringComparison.InvariantCultureIgnoreCase))
                {
                    result = true;
                }
            }
            return(result);
        }