// Public methods.
 /// <summary>
 /// Opens the modal dialog to select a PlanetLab person.
 /// </summary>
 /// <param name="owner">The window owner.</param>
 /// <param name="username">The username of the selected account.</param>
 /// <returns>The dialog result.</returns>
 public DialogResult ShowDialog(IWin32Window owner, string username, PlList<PlPerson> persons)
 {
     // Reset the result.
     this.Result = null;
     // Refresh the results list.
     this.control.Refresh(username, persons);
     // Show the dialog.
     return base.ShowDialog(owner);
 }
 /// <summary>
 /// An event handler called when the user selects a PlanetLab person.
 /// </summary>
 /// <param name="sender">The sender object.</param>
 /// <param name="e">The event arguments.</param>
 private void OnSelected(object sender, PlObjectEventArgs<PlPerson> e)
 {
     // Set the result.
     this.Result = e.Object;
     // Set the dialog result.
     this.DialogResult = DialogResult.OK;
 }
 /// <summary>
 /// Updates the control with the information of the specified person.
 /// </summary>
 /// <param name="person">The selected person.</param>
 private void OnSetPerson(PlPerson person)
 {
     // Set the current person.
     this.person = person;
     // Show the panel.
     this.panelPerson.Visible = true;
     // Set the panel information.
     this.textBoxFirstName.Text = person.FirstName;
     this.textBoxLastName.Text = person.LastName;
     this.textBoxTitle.Text = person.Title;
     this.textBoxPhone.Text = person.Phone;
     this.textBoxEmail.Text = person.Email;
     this.textBoxUrl.Text = person.Url;
     // Enable the properties button.
     this.buttonProperties.Enabled = true;
     // Set the user icon.
     this.pictureUser.Image = ControlPlanetLabSettings.personIcons[(int)UserState.Success];
     // Set the text.
     this.labelPerson.Text = ControlPlanetLabSettings.personMessage[(int)UserState.Success];
 }
 /// <summary>
 /// Updates the control with the information of the specified person.
 /// </summary>
 /// <param name="state">The user state.</param>
 private void OnSetPerson(UserState state)
 {
     // Clear the current person.
     this.person = null;
     // Hide the panel.
     this.panelPerson.Visible = false;
     // Disable the properties button.
     this.buttonProperties.Enabled = false;
     // Set the user icon.
     this.pictureUser.Image = ControlPlanetLabSettings.personIcons[(int)state];
     // Set the text.
     this.labelPerson.Text = ControlPlanetLabSettings.personMessage[(int)state];
 }
 /// <summary>
 /// Saves the current credentials.
 /// </summary>
 /// <param name="persons">The list of persons corresponding to the current credentials.</param>
 /// <param name="person">The selected person.</param>
 private void OnSaveCredentials(PlList<PlPerson> persons, PlPerson person)
 {
     // Save the credentials.
     this.crawler.PlanetLab.SaveCredentials(
         this.textBoxUsername.Text,
         this.textBoxPassword.SecureText,
         persons,
         person.Id ?? -1
         );
 }