public bool SaveData() { if (_representedObject == null) { hMailServer.TCPIPPorts tcpIPPorts = APICreator.TCPIPPortsSettings; _representedObject = tcpIPPorts.Add(); Marshal.ReleaseComObject(tcpIPPorts); } _representedObject.Address = textIPAddress.Text; _representedObject.PortNumber = textTCPIPPort.Number; _representedObject.ConnectionSecurity = (eConnectionSecurity)comboConnectionSecurity.SelectedValue; _representedObject.Protocol = (hMailServer.eSessionType)comboProtocol.SelectedValue; if (comboSSLCertificate.SelectedValue == null) { _representedObject.SSLCertificateID = 0; } else { _representedObject.SSLCertificateID = (int)comboSSLCertificate.SelectedValue; } _representedObject.Save(); DirtyChecker.SetClean(this); Utility.RefreshNode(InternalNames.GetPortName(_representedObject)); Utility.AskRestartServer(); return(true); }
public bool SaveData() { if (_representedObject == null) { hMailServer.TCPIPPorts tcpIPPorts = APICreator.TCPIPPortsSettings; _representedObject = tcpIPPorts.Add(); Marshal.ReleaseComObject(tcpIPPorts); } _representedObject.Address = textIPAddress.Text; _representedObject.PortNumber = textTCPIPPort.Number; _representedObject.UseSSL = checkEnableSSL.Checked; _representedObject.Protocol = (hMailServer.eSessionType)comboProtocol.SelectedValue; if (comboSSLCertificate.SelectedValue == null) { _representedObject.SSLCertificateID = 0; } else { _representedObject.SSLCertificateID = (int)comboSSLCertificate.SelectedValue; } _representedObject.Save(); DirtyChecker.SetClean(this); Utility.RefreshNode(InternalNames.GetPortName(_representedObject)); if (MessageBox.Show(Strings.Localize("hMailServer needs to be restarted for the changes to take effect.") + Environment.NewLine + Strings.Localize("Do you want to restart hMailServer now?"), EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { using (new WaitCursor()) { hMailServer.Application application = APICreator.Application; application.Stop(); application.Start(); MessageBox.Show(Strings.Localize("The hMailServer server has been restarted."), EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Information); } } return(true); }