private void BtnDeleteCertificate_Click(object sender, RoutedEventArgs e)
 {
     Global.CertStore.Remove(SelectedCert.Certificate);
     CertDetails.Remove(SelectedCert);
     SelectedCert = null;
     OnPropertyChanged(nameof(CertDetails));
     _hasChanged = true;
 }
        public void SetCertificate(CertDetails cert)
        {
            if (!SelectedCertIsDifferent)
            {
                return;
            }

            _settings["SslCertificateName"] = cert.Subject;
            SaveToSettings();
        }
        private void BtnAddCertificate_Click(object sender, RoutedEventArgs e)
        {
            var acf = new AddCertificateForm();

            if ((acf.ShowDialog() ?? false) == false)
            {
                return;
            }

            Global.CertStore.Add(acf.Certificate);
            CertDetails.Add(new CertDetails(acf.Certificate));
            SelectedCert = null;
            OnPropertyChanged(nameof(CertDetails));
            _hasChanged = true;
        }
Пример #4
0
        public void RefreshCerts()
        {
            _certificates = new List <CertDetails>();
            var ecsCertList = new List <string>();

            foreach (var cert in Global.CertStore.Certificates)
            {
                if (!cert.HasPrivateKey)
                {
                    continue;
                }

                //var cur = new CertDetails(cert.Subject, cert.Thumbprint, cert.NotAfter);
                var cur = new CertDetails(cert);
                _certificates.Add(cur);
                ecsCertList.Add(cur.ToEcsString());
            }

            _settingsControls.ForEach(x => x.SetComboBoxSource(_certificates));
        }
 private void DGCerts_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     BtnDeleteCertificate.IsEnabled = BtnRenameCertificate.IsEnabled = DGCerts.SelectedIndex >= 0;
     SelectedCert = (CertDetails)DGCerts.SelectedItem;
 }