private void OkBTN_Click(object sender, EventArgs e)
{
try
{
// set the server name.
m_configuration.ServerName = BrowseNameTB.Text;
if (String.IsNullOrEmpty(m_configuration.ServerName))
{
m_configuration.ServerName = ProgIdTB.Text;
}
if (String.IsNullOrEmpty(m_configuration.ServerName))
{
m_configuration.ServerName = "COM Server";
}
// construct the server URL.
StringBuilder buffer = new StringBuilder();
buffer.Append("opc.com://");
if (String.IsNullOrEmpty(HostNameTB.Text))
{
buffer.Append("localhost");
}
else
{
buffer.Append(HostNameTB.Text);
}
if (!String.IsNullOrEmpty(ProgIdTB.Text))
{
buffer.Append("/");
buffer.Append(ProgIdTB.Text);
}
if (!String.IsNullOrEmpty(ClsidTB.Text))
{
buffer.Append("/");
buffer.Append(ClsidTB.Text);
}
m_configuration.ServerUrl = buffer.ToString();
m_configuration.SeperatorChars = SeperatorsTB.Text;
m_configuration.MaxReconnectWait = (int)ReconnectTimeUD.Value*1000;
// close the dialog.
DialogResult = DialogResult.OK;
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, System.Reflection.MethodBase.GetCurrentMethod(), exception);
}
}
#endregion