Opc.Ua.Configuration.MainForm.AddCertificateToTrustListBTN_Click C# (CSharp) Method

AddCertificateToTrustListBTN_Click() private method

private AddCertificateToTrustListBTN_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void AddCertificateToTrustListBTN_Click(object sender, EventArgs e)
        {
            try
            {
                // get application.
                ManagedApplication application = ApplicationToManageCTRL.GetSelectedApplication();;

                if (application == null)
                {
                    return;
                }
                
                // load the configuration.
                application.Reload();

                CertificateStoreIdentifier store = GetDefaultStore(application, false);

                // show the list of rejected certificates.
                CertificateIdentifier id = new CertificateListDlg().ShowDialog(store, true);

                if (id == null)
                {
                    return;
                }

                store = new CertificateStoreIdentifier();
                store.StoreType = id.StoreType;
                store.StorePath = id.StorePath;
                m_currentStore = store;

                X509Certificate2 certificate = id.Find();
                ValidateAndImport(application.TrustList, certificate);
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }