private void button3_Click(object sender, EventArgs e) { var connectDialog = new FpsConnectForm(); Enabled = false; var connectDr = connectDialog.ShowDialog(this); if (connectDr != DialogResult.OK) { button3.Enabled = false; } connectDialog.Close(); Enabled = true; var f = new Fingerprint(); if (connectDialog.IsConnected) { Enabled = false; var scanForm = new ScanFingerForm(); var dr = scanForm.ShowDialog(this); if (dr == DialogResult.OK) { f.AsBitmap = scanForm.Fingerprint; } scanForm.Dispose(); Enabled = true; } else { MessageBox.Show(Resources.FPS_NOT_CONNECTED_ERROR); } float authLikelyhood; try { authLikelyhood = CandidateDelegate.VerifyFingerprint(CandidateDelegate.Unpack(PackedData, Password, _publicKey), f); } // ReSharper disable once UnusedVariable catch (CryptographicException ex) { MessageBox.Show(Resources.NOT_VERIFY_ID_ERROR); return; } MessageBox.Show(Resources.AUTH_LIKLEYHOOD_MESSAGE + authLikelyhood.ToString("R")); }
private void button3_Click(object sender, EventArgs e) { var connectDialog = new FpsConnectForm(); Enabled = false; var connectDr = connectDialog.ShowDialog(this); if (connectDr != DialogResult.OK) button3.Enabled = false; connectDialog.Close(); Enabled = true; var f = new Fingerprint(); if (connectDialog.IsConnected) { Enabled = false; var scanForm = new ScanFingerForm(); var dr = scanForm.ShowDialog(this); if (dr == DialogResult.OK) { f.AsBitmap = scanForm.Fingerprint; } scanForm.Dispose(); Enabled = true; } else { MessageBox.Show(Resources.FPS_NOT_CONNECTED_ERROR); } float authLikelyhood; try { authLikelyhood = CandidateDelegate.VerifyFingerprint(CandidateDelegate.Unpack(PackedData, Password, _publicKey), f); } // ReSharper disable once UnusedVariable catch (CryptographicException ex) { MessageBox.Show(Resources.NOT_VERIFY_ID_ERROR); return; } MessageBox.Show(Resources.AUTH_LIKLEYHOOD_MESSAGE + authLikelyhood.ToString("R")); }
private void fingerprintButton_Click(object sender, EventArgs e) { _c.Fingerprint = new Fingerprint(); if (connectDialog.IsConnected) { Enabled = false; var scanForm = new ScanFingerForm(); var dr = scanForm.ShowDialog(this); if (dr == DialogResult.OK) { _c.Fingerprint.AsBitmap = scanForm.Fingerprint; fpBox.Image = scanForm.Fingerprint; } scanForm.Dispose(); Enabled = true; } else { //TODO: Allow to choose fingerprint image? MessageBox.Show(Resources.FPS_NOT_CONNECTED_ERROR, Resources.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void updateID_Click(object sender, EventArgs e) { if (!_c.IsComplete()) { MessageBox.Show( Resources .GeneratorForm_uploadBlockchain_Click_Cannot_generate_an_and_ID_for_an_incomplete_candidate_, Resources.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrWhiteSpace(chainId.Text)) { MessageBox.Show(Resources.CHAIN_ID_EMPTY, Resources.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrWhiteSpace(password.Text)) { MessageBox.Show(Resources.PASSWORD_EMPTY_ERROR, Resources.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!password.Text.Equals(confirmPassword.Text)) { MessageBox.Show(Resources.PASSWORDS_NOT_MATCH, Resources.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var d = MessageBox.Show(Resources.UPDATE_ID_WARNING, Resources.ARE_YOU_SURE, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d != DialogResult.Yes) return; var fp = new Fingerprint(); if (connectDialog.IsConnected) { var scanForm = new ScanFingerForm(); var dr = scanForm.ShowDialog(this); if (dr == DialogResult.OK) { fp.AsBitmap = scanForm.Fingerprint; } else { scanForm.Dispose(); return; } scanForm.Dispose(); } else { MessageBox.Show(Resources.FPS_NOT_CONNECTED_ERROR, Resources.ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } chainId.Text = Convert.ToBase64String(CandidateDelegate.UpdateCandidate(_c, password.Text, fp, PrivateKey, Convert.FromBase64String(chainId.Text))); Clipboard.SetText(chainId.Text); }