コード例 #1
0
ファイル: GeneratorForm.cs プロジェクト: yujieli666/Cryptid
        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);
            }
        }
コード例 #2
0
ファイル: GeneratorForm.cs プロジェクト: yujieli666/Cryptid
        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);
        }