private void TxtConstantB_TextChanged(object sender, EventArgs e) { try { if (txtModpValue.Text == "") { Mod23.Modp.p = 23; //txtModpValue.Text = "23"; } else { if (Modp.IsPrime(int.Parse(txtModpValue.Text))) { Mod23.Modp.p = int.Parse(txtModpValue.Text); } /*else * { * txtModpValue.Text = "23"; * }*/ } if (txtConstantA.Text != "" && TxtConstantB.Text != "" && txtXValue.Text != "") { txtXValue_TextChanged(sender, e); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void txtXValue_TextChanged(object sender, EventArgs e) { try { if (txtModpValue.Text == "") { Mod23.Modp.p = 23; //txtModpValue.Text = "23"; } else { if (Modp.IsPrime(int.Parse(txtModpValue.Text))) { Mod23.Modp.p = int.Parse(txtModpValue.Text); } else { txtModpValue.Text = "23"; } } if (txtConstantA.Text != "" && TxtConstantB.Text != "" && txtXValue.Text != "") { // int x = int.Parse(txtXValue.Text); int a = int.Parse(txtConstantA.Text); int b = int.Parse(TxtConstantB.Text); string[] array = txtXValue.Text.Split(','); textBox1.Text = ""; if (array.Length > 0) { foreach (string s in array) { if (s != "") { textBox1.Text += Modp.GenerateEllipticPoint(int.Parse(s), a, b); } } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }