Exemple #1
0
 /// <summary>
 /// 弹出模态窗口,获取返回值
 /// </summary>
 /// <returns></returns>
 public static bool GetPrompt(out string msg, string title = null,
                              string defaultVal            = null, IWin32Window window = null)
 {
     try
     {
         using (var win = new PromptWin(title))
         {
             if (!string.IsNullOrEmpty(defaultVal))
             {
                 win.textBox1.Text = defaultVal;
             }
             DialogResult ret = win.ShowDialog(window);
             if (ret == DialogResult.OK)
             {
                 msg = win.PromptText;
                 return(true);
             }
         }
         msg = null;
     }
     catch
     {
         msg = null;
     }
     return(false);
 }
Exemple #2
0
 /// <summary>
 /// 弹出模态窗口,获取返回值
 /// </summary>
 /// <param name="msg"></param>
 /// <param name="title"></param>
 /// <param name="window"></param>
 /// <returns></returns>
 public static bool GetPrompt(out string msg, string title = null, IWin32Window window = null)
 {
     var win = new PromptWin(title);
     DialogResult ret = win.ShowDialog(window);
     if(ret == DialogResult.OK)
     {
         msg = win.PromptText;
         return true;
     }
     msg = null;
     return false;
 }
        /// <summary>
        /// 弹出模态窗口,获取返回值
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="title"></param>
        /// <param name="window"></param>
        /// <returns></returns>
        public static bool GetPrompt(out string msg, string title = null, IWin32Window window = null)
        {
            var          win = new PromptWin(title);
            DialogResult ret = win.ShowDialog(window);

            if (ret == DialogResult.OK)
            {
                msg = win.PromptText;
                return(true);
            }
            msg = null;
            return(false);
        }