private void btnGenerate_Click(object sender, EventArgs e) { btnGenerate.Enabled = false; RSAKeySizeListItem selectedItem = cmbKeySize.SelectedItem as RSAKeySizeListItem; RSA_AsymetricEncryption.RSAKeySize keySize = (RSA_AsymetricEncryption.RSAKeySize)Enum.Parse(typeof(RSA_AsymetricEncryption.RSAKeySize), selectedItem.Value.ToString()); ClearKeys(); var t = new Task(() => this.GenerateRSAKeyPair(keySize)); t.Start(); t.GetAwaiter().OnCompleted(UpdateFormControlsWhenOperationComplete); }
private void GenerateRSAKeyPair(RSA_AsymetricEncryption.RSAKeySize keySize) { isRunning = true; rsaKeySetIdentity = _rsaAsymetricEncryption.GenerateRSAKeyPair(keySize); isRunning = false; }