/// <summary>
        /// Handles click on the vote button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void button1_Click(object sender, EventArgs e)
        {
            HideErrorText();

            // Verify the entered Information
            if (Model.VerifyVote(textBox1.Text))
            {
                try
                {
                    if (await Model.SendVote(textBox1.Text))
                    {
                        // Vote successfull redirect to ElectionPicker
                        MessageBox.Show("Vote sucessfull");
                        this.Hide();
                        var electionPickerForm = new ElectionPickerForm(this.backend);
                        electionPickerForm.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("There was an error with your Vote. Please check your address and try again");
                    }
                } catch
                {
                    MessageBox.Show("Already voted from this address");
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Handles Clicks on the submit button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void submitButton_Click(object sender, EventArgs e)
 {
     if (backend.InitService(this.blockchainUrlTB.Text, this.electionAdressTB.Text))
     {
         this.Hide();
         var electionPickerForm = new ElectionPickerForm(this.backend);
         electionPickerForm.ShowDialog();
         this.Close();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Handles Clicks on the vote button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void submitVote_Click(object sender, EventArgs e)
        {
            cl.SecureRanks();

            if (!cl.CheckRanks())
            {
                MessageBox.Show("Ranking not correct!");
                return;
            }

            if (!cl.OnlyHexInString(this.textBox1.Text))
            {
                MessageBox.Show("Wrong adress format");
                return;
            }


            try
            {
                if (await backend.SendVoteAlternativeAsync(textBox1.Text, cl.GetCandidates()))
                {
                    // Vote successfull redirect to ElectionPicker
                    MessageBox.Show("Vote sucessfull");
                    this.Hide();
                    var electionPickerForm = new ElectionPickerForm(this.backend);
                    electionPickerForm.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("There was an error with your Vote. Please check your address and try again");
                }
            } catch
            {
                MessageBox.Show("Already voted from this adress");
            }
        }