Пример #1
0
        private void deleteMenu_Click(object sender, EventArgs e)
        {
            if (this.votingList.SelectedIndices.Count > 0)
              {
            ListViewItem item = this.votingList.SelectedItems[0];
            VotingDescriptor voting = (VotingDescriptor)item.Tag;

            if (MessageForm.Show(
              string.Format(Resources.AdminDeleteVotingWarning, voting.Id.ToString(), voting.Title.Text),
              GuiResources.MessageBoxTitle,
              MessageBoxButtons.YesNo,
              MessageBoxIcon.Question,
              DialogResult.No)
              == DialogResult.Yes)
            {
              if (DecryptPrivateKeyDialog.TryDecryptIfNessecary(Status.Certificate, Resources.AdminDeleteVotingAction))
              {
            var command = new DeleteVotingRequest.Command(voting.Id);
            var signedCommand = new Signed<DeleteVotingRequest.Command>(command, Status.Certificate);
            this.run = true;

            Status.VotingClient.DeleteVoting(signedCommand, DeleteVotingComplete);

            while (this.run)
            {
              Status.UpdateProgress();
              Thread.Sleep(10);
            }

            Status.UpdateProgress();

            if (this.exception == null)
            {
              Status.SetMessage(Resources.AdminDeleteVotingDone, MessageType.Success);
            }
            else
            {
              Status.SetMessage(this.exception.Message, MessageType.Error);
            }

            item.Remove();

            OnUpdateWizard();
              }
            }
              }
        }
Пример #2
0
        public void Delete(VotingDescriptor2 voting, AdminCertificate adminCertificate)
        {
            var command = new DeleteVotingRequest.Command(voting.Id);
              var signedCommand = new Signed<DeleteVotingRequest.Command>(command, adminCertificate);

              Begin();
              Status.VotingClient.DeleteVoting(signedCommand, DeleteVotingComplete);

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