// Public methods.
        /// <summary>
        /// Refreshes the control with the specified list of PlanetLab persons.
        /// </summary>
        /// <param name="username">The account username.</param>
        /// <param name="persons">The persons list.</param>
        public void Refresh(string username, PlList<PlPerson> persons)
        {
            // Set the control default state.
            this.buttonSelect.Enabled = false;
            this.buttonProperties.Enabled = false;

            // Set the username.
            this.textBoxUsername.Text = username;

            // Clear the persons list.
            this.listView.Items.Clear();

            // Set the list of persons.
            persons.Lock();
            try
            {
                foreach (PlPerson person in persons)
                {
                    if (person.Id.HasValue)
                    {
                        ListViewItem item = new ListViewItem(new string[] {
                                person.Id.Value.ToString(),
                                person.FirstName,
                                person.LastName,
                                person.IsEnabled.HasValue ? person.IsEnabled.Value ? "Yes" : "No" : "Unknown",
                                person.Phone,
                                person.Email,
                                person.Url
                            });
                        item.ImageIndex = 0;
                        item.Tag = person;
                        this.listView.Items.Add(item);
                    }
                }
            }
            finally
            {
                persons.Unlock();
            }
        }
 /// <summary>
 /// Saves the PlanetLab credentials.
 /// </summary>
 /// <param name="username">The PlanetLab username.</param>
 /// <param name="password">The PlanetLab persons.</param>
 /// <param name="persons">The list of person accounts associated with the previous credentials.</param>
 /// <param name="person">The default person account ID.</param>
 public void SaveCredentials(string username, SecureString password, PlList<PlPerson> persons, int person)
 {
     // Save the username.
     DotNetApi.Windows.RegistryExtensions.SetString(this.root, "UserName", username);
     CrawlerConfig.Static.PlanetLabUsername = username;
     // Save the password.
     DotNetApi.Windows.RegistryExtensions.SetSecureString(this.root, "Password", password, ApplicationConfig.CryptoKey, ApplicationConfig.CryptoIV);
     CrawlerConfig.Static.PlanetLabPassword = password;
     // Save the persons.
     persons.Lock();
     try { this.LocalPersons.CopyFrom(persons); }
     finally { persons.Unlock(); }
     try { this.LocalPersons.SaveToFile(this.LocalPersonsFileName); }
     catch { }
     // Save the person.
     DotNetApi.Windows.RegistryExtensions.SetInteger(this.root, "PersonId", person);
     CrawlerConfig.Static.PlanetLabPersonId = person;
 }