private void DiffieHellmanSendOpenKeyButton_Click(object sender, EventArgs e) { var prime = Convert.ToInt32(this.DiffieHellmanPrimeUpDown.Value); var gen = Convert.ToInt32(this.DiffieHellmanGeneratorUpDown.Value); //if input is number if (CiphersDeciphers.IsPrime(prime) && CiphersDeciphers.IsPrimitiveRoot(gen, prime)) { this.DiffieHellmanResultLabel.Text = $"{prime},{gen}"; } else { MessageBox.Show( "Ключ введён неверно", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error ); } }