CredentialInfoEventArgs Classe

Definizione

Fornisce i dati per un gestore eventi relativo all'acquisizione delle credenziali.

public ref class CredentialInfoEventArgs sealed : System::ComponentModel::CancelEventArgs
public sealed class CredentialInfoEventArgs : System.ComponentModel.CancelEventArgs
type CredentialInfoEventArgs = class
    inherit CancelEventArgs
Public NotInheritable Class CredentialInfoEventArgs
Inherits CancelEventArgs
Ereditarietà
CredentialInfoEventArgs

Esempio

Nell'esempio seguente viene autenticato il nome utente e la password.

void EditFeature(object sender, CredentialInfoEventArgs e) {
    try {
        e.Cancel = true;

        using (new rWait()) {
            string userName = String.Empty;
            if (!String.IsNullOrEmpty(e.Credentials.UserName)) {
                userName = e.Credentials.UserName;
            }

            string password = String.Empty;
            if (!String.IsNullOrEmpty(e.Credentials.Password)) {
                // If no username is set, but a password is, show an error
                if (String.IsNullOrEmpty(userName)) {
                    IManagementUIService uiService =
                        (IManagementUIService)GetService(typeof(IManagementUIService));
                    Debug.Assert(uiService != null, "Couldn't get IManagementUIService.");

                    uiService.ShowError(null, "Invalid User Name",
                       "Authentication Failed", false);

                    return;
                }

                password = e.Credentials.Password;
            }

            _serviceProxy.SetAnonAuthen(userName, password);

            e.Cancel = false;
            _userName = userName;
            _password = password;
        }
    } catch (Exception ex) {
        MessageBox.Show(ex.Message, "EditFeature");
    }
} 

Commenti

Usare questa classe per annullare gli eventi che richiedono un CredentialInfo oggetto.

Costruttori

CredentialInfoEventArgs(CredentialInfo)

Inizializza una nuova istanza della classe CredentialInfoEventArgs.

Proprietà

Credentials

Ottiene le informazioni sulle credenziali passate al CredentialInfoEventArgs(CredentialInfo) costruttore.

Si applica a