private void btnChangePort_Click(object sender, EventArgs e) { PortDialog dialog = new PortDialog(); dialog.Port = iServer.Port; if (dialog.ShowDialog() == DialogResult.OK) { if (dialog.Port != iServer.Port) { iServer.Port = dialog.Port; txtPort.Text = iServer.Port.ToString(); iServer.ReStart(); } } }