private void butOK_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrEmpty(txtName.Text) == true)
{
MessageBox.Show("Please provide a valid name for the Locator", "Invalid Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (this.LocatorNamesAlreadyInUse.Contains(txtName.Text))
{
MessageBox.Show("The name provided for the Locator is already in use. Please specify a new name." ,"Invalid Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (txtName.Text.Length > 100)
{
MessageBox.Show("Locator Name must be less than 100 characters.", "Invalid Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (radOnline.Checked == true)
{
if (this.cboDhubLocator.SelectedItem == null)
{
MessageBox.Show("Please specify a Locator to use.", "Invalid Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
this.ConfiguredLocator = this.cboDhubLocator.SelectedItem as OnlineLocator;
this.ConfiguredLocator.Url = "DATAHUB:" + this.ConfiguredLocator.Url;
}
else
{
if (this._Locators == null)
{
MessageBox.Show("Please connect to a Locator Hub and choose a Locator.", "Invalid Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (cboLocator.SelectedItem == null)
{
MessageBox.Show("Please specify a Locator to use.", "Invalid Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (!cboUrl.Text.ToUpper().Contains("HTTPS://"))
{
if (MessageBox.Show("This Edit Connection does not use a Secure Web Connection. Details will be sent in clear text and is therefore un-secure. It is recommended that the Web Server is changed to use HTTPS. \n Do you wish to continue?", "Security Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
{
return;
}
}
this.ConfiguredLocator = new OnlineLocator();
this.ConfiguredLocator.GazId = cboLocator.SelectedValue.ToString();
this.ConfiguredLocator.Url = cboUrl.Text;
if (radAuthToken.Checked)
{
this.ConfiguredLocator.Authentication = AuthenticationMode.Token;
this.ConfiguredLocator.Username = txtUsername.Text;
this.ConfiguredLocator.Password = txtPassword.Text;
}
else if (radAuthWindows.Checked)
{
if (chkUseCurrentCredntials.Checked)
{
this.ConfiguredLocator.Authentication = AuthenticationMode.CurrentWindows;
}
else
{
this.ConfiguredLocator.Authentication = AuthenticationMode.Windows;
this.ConfiguredLocator.Username = txtUsername.Text;
this.ConfiguredLocator.Password = txtPassword.Text;
}
}
}
this.ConfiguredLocator.Name = txtName.Text;
this.ConfiguredLocator.FieldNames = "LOCATOR_DESCRIPTION";
this.DialogResult = DialogResult.OK;
this.Close();
}
catch (Exception)
{
}
}