Exemplo n.º 1
0
 /// <summary>
 /// Cancel and clear the current KMOD query, if there is one.
 /// </summary>
 private void ClearKmodQuery()
 {
     if (m_loginQuery != null)
     {
         m_loginQuery.Cancel();
         m_loginQuery = null;
     }
 }
Exemplo n.º 2
0
        private void ConfigKPPCredentials_WizardNext(object sender, WizardPageEventArgs e)
        {
            // Clear the current query if there is one.
            ClearKmodQuery();

            if (rbHaveAccount.Checked)
            {
                if (LoginSuccess)
                {
                    e.NewPage = "ConfigKPPSuccess";
                }
                else
                {
                    this.Enabled = false;
                    e.Cancel = true;

                    // Submit the login query.
                    K3p.K3pLoginTest cmd = creds.GetLoginCommand();
                    m_loginQuery = new KmodQuery();
                    m_loginQuery.Submit(m_broker, new K3pCmd[] { cmd }, OnLoginResult);
                }
            }

            else
            {
                e.NewPage = "ConfigKPPCreateAccount";
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Called when the login query results are available.
        /// </summary>
        private void OnLoginResult(KmodQuery query)
        {
            K3p.kmo_server_info_ack ack = query.OutMsg as K3p.kmo_server_info_ack;
            K3p.kmo_server_info_nack nack = query.OutMsg as K3p.kmo_server_info_nack;

            if (ack != null)
            {
                LoginSuccess = true;
                creds.Token = ack.Token;
            }

            else if (nack != null)
            {
                if (nack.Error.StartsWith("cannot resolve ")) creds.SetServerError(nack.Error);
                else creds.SetCredError(nack.Error);
            }

            else
            {
                creds.SetServerError(query.OutDesc);
            }

            this.Enabled = true;

            // Clear the current query.
            ClearKmodQuery();

            // Pass to the next page.
            if (LoginSuccess) this.PressButton(WizardButtons.Next);
        }