Esempio n. 1
0
        /// <summary>
        /// Pops up dialog asking users which type of credential they expect to provide. The behavior aligns with job submission.
        /// </summary>
        internal static CredType PromptForCredentialType(bool console, IntPtr hwndParent, CredType originalType)
        {
            string[] dialogTexts = new string[]
            {
                SR.CredentialTypeDialog_LabelString,
                SR.CredentialTypeDialog_PwdCheckBoxString,
                SR.CredentialTypeDialog_CertCheckBoxString,
                SR.CredentialTypeDialog_OkButtonString,
                SR.CredentialTypeDialog_CancelButtonString
            };

            int choice = CredentialType.NoChoice;

            CredentialType.PromptForCredentialType(console, hwndParent, ref choice, dialogTexts);

            if (choice == CredentialType.CertChoice)
            {
                return(CredType.Certificate);
            }
            else
            {
                Debug.Assert(originalType == CredType.Either || originalType == CredType.Either_CredUnreusable);
                if (originalType == CredType.Either)
                {
                    return(CredType.Password);
                }
                else
                {
                    return(CredType.Password_CredUnreusable);
                }
            }
        }