Example #1
0
        /// <summary>
        /// 询问一个输入字符串
        /// </summary>
        /// <param name="prompt">提示信息</param>
        /// <returns>询问到的字符串</returns>
        public static string QueryInputStr(string prompt)
        {
            QueryInputDialog dlg = new QueryInputDialog();

            dlg.Text           = prompt;
            dlg.lblPrompt.Text = prompt.EndsWith(":") || prompt.EndsWith(":") ? prompt : prompt + ":";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                return(dlg.tbValue.Text);
            }
            return("");
        }
Example #2
0
        /// <summary>
        /// 询问一个输入字符串
        /// </summary>
        /// <param name="prompt">提示信息</param>
        /// <param name="initValue">初始值</param>
        /// <param name="isPassword">是否密码字符串</param>
        /// <returns>询问到的字符串</returns>
        public static string QueryInputStr(string prompt, string initValue = "", bool isPassword = false)
        {
            prompt = JsonLanguage.Default.GetString(prompt);

            QueryInputDialog dlg = new QueryInputDialog();

            dlg.Text           = prompt;
            dlg.lblPrompt.Text = prompt.EndsWith(":") || prompt.EndsWith(":") ? prompt : prompt + ":";
            dlg.txtInput.Text  = initValue;
            dlg.IsEncryptInput = isPassword;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                return(dlg.txtInput.Text);
            }
            return(initValue);
        }