Ejemplo n.º 1
0
        public VotingDescriptor CreateShares(Certificate certificate, VotingDescriptor2 voting)
        {
            string fileName = string.Format("{0}@{1}.pi-auth", certificate.Id.ToString(), voting.Id.ToString());
              string filePath = Path.Combine(Status.DataPath, fileName);

              if (Circle.Vote.VotingDialog.ShowVoting(this, null, voting) == DialogResult.OK)
              {
            if (DecryptPrivateKeyDialog.TryDecryptIfNessecary(certificate, GuiResources.UnlockActionAuthorityCreateShares))
            {
              try
              {
            Begin();
            Status.VotingClient.CreateSharePart(voting.Id, (AuthorityCertificate)certificate, filePath, CreateSharesCompleteCallBack);

            if (!WaitForCompletion())
            {
              throw this.exception;
            }
              }
              finally
              {
            certificate.Lock();
              }

              return this.votingDescriptor;
            }
              }

              return voting;
        }
Ejemplo n.º 2
0
        public VotingDescriptor Decipher(Certificate certificate, VotingDescriptor2 voting)
        {
            string fileName = string.Format("{0}@{1}.pi-auth", certificate.Id.ToString(), voting.Id.ToString());
              string filePath = Path.Combine(Status.DataPath, fileName);

              if (DecryptPrivateKeyDialog.TryDecryptIfNessecary(certificate, GuiResources.UnlockActionAuthorityDecipher))
              {
            try
            {
              this.userCanceled = false;
              Begin();
              Status.VotingClient.CreateDeciphers(voting.Id, (AuthorityCertificate)certificate, filePath, AskForPartiallyDecipher, CreateDeciphersComplete);

              if (!WaitForCompletion() && !this.userCanceled)
              {
            throw this.exception;
              }
            }
            finally
            {
              certificate.Lock();
            }

            return this.votingDescriptor;
              }
              else
              {
            return voting;
              }
        }
Ejemplo n.º 3
0
        public VotingDescriptor CheckShares(Certificate certificate, VotingDescriptor2 voting)
        {
            string fileName = string.Format("{0}@{1}.pi-auth", certificate.Id.ToString(), voting.Id.ToString());
              string filePath = Path.Combine(Status.DataPath, fileName);

              if (DecryptPrivateKeyDialog.TryDecryptIfNessecary(certificate, GuiResources.UnlockActionAuthorityCheckShares))
              {
            try
            {
              Begin();
              Status.VotingClient.CheckShares(voting.Id, (AuthorityCertificate)certificate, filePath, CheckSharesComplete);

              if (WaitForCompletion())
              {
            if (this.acceptShares)
            {
              MessageForm.Show(Resources.ControllerCheckSharesOk, Resources.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
              MessageForm.Show(Resources.ControllerCheckSharesFailed, Resources.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
              }
              else
              {
            throw this.exception;
              }
            }
            finally
            {
              certificate.Lock();
            }

            return this.votingDescriptor;
              }
              else
              {
            return voting;
              }
        }