private void lvCredentials_DoubleClick(object sender, EventArgs e)
 {
     while (this.lvCredentials.SelectedItems.Count > 0)
     {
         ListViewItem         item = this.lvCredentials.SelectedItems[0];
         CredentialsCacheItem tag  = item.Tag as CredentialsCacheItem;
         if (tag != null)
         {
             base.wrapper.BitsJob.RemoveCredentials(tag.BitsCredentials);
             if (this.onCredentialsRemoved != null)
             {
                 this.onCredentialsRemoved(this, tag.BitsCredentials);
             }
             for (int i = 0; i < Settings.Default.CredentialsCache.Count; i++)
             {
                 CredentialsCacheItem item3 = Settings.Default.CredentialsCache[i];
                 if (item3.Equals(tag))
                 {
                     Settings.Default.CredentialsCache.RemoveAt(i);
                 }
             }
         }
         this.lvCredentials.Items.Remove(item);
     }
     Settings.Default.Save();
     this.UpdateCredentialsListview();
 }
 private void CheckAddAllowed(object sender, EventArgs e)
 {
     this.btnAddCredentials.Enabled = false;
     if ((this.tbPassword.Text.Length != 0) && (this.tbUserName.Text.Length != 0))
     {
         CredentialsCacheItem item = this.CredentialsCacheItemFromUIValues();
         foreach (CredentialsCacheItem item2 in Settings.Default.CredentialsCache)
         {
             if (item.Equals(item2))
             {
                 return;
             }
         }
         this.btnAddCredentials.Enabled = true;
     }
 }