예제 #1
0
 /// ----------------------------------------------------------------------------------------
 /// <summary>
 /// Show SEB Password Dialog Form.
 /// </summary>
 /// ----------------------------------------------------------------------------------------
 public static string ShowPasswordDialogForm(string title, string passwordRequestText)
 {
     using (SebPasswordDialogForm sebPasswordDialogForm = new SebPasswordDialogForm())
     {
         SetForegroundWindow(sebPasswordDialogForm.Handle);
         sebPasswordDialogForm.TopMost = true;
         // Set the title of the dialog window
         sebPasswordDialogForm.Text = title;
         // Set the text of the dialog
         sebPasswordDialogForm.LabelText = passwordRequestText;
         sebPasswordDialogForm.txtSEBPassword.Focus();
         // If we are running in SebWindowsClient we need to activate it before showing the password dialog
         // Don't do this; it will fail when the password dialog is running in a separate thread
         //if (SEBClientInfo.SebWindowsClientForm != null) SEBClientInfo.SebWindowsClientForm.Activate();
         // Show password dialog as a modal dialog and determine if DialogResult = OK.
         if (sebPasswordDialogForm.ShowDialog() == DialogResult.OK)
         {
             // Read the contents of testDialog's TextBox.
             string password = sebPasswordDialogForm.txtSEBPassword.Text;
             sebPasswordDialogForm.txtSEBPassword.Text = "";
             //sebPasswordDialogForm.txtSEBPassword.Focus();
             return(password);
         }
         else
         {
             return(null);
         }
     }
 }
 /// ----------------------------------------------------------------------------------------
 /// <summary>
 /// Show SEB Password Dialog Form.
 /// </summary>
 /// ----------------------------------------------------------------------------------------
 public static string ShowPasswordDialogForm(string title, string passwordRequestText)
 {
     using (SebPasswordDialogForm sebPasswordDialogForm = new SebPasswordDialogForm())
     {
         SetForegroundWindow(sebPasswordDialogForm.Handle);
         sebPasswordDialogForm.TopMost = true;
         // Set the title of the dialog window
         sebPasswordDialogForm.Text = title;
         // Set the text of the dialog
         sebPasswordDialogForm.LabelText = passwordRequestText;
         sebPasswordDialogForm.txtSEBPassword.Focus();
         // If we are running in SebWindowsClient we need to activate it before showing the password dialog
         // Don't do this; it will fail when the password dialog is running in a separate thread
         //if (SEBClientInfo.SebWindowsClientForm != null) SEBClientInfo.SebWindowsClientForm.Activate();
         // Show password dialog as a modal dialog and determine if DialogResult = OK.
         if (sebPasswordDialogForm.ShowDialog() == DialogResult.OK)
         {
             // Read the contents of testDialog's TextBox.
             string password = sebPasswordDialogForm.txtSEBPassword.Text;
             sebPasswordDialogForm.txtSEBPassword.Text = "";
             //sebPasswordDialogForm.txtSEBPassword.Focus();
             return password;
         }
         else
         {
             return null;
         }
     }
 }
 public static string ShowPasswordDialogForm(string title, string passwordRequestText)
 {
     using (SebPasswordDialogForm passwordDialogForm = new SebPasswordDialogForm())
     {
         SebPasswordDialogForm.SetForegroundWindow(passwordDialogForm.Handle);
         passwordDialogForm.TopMost   = true;
         passwordDialogForm.Text      = title;
         passwordDialogForm.LabelText = passwordRequestText;
         passwordDialogForm.txtSEBPassword.Focus();
         if (passwordDialogForm.ShowDialog() != DialogResult.OK)
         {
             return((string)null);
         }
         string text = passwordDialogForm.txtSEBPassword.Text;
         passwordDialogForm.txtSEBPassword.Text = "";
         return(text);
     }
 }