private bool check4checks() { foreach (object TN in checkedListBox1.Items) { txtBoxOutput.Text += "Item: " + TN.ToString() + "Value: " + checkedListBox1.GetItemCheckState(checkedListBox1.Items.IndexOf(TN)).ToString(); if (checkedListBox1.GetItemCheckState(checkedListBox1.Items.IndexOf(TN)) == CheckState.Checked) { return(true); } } return(false); }
private void buttonHitungN_Click(object sender, EventArgs e) { textBoxD.Clear(); textBoxE.Clear(); textBoxN.Clear(); textBoxTotientN.Clear(); buttonRandomD.Enabled = false; buttonHitungE.Enabled = false; uint p, q; if (uint.TryParse(textBoxP.Text, out p) && uint.TryParse(textBoxQ.Text, out q)) { P = p; Q = q; if (!Kripto.IsMiller(P, (int)Math.Min(P, (ulong)100))) { MessageBox.Show("P bukan prima"); } else if (!Kripto.IsMiller(Q, (int)Math.Min(Q, (ulong)100))) { MessageBox.Show("Q bukan prima"); } else { N = P * Q; TN = (P - 1) * (Q - 1); textBoxN.Text = N.ToString(); textBoxTotientN.Text = TN.ToString(); buttonRandomD.Enabled = true; buttonHitungE.Enabled = true; } } else { MessageBox.Show("Cek p dan q"); } }