CSharpTutor.FrmMain.LoginDoLogin C# (CSharp) Method

LoginDoLogin() private method

event triggered when the user tries to login
private LoginDoLogin ( object sender, EventArgs e ) : void
sender object the authentication control
e System.EventArgs e
return void
        private void LoginDoLogin(object sender, EventArgs e)
        {
            //do login action
            var user = ((Login) sender).UseName;
            var pass = ((Login) sender).Password;
            var key = ((Login) sender).Key;

            _credentialsDetails = new CredentialsDetails {Key = key, Password = pass, User = user};

            try
            {
                string strRequest;
                string strResponse;

                Cursor.Current = Cursors.WaitCursor;

                OperationsComponent.Authentification(_credentialsDetails, out strRequest, out strResponse);

                Cursor.Current = Cursors.Default;

                //print the request string
                richTextBoxRequest.Text = strRequest;

                //print the response string
                richTextBoxResponse.Text = strResponse;

                //clean up the loging control
                if (_login == null) return;
                _login.DoLogin -= LoginDoLogin;
                _login.Parent = null;
                _login = null;

                //show the contact list control
                _contactListControl = new ContactListControl
                                          {
                                              Dock = DockStyle.Fill,
                                              Parent = splitContainer.Panel1,
                                              FrmMain = this,
                                              CredentialsDetails = _credentialsDetails
                                          };
                _contactListControl.DoShowContactsInList += (ContactListControlDoShowContactsInList);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Resources.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            Cursor.Current = Cursors.Default;
        }