Пример #1
0
 public override WizardItem Next()
 {
     if (this.nextItemBadShareProof != null)
       {
     return this.nextItemBadShareProof;
       }
       if (this.nextIsCreate)
       {
     Status.Certificate = null;
     return new SimpleCreateCertificateItem();
       }
       else
       {
     if (Status.Certificate is CACertificate)
     {
       return null;
     }
     else
     {
       CheckCertificateItem checkItem = new CheckCertificateItem();
       checkItem.PreviousItem = this;
       return checkItem;
     }
       }
 }
Пример #2
0
        public override WizardItem Next()
        {
            DirectoryInfo directory = new DirectoryInfo(Status.DataPath);
              IEnumerable<FileInfo> certificateFiles = directory.GetFiles("*.pi-cert");

              if (certificateFiles.Count() == 0)
              {
            if (this.advancedOptionsRadio.Checked)
            {
              return new ChooseCertificateItem();
            }
            else if (this.tallyOnlyRadio.Checked)
            {
              return new ListVotingsItem();
            }
            else
            {
              return new SimpleChooseCertificateItem();
            }
              }
              else if (certificateFiles.Count() == 1)
              {
            if (this.advancedOptionsRadio.Checked)
            {
              return new ChooseCertificateItem();
            }
            else if (this.tallyOnlyRadio.Checked)
            {
              return new ListVotingsItem();
            }
            else
            {
              try
              {
            Status.Certificate = Serializable.Load<Certificate>(certificateFiles.Single().FullName);
            Status.CertificateFileName = certificateFiles.Single().FullName;
            CheckCertificateItem item = new CheckCertificateItem();
            item.PreviousItem = this;
            return item;
              }
              catch
              {
            return new ChooseCertificateItem();
              }
            }
              }
              else
              {
            if (this.tallyOnlyRadio.Checked)
            {
              return new ListVotingsItem();
            }
            else
            {
              return new ChooseCertificateItem();
            }
              }
        }