private void sha1CalculateHashBtn_Click(object sender, EventArgs e) { var ready = true; if (string.IsNullOrWhiteSpace(sha1PlainFile.Text)) { MessageBox.Show("Choose a file for encryption", "Choose plain text", MessageBoxButtons.OK, MessageBoxIcon.Warning); ready = false; } if (string.IsNullOrWhiteSpace(sha1HashFile.Text)) { sha1HashFile.Text = _initialDirectory + "SHA_hash.txt"; } if (ready) { SHA1.CalculateHash(sha1PlainFile.Text, sha1HashFile.Text); } }