Exemplo n.º 1
0
        /// <summary>
        /// Logs into the specified project/domain combination
        /// </summary>
        /// <param name="sender">The sending object</param>
        /// <param name="e">The event arguments</param>
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            string domainName  = (string)this.cboDomain.SelectedValue;
            string projectName = (string)this.cboProject.SelectedValue;

            //Default the Next button to disabled
            this.btnNext.Enabled = false;

            try
            {
                TdConnection.Connect(domainName, projectName);
            }
            catch (Exception exception)
            {
                MessageBox.Show("Error Logging in to QualityCenter: " + exception.Message, "Authentication Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Check to see if connected and change the UI as appropriate
            if (TdConnection.Connected)
            {
                MessageBox.Show("You have connected to '" + projectName + "' Successfully", "Authentication", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.btnNext.Enabled = true;
            }
            else
            {
                MessageBox.Show("Unable to connect to '" + projectName + "'!", "Authentication", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Tries to reconnect QC if we get an error condition
        /// </summary>
        public void TryReconnect()
        {
            try
            {
                TdConnection.Disconnect();
            }
            catch (Exception)
            {
                //Fail quietly
            }
            string domainName  = (string)this.cboDomain.SelectedValue;
            string projectName = (string)this.cboProject.SelectedValue;

            TdConnection.InitConnectionEx(this.txtServer.Text);
            TdConnection.Login(this.txtLogin.Text, this.txtPassword.Text);
            TdConnection.Connect(domainName, projectName);
        }
Exemplo n.º 3
0
        /// <summary>
        ///Makes sure that we remain connected to QC during import
        /// </summary>
        public void EnsureConnected()
        {
            //If not connected, then try to reconnect
            if (!this.TdConnection.Connected)
            {
                string domainName  = (string)this.cboDomain.SelectedValue;
                string projectName = (string)this.cboProject.SelectedValue;
                TdConnection.InitConnectionEx(this.txtServer.Text);
                TdConnection.Login(this.txtLogin.Text, this.txtPassword.Text);
                TdConnection.Connect(domainName, projectName);
            }

            //Make sure project is connected
            if (!this.TdConnection.ProjectConnected)
            {
                string domainName  = (string)this.cboDomain.SelectedValue;
                string projectName = (string)this.cboProject.SelectedValue;
                TdConnection.Connect(domainName, projectName);
            }
        }