public AddEditSmartHostForm(Relay_SmartHost smartHost) { this.InitializeComponent(); this.m_pServer.Text = smartHost.Host; this.m_pPort.Value = smartHost.Port; if (smartHost.SslMode == SslMode.None) { this.m_pSslMode.SelectedIndex = 0; } else if (smartHost.SslMode == SslMode.SSL) { this.m_pSslMode.SelectedIndex = 1; } else if (smartHost.SslMode == SslMode.TLS) { this.m_pSslMode.SelectedIndex = 2; } this.m_pUserName.Text = smartHost.UserName; this.m_pPassword.Text = smartHost.Password; }
/// <summary> /// Edit constructor. /// </summary> /// <param name="smartHost">Smart host.</param> public wfrm_System_SmartHost(Relay_SmartHost smartHost) { InitUI(); m_pServer.Text = smartHost.Host; m_pPort.Value = smartHost.Port; if (smartHost.SslMode == SslMode.None) { m_pSslMode.SelectedIndex = 0; } else if (smartHost.SslMode == SslMode.SSL) { m_pSslMode.SelectedIndex = 1; } else if (smartHost.SslMode == SslMode.TLS) { m_pSslMode.SelectedIndex = 2; } m_pUserName.Text = smartHost.UserName; m_pPassword.Text = smartHost.Password; }
private void LoadData() { try { Relay_Settings relay = this.m_pVirtualServer.SystemSettings.Relay; if (relay.RelayMode == Relay_Mode.SmartHost) { this.m_pTabGeneral_SendSmartHost.Checked = true; } else { this.m_pTabGeneral_SendDns.Checked = true; } if (relay.SmartHostsBalanceMode == BalanceMode.LoadBalance) { this.m_pTabGeneral_SmartHostsBalanceMode.SelectedIndex = 0; } else { this.m_pTabGeneral_SmartHostsBalanceMode.SelectedIndex = 1; } this.m_pTabGeneral_SessionTimeout.Value = relay.SessionIdleTimeOut; this.m_pTabGeneral_MaxConnections.Value = relay.MaximumConnections; this.m_pTabGeneral_MaxConnsPerIP.Value = relay.MaximumConnectionsPerIP; this.m_pTabGeneral_RelayInterval.Value = relay.RelayInterval; this.m_pTabGeneral_RelayRetryInterval.Value = relay.RelayRetryInterval; this.m_pTabGeneral_SendUndelWarning.Value = relay.SendUndeliveredWarningAfter; this.m_pTabGeneral_SendUndelivered.Value = relay.SendUndeliveredAfter; this.m_pTabGeneral_StoreUndeliveredMsgs.Checked = relay.StoreUndeliveredMessages; this.m_pTabGeneral_UseTlsIfPossible.Checked = relay.UseTlsIfPossible; Relay_SmartHost[] smartHosts = relay.SmartHosts; for (int i = 0; i < smartHosts.Length; i++) { Relay_SmartHost relay_SmartHost = smartHosts[i]; ListViewItem listViewItem = new ListViewItem(); listViewItem.Text = relay_SmartHost.Host; listViewItem.SubItems.Add(relay_SmartHost.Port.ToString()); listViewItem.SubItems.Add(relay_SmartHost.SslMode.ToString()); listViewItem.SubItems.Add(relay_SmartHost.UserName); listViewItem.Tag = relay_SmartHost; this.m_pTabGeneral_SmartHosts.Items.Add(listViewItem); } IPBindInfo[] binds = relay.Binds; for (int j = 0; j < binds.Length; j++) { IPBindInfo iPBindInfo = binds[j]; ListViewItem listViewItem2 = new ListViewItem(); listViewItem2.Text = iPBindInfo.HostName; if (iPBindInfo.IP.ToString() == "0.0.0.0") { listViewItem2.SubItems.Add("Any IPv4"); } else if (iPBindInfo.IP.ToString() == "0:0:0:0:0:0:0:0") { listViewItem2.SubItems.Add("Any IPv6"); } else { listViewItem2.SubItems.Add(iPBindInfo.IP.ToString()); } listViewItem2.SubItems.Add(iPBindInfo.Port.ToString()); listViewItem2.SubItems.Add(iPBindInfo.SslMode.ToString()); listViewItem2.SubItems.Add(Convert.ToString(iPBindInfo.Certificate != null)); listViewItem2.Tag = iPBindInfo; this.m_pTabBindings_Bindings.Items.Add(listViewItem2); } this.AddNotifications(); } catch (Exception x) { ErrorForm errorForm = new ErrorForm(x, new StackTrace()); errorForm.ShowDialog(this); } }