private async void btnGenerate_Click(object sender, EventArgs e) { if (txtSSId.Text.Length > 0 && !IsValidSsid()) { MessageBox.Show(this, "Invalid SSID, if you want to generate a password and QR code without SSID please leave the SSID field empty", "Invalid caracters", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } var secureRandomGenerator = new SecureRandomGenerator(); txtGeneratedPassword.Text = await secureRandomGenerator.GetRandomStringFromPasswordType(_activeSettings.PasswordType, _activeSettings.PasswordLength); // Always generate QR even if the SSID is invalid, but inform instead. await GnerateQrCode().ConfigureAwait(true); }
private async void btnGenerate_Click(object sender, EventArgs e) { if (!IsValidSsid() && txtSSId.Text.Length > 0) { MessageBox.Show(this, "QR Code was created with the password but The SSID is invalid", "Invalid characters", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } var secureRandomGenerator = new SecureRandomGenerator(); txtGeneratedPassword.Text = await secureRandomGenerator.GetRandomStringFromPasswordType(_activeSettings.PasswordType, _activeSettings.PasswordLength); // Always generate QR even if the SSID is invalid, but inform instead. btnGenerate.Enabled = false; await GenerateQrCode(); btnGenerate.Enabled = true; }