示例#1
0
            private async void btnLogon_Click(object sender, EventArgs e)
            {
                try
                {
                    IAuthenticationManager           authenticationManager = ManagerFactory.GetManager <IAuthenticationManager>();
                    CommerceAuthenticationParameters commerceParameters    = new CommerceAuthenticationParameters(MainForm.CommerceAuthenticationParametersGrantType, MainForm.CommerceAuthenticationParametersClientId);
                    this.UserIdToken = await authenticationManager.AcquireToken(this.textBoxUserName.Text, this.textBoxPassword.Text, commerceParameters);

                    this.mainForm.Log("Logon succeeded.");
                }
                catch (Exception ex)
                {
                    this.mainForm.Log(ex.ToString());
                }

                this.Close();
            }