Ejemplo n.º 1
0
 internal DialogResult ShowPromptDialog(FrmPromptDialog promptDialog)
 {
     if (this.InvokeRequired)
     {
         if (!this.IsHandleCreated || this.Disposing || this.IsDisposed)
         {
             return(DialogResult.None);
         }
         return((DialogResult)this.Invoke(dlgShowPromptDialog, promptDialog));
     }
     return(promptDialog.ShowDialog());
 }
Ejemplo n.º 2
0
        internal FrmPromptDialog GetPromptDialog()
        {
            if (this.InvokeRequired)
            {
                if (!this.IsHandleCreated || this.Disposing || this.IsDisposed)
                {
                    return(null);
                }
                return((FrmPromptDialog)this.Invoke(dlgGetPromptDialog));
            }
            FrmPromptDialog promptDialog = new FrmPromptDialog();

            promptDialog.Owner         = this;
            promptDialog.StartPosition = FormStartPosition.CenterParent;
            return(promptDialog);
        }
Ejemplo n.º 3
0
        private void PromptTask(object oArgs)
        {
            ConnectionManager cnnMan;
            Command           command;
            Thread            thisThread;
            FrmPromptDialog   promptDialog = null;
            Response          response;
            PromptTaskParam   args;
            DialogResult      dialogResult;

            args = oArgs as PromptTaskParam;
            if (args == null)
            {
                return;
            }

            thisThread = args.Thread;
            cnnMan     = args.ConnectionManager;
            command    = args.Command;

            try
            {
                promptDialog         = ownerForm.GetPromptDialog();
                promptDialog.Command = command;
                promptDialog.AddAutoComplete(usedParamList.ToArray());
                dialogResult = ownerForm.ShowPromptDialog(promptDialog);
                if ((dialogResult != DialogResult.OK) || (promptDialog.Response == null))
                {
                    lock (threadList)
                    {
                        if (threadList.Contains(thisThread))
                        {
                            threadList.Remove(thisThread);
                        }
                    }
                    return;
                }
                response = promptDialog.Response;
                if (cnnMan.Send(response) && (ResponseSent != null))
                {
                    try
                    {
                        ResponseSent(command, response);
                    }
                    catch { }
                }
                lock (usedParamList)
                {
                    if (!usedParamList.Contains(response.Parameters))
                    {
                        usedParamList.Add(response.Parameters);
                    }
                }
                lock (threadList)
                {
                    if (threadList.Contains(thisThread))
                    {
                        threadList.Remove(thisThread);
                    }
                }
            }
            catch
            {
                if ((promptDialog != null) && !promptDialog.Disposing && !promptDialog.IsDisposed)
                {
                    promptDialog.Close();
                    if (!promptDialog.Disposing && !promptDialog.IsDisposed)
                    {
                        promptDialog.Dispose();
                    }
                }
                lock (threadList)
                {
                    if (threadList.Contains(thisThread))
                    {
                        threadList.Remove(thisThread);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 internal FrmPromptDialog GetPromptDialog()
 {
     if (this.InvokeRequired)
     {
         if (!this.IsHandleCreated || this.Disposing || this.IsDisposed)
             return null;
         return (FrmPromptDialog)this.Invoke(dlgGetPromptDialog);
     }
     FrmPromptDialog promptDialog = new FrmPromptDialog();
     promptDialog.Owner = this;
     promptDialog.StartPosition = FormStartPosition.CenterParent;
     return promptDialog;
 }
Ejemplo n.º 5
0
 internal DialogResult ShowPromptDialog(FrmPromptDialog promptDialog)
 {
     if (this.InvokeRequired)
     {
         if (!this.IsHandleCreated || this.Disposing || this.IsDisposed)
             return DialogResult.None;
         return (DialogResult)this.Invoke(dlgShowPromptDialog, promptDialog);
     }
     return promptDialog.ShowDialog();
 }