Пример #1
0
 /// <include file="documentation.xml" path="/UI/ListBase/CreateSignatureItem/*"/>
 protected virtual SignatureItem CreateSignatureItem(Signature sig)
 {
   SignatureItem item = new SignatureItem(sig, sig.SignerName + " (0x" + sig.ShortKeyId + ")");
   item.SubItems.Add(sig.IsInvalid ? "invalid" : !sig.IsValid ? "unverified" : sig.Expired ? "expired" : "valid");
   item.SubItems.Add(sig.CreationTime.ToShortDateString());
   item.SubItems.Add(sig.Expiration.HasValue ? sig.Expiration.Value.ToShortDateString() : "n/a");
   return item;
 }
Пример #2
0
  /// <summary>Initializes this list given the key whose signatures will be displayed.</summary>
  public void Initialize(Dictionary<string,Signature[]> sigs)
  {
    if(sigs == null) throw new ArgumentNullException();

    Items.Clear();
    this.SmallImageList = TreeImageList;

    foreach(KeyValuePair<string,Signature[]> pair in sigs)
    {
      ListViewItem sourceItem = new ListViewItem(pair.Key);
      Items.Add(sourceItem);

      ListViewItem subItem = null;
      SignatureStatus overallStatus = SignatureStatus.Valid;

      if(pair.Value == null)
      {
        subItem = new ListViewItem("An error occurred");
        subItem.ForeColor   = Color.FromArgb(255, 96, 96);
        subItem.IndentCount = 1;
        Items.Add(subItem);
        overallStatus = SignatureStatus.Error;
      }
      else if(pair.Value.Length == 0)
      {
        subItem = new ListViewItem("No signatures");
        subItem.IndentCount = 1;
        Items.Add(subItem);
      }
      else
      {
        foreach(Signature sig in pair.Value)
        {
          if(sig.IsInvalid) overallStatus = SignatureStatus.Invalid;
          else if(!sig.IsValid && overallStatus != SignatureStatus.Invalid) overallStatus = SignatureStatus.Error;

          SignatureItem sigItem = CreateSignatureItem(sig);
          if(sigItem != null)
          {
            sigItem.ImageIndex  = IndentImage;
            sigItem.IndentCount = 1;
            SetFont(sigItem);
            Items.Add(sigItem);
            subItem = sigItem;
          }
        }
      }

      subItem.ImageIndex = CornerImage;
      SetFont(sourceItem, overallStatus);
    }
  }
Пример #3
0
 /// <include file="documentation.xml" path="/UI/ListBase/SetSignatureItemFont/*"/>
 protected virtual void SetFont(SignatureItem item)
 {
   if(item.Signature.IsInvalid)
   {
     item.ForeColor = Color.Red;
   }
   else if(item.Signature.Expired)
   {
     item.ForeColor = SystemColors.GrayText;
   }
   else if(!item.Signature.IsValid)
   {
     item.ForeColor = Color.FromArgb(255, 96, 96);
   }
 }
Пример #4
0
  /// <summary>Initializes this list given the key whose signatures will be displayed.</summary>
  public void Initialize(Signature[] sigs)
  {
    if(sigs == null) throw new ArgumentNullException();

    Items.Clear();
    this.SmallImageList = null;

    foreach(Signature sig in sigs)
    {
      SignatureItem item = CreateSignatureItem(sig);
      if(item != null)
      {
        SetFont(item);
        Items.Add(item);
      }
    }
  }