Пример #1
0
        public static string ShowForm(string caption, string text, string value = null)
        {
            var form = new PromptForm
            {
                Text = caption,
            };

            form.lblText.Text  = text;
            form.tbValue.Text  = value;
            form.StartPosition = FormStartPosition.CenterParent;
            return(form.ShowDialog() == DialogResult.OK ? form.tbValue.Text : null);
        }
Пример #2
0
 private bool GetUserName()
 {
     while (true)
     {
         userName = PromptForm.ShowForm("ChatSignalR", "Enter user name:", $"TestUser{new Random().Next(1, 99999)}");
         if (userName == null)
         {
             return(false);
         }
         else if (userName != string.Empty)
         {
             tbUserName.Text = userName;
             tbMessage.Focus();
             return(true);
         }
     }
 }