/// <summary> /// event triggered when the user tries to view contacts in a contact list /// </summary> /// <param name="sender">the contact list control</param> /// <param name="e">e</param> private void ContactListControlDoShowContactsInList(object sender, EventArgs e) { if (_contactListControl == null) return; _contactListControl.DoShowContactsInList -= ContactListControlDoShowContactsInList; _contactListControl.Parent = null; _contactListControl = null; //show the contact API calls control _contactControl = new ContactControl(this, _credentialsDetails) {Dock = DockStyle.Fill, Parent = splitContainer.Panel1}; _contactControl.DoBack += (ContactControlDoBack); }
/// <summary> /// Reset all the data and give the user the opportunity to start over the guide /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> private void RestartToolStripMenuItemClick(object sender, EventArgs e) { splitContainer.Visible = false; restartToolStripMenuItem.Enabled = false; getStartedToolStripMenuItem.Enabled = true; richTextBoxRequest.Text = string.Empty; richTextBoxResponse.Text = string.Empty; //clean up the loging control if (_login != null) { _login.DoLogin -= LoginDoLogin; _login.Parent = null; _login = null; } //clean up the contact list control if (_contactListControl != null) { _contactListControl.DoShowContactsInList -= ContactListControlDoShowContactsInList; _contactListControl.Parent = null; _contactListControl = null; } //clean up the contact list control if (_contactControl != null) { _contactControl.DoBack -= ContactControlDoBack; _contactControl.Parent = null; _contactControl = null; } }
/// <summary> /// event triggered when the user wants to go back to the list API calls /// </summary> /// <param name="sender">the contact control</param> /// <param name="e">e</param> private void ContactControlDoBack(object sender, EventArgs e) { if (_contactControl == null) return; _contactControl.DoBack -= ContactControlDoBack; _contactControl.Parent = null; _contactControl = null; //show the contact list control _contactListControl = new ContactListControl { Dock = DockStyle.Fill, Parent = splitContainer.Panel1, FrmMain = this, CredentialsDetails = _credentialsDetails }; _contactListControl.DoShowContactsInList += (ContactListControlDoShowContactsInList); }
/// <summary> /// event triggered when the user tries to login /// </summary> /// <param name="sender">the authentication control</param> /// <param name="e">e</param> 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; }