hMailServer.Administrator.ucSSLCertificate.SaveData C# (CSharp) Method

SaveData() public method

public SaveData ( ) : bool
return bool
        public bool SaveData()
        {
            bool newObject = false;
            if (_representedObject == null)
            {
                hMailServer.Settings settings = APICreator.Application.Settings;
                hMailServer.SSLCertificates sslCertificates = settings.SSLCertificates;

                _representedObject = sslCertificates.Add();

                Marshal.ReleaseComObject(settings);
                Marshal.ReleaseComObject(sslCertificates);

                newObject = true;
            }

            _representedObject.Name = textName.Text;

            _representedObject.CertificateFile = textCertificateFile.Text;
            _representedObject.PrivateKeyFile = textPrivateKeyFile.Text;

            _representedObject.Save();

            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;
            mainForm.RefreshCurrentNode(textName.Text);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(_representedObject.Name);
                mainForm.SelectNode(crit);
            }

            return true;
        }