Ejemplo n.º 1
0
        protected override string ShowPrompt(string message, string defaultValue)
        {
            string result;
            Form   owner;

            owner = _logControl.FindForm();

            if (owner.InvokeRequired)
            {
                Func <string, string, string> caller;
                IAsyncResult asyncResult;

                caller = this.ShowPromptDialog;

                asyncResult = owner.BeginInvoke(caller, message, defaultValue);
                asyncResult.AsyncWaitHandle.WaitOne();

                result = (string)owner.EndInvoke(asyncResult);

                asyncResult.AsyncWaitHandle.Close();
            }
            else
            {
                result = InputDialog.ShowInputDialog(owner, message, Application.ProductName, defaultValue);
            }

            return(result);
        }
Ejemplo n.º 2
0
 private static void AppendControlText(TextBoxBase box, string message)
 {
     if (box.InvokeRequired)
     {
         //Not on the UI thread so post the request
         AppendControlTextDelegate del = new AppendControlTextDelegate(AppendControlText);
         box.FindForm().BeginInvoke(del, new object[] { box, message });
     }
     else
     {
         box.AppendText(message);
     }
 }