예제 #1
0
  /// <summary>Initializes this form with the list of attributes to be revoked.</summary>
  public void Initialize(UserAttribute[] attrs)
  {
    if(attrs == null) throw new ArgumentNullException();
    if(attrs.Length == 0) throw new ArgumentException("No attributes were given.");

    ids.Items.Clear();
    foreach(UserAttribute attr in attrs) ids.Items.Add(PGPUI.GetAttributeName(attr));
  }
예제 #2
0
  /// <summary>Reloads the key and redisplays its attributes and user IDs.</summary>
  void ReloadKey()
  {
    if(key != null)
    {
      key = pgp.RefreshKey(key, ListOptions.RetrieveAttributes | ListOptions.RetrieveSecretKeys);

      if(key == null)
      {
        foreach(Control control in Controls)
        {
          if(control != lblDescription) control.Enabled = false;
        }
        lblDescription.Text = "The key you were editing no longer exists.";
      }
      else
      {
        userIds.Items.Clear();

        foreach(UserId id in key.UserIds)
        {
          AttributeItem item = new AttributeItem(id, PGPUI.GetAttributeName(id));
          if(id.Revoked) item.Text += " (revoked)";
          item.ImageIndex = UserIdIcon;
          SetFont(item);
          userIds.Items.Add(item);
        }

        foreach(UserAttribute attr in key.Attributes)
        {
          bool isPhoto = attr is UserImage;
          AttributeItem item = new AttributeItem(attr, PGPUI.GetAttributeName(attr));
          if(attr.Revoked) item.Text += " (revoked)";
          item.ImageIndex = isPhoto ? PhotoIdIcon : UnknownIcon;
          SetFont(item);
          userIds.Items.Add(item);
        }
      }
    }
  }
예제 #3
0
 /// <include file="documentation.xml" path="/UI/ListBase/CreateAttributeItem/*"/>
 protected virtual AttributeItem CreateAttributeItem(UserAttribute attr)
 {
   if(attr == null) throw new ArgumentNullException();
   return new AttributeItem(attr, PGPUI.GetAttributeName(attr));
 }