void SettingsPage2_BeforeNextAsync(object sender, DoWorkEventArgs e) { if (ServerOptionExists()) { if (string.IsNullOrEmpty(primaryTextBox.Text)) { MessageBox.Show( "The primary SOA host for all zones must not be empty.", "Primary SOA host", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; return; } if (string.IsNullOrEmpty(hostmasterTextBox.Text)) { MessageBox.Show( "The SOA hostmaster for all zones must not be empty.", "SOA hostmaster", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; return; } if (string.IsNullOrEmpty(dnsIpsTextBox.Text)) { MessageBox.Show( "The list of suggested DNS A record IPs must not be empty.", "Suggest DNS IPs", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; return; } if (string.IsNullOrEmpty(dnsServersTextBox.Text)) { MessageBox.Show( "The list of suggested DNS servers must not be empty.", "Suggest DNS servers", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; return; } ServerSetupOption option = OptionList.OfType <ServerSetupOption>().Single(); option.DnsSoaPrimaryServer = primaryTextBox.Text; option.DnsSoaHostmaster = hostmasterTextBox.Text; option.DnsSuggestAIPs = dnsIpsTextBox.Text; option.DnsSuggestServers = dnsServersTextBox.Text; } }
void ConfigurePage_BeforeNextAsync(object sender, DoWorkEventArgs e) { if (ServerOptionExists()) { if (legacyCheckBox.Checked && string.IsNullOrEmpty(legacyConnectionStringTextBox.Text)) { MessageBox.Show( "The legacy connection string was empty while legacy mode was enabled.", "Legacy connection string", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; return; } if (string.IsNullOrEmpty(wsnTextBox.Text)) { MessageBox.Show( "The windows server name text box cannot be empty.", "Windows server name", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; return; } if (wsnTextBox.Text == "localhost") { MessageBox.Show( "Microsoft ADSI does not support windows server name 'localhost'.", "Windows server name", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; return; } if (string.IsNullOrEmpty(iisIpsTextBox.Text)) { MessageBox.Show( "The list of available IIS IPs must not be empty.", "Available IIS IPs", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; return; } if (encryptorSecretChangeCheckBox.Checked && string.IsNullOrEmpty(encryptorSecretTextBox.Text)) { MessageBox.Show( "The encryption secret must not be empty when enabled.", "Encryption secret", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; return; } ServerSetupOption option = OptionList.OfType <ServerSetupOption>().Single(); option.EnableLegacyMode = legacyCheckBox.Checked; option.LegacyConnectionString = legacyConnectionStringTextBox.Text; option.WindowsServerName = wsnTextBox.Text; option.AvailableIisIPs = iisIpsTextBox.Text; option.EncryptionSecret = encryptorSecretTextBox.Text; option.WebsiteDirectory = websiteDirectoryTextBox.Text; option.EncryptorSecretChange = encryptorSecretChangeCheckBox.Checked; } }