Ejemplo n.º 1
0
        private void CustomizeSignatureButton_Click(object sender, EventArgs e)
        {
            CustomizeDialog dlg = new CustomizeDialog();

            dlg.NameCheck.Checked     = showName;
            dlg.LocationCheck.Checked = showLocation;
            dlg.ReasonCheck.Checked   = showReason;
            dlg.DateCheck.Checked     = showDate;
            dlg.LabelsCheck.Checked   = showLabels;
            dlg.ImageCheck.Checked    = showImage;

            dlg.ReasonLabel.Text = ReasonCombo.Text;
            dlg.DateLabel.Text   = DateTimeOffset.Now.ToString("yyyy-MM-dd HH:mm:ss K");
            if (CertificateCombo.SelectedIndex > -1 &&
                CertificateCombo.SelectedIndex < certificates.Count)
            {
                X509Certificate2 selectedCert = certificates[CertificateCombo.SelectedIndex];

                dlg.NameLabel.Text = ExtractDNField(selectedCert.Subject, "CN");
                string country  = ExtractDNField(selectedCert.Subject, "C");
                string locality = ExtractDNField(selectedCert.Subject, "L");
                dlg.LocationLabel.Text = locality +
                                         (!string.IsNullOrEmpty(locality) && !string.IsNullOrEmpty(country) ? ", " : "") +
                                         country;
            }

            dlg.pictureBox1.Image = SignaturePicture.Image;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                showName     = dlg.NameCheck.Checked;
                showLocation = dlg.LocationCheck.Checked;
                showReason   = dlg.ReasonCheck.Checked;
                showDate     = dlg.DateCheck.Checked;
                showLabels   = dlg.LabelsCheck.Checked;
                showImage    = dlg.ImageCheck.Checked;

                SignaturePicture.Image = showImage ? dlg.pictureBox1.Image : null;
            }
        }
Ejemplo n.º 2
0
        private void CustomizeSignatureButton_Click(object sender, EventArgs e)
        {
            CustomizeDialog dlg = new CustomizeDialog();

            dlg.NameCheck.Checked = showName;
            dlg.LocationCheck.Checked = showLocation;
            dlg.ReasonCheck.Checked = showReason;
            dlg.DateCheck.Checked = showDate;
            dlg.LabelsCheck.Checked = showLabels;
            dlg.ImageCheck.Checked = showImage;

            dlg.ReasonLabel.Text = ReasonCombo.Text;
            dlg.DateLabel.Text = DateTimeOffset.Now.ToString("yyyy-MM-dd HH:mm:ss K");
            if (CertificateCombo.SelectedIndex > -1 &&
                CertificateCombo.SelectedIndex < certificates.Count)
            {
                X509Certificate2 selectedCert = certificates[CertificateCombo.SelectedIndex];

                dlg.NameLabel.Text = ExtractDNField(selectedCert.Subject, "CN");
                string country = ExtractDNField(selectedCert.Subject, "C");
                string locality = ExtractDNField(selectedCert.Subject, "L");
                dlg.LocationLabel.Text = locality +
                    (!string.IsNullOrEmpty(locality) && !string.IsNullOrEmpty(country) ? ", " : "") +
                    country;
            }

            dlg.pictureBox1.Image = SignaturePicture.Image;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                showName = dlg.NameCheck.Checked;
                showLocation = dlg.LocationCheck.Checked;
                showReason = dlg.ReasonCheck.Checked;
                showDate = dlg.DateCheck.Checked;
                showLabels = dlg.LabelsCheck.Checked;
                showImage = dlg.ImageCheck.Checked;

                SignaturePicture.Image = showImage ? dlg.pictureBox1.Image : null;
            }
        }