public void Accept() { ServerAE = ServerAE.Trim(); ServerName = ServerName.Trim(); ServerLocation = ServerLocation.Trim(); ServerHost = ServerHost.Trim(); if (base.HasValidationErrors) { this.ShowValidation(true); } else { var current = _serverTree.CurrentNode; var allButCurrent = _serverTree.RootServerGroup.GetAllServers().Where(s => s != current).Cast <IServerTreeDicomServer>(); var sameAETitleCount = allButCurrent.Count(s => s.AETitle == _serverAE); if (sameAETitleCount > 0) { var message = sameAETitleCount == 1 ? SR.ConfirmAETitleConflict_OneServer : String.Format(SR.ConfirmAETitleConflict_MultipleServers, sameAETitleCount); if (DialogBoxAction.No == Host.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo)) { return; } } var newServer = new ServerTreeDicomServer( _serverName, _serverLocation, _serverHost, _serverAE, _serverPort, _isStreaming, _headerServicePort, _wadoServicePort); // edit current server if (_serverTree.CurrentNode.IsServer) { _serverTree.ReplaceDicomServerInCurrentGroup(newServer); } // add new server else if (_serverTree.CurrentNode.IsServerGroup) { ((IServerTreeGroup)_serverTree.CurrentNode).AddChild(newServer); _serverTree.CurrentNode = newServer; } _serverTree.Save(); SetServerNodeMetaProperties(_serverName, _isPriorsServer); _serverTree.FireServerTreeUpdatedEvent(); this.ExitCode = ApplicationComponentExitCode.Accepted; Host.Exit(); } }
private void EditServerDialog_Load(object sender, EventArgs e) { labelError.Text = string.Empty; if (_Settings == null) { ClientTimeout.Value = 300; ServerPort.Text = "104"; ServerMaxClients.Text = "0"; StartMode.Text = "Automatic"; ReconnectTimeout.Value = 300; AddInTimeout.Value = 300; Text = Resources.AddNewServer; labelRestart.Text = string.Empty; TemporaryDirectory.Text = Path.GetTempPath(); checkBoxImageCopy.Checked = false; MaxPduLength.Text = "46726"; } else { Text = Resources.EditServer + " [" + _Settings.AETitle + "]"; ServerAE.Text = _Settings.AETitle; ServerAE.Enabled = false; ServerAllowAnonymous.Checked = _Settings.AllowAnonymous; ServerDescription.Text = _Settings.Description; IpType = _Settings.IpType; ServerMaxClients.Text = _Settings.MaxClients.ToString(); ServerPort.Text = _Settings.Port.ToString(); ServerSecure.Checked = _Settings.Secure; ClientTimeout.Value = Convert.ToDecimal(_Settings.ClientTimeout); TemporaryDirectory.Text = _Settings.TemporaryDirectory; ImplementationClass.Text = _Settings.ImplementationClass; ImplementationVersionName.Text = _Settings.ImplementationVersionName; DisplayName.Text = _Settings.DisplayName; MaxPduLength.Text = _Settings.MaxPduLength.ToString(); ReconnectTimeout.Value = Convert.ToDecimal(_Settings.ReconnectTimeout); AddInTimeout.Value = Convert.ToDecimal(_Settings.AddInTimeout); NoDelay.Checked = _Settings.NoDelay; ReceiveBuffer.Text = _Settings.ReceiveBufferSize.ToString(); SendBuffer.Text = _Settings.SendBufferSize.ToString(); StartMode.Text = _Settings.StartMode; AllowMultipleConnections.Checked = _Settings.AllowMultipleConnections; if (StartMode.SelectedIndex == -1) { StartMode.SelectedIndex = 0; } labelRestart.Text = "Server will need to be restarted for changes to take effect"; checkBoxImageCopy.Checked = _Settings.DataSetImageCopy; numericUpDownPipes.Value = Convert.ToDecimal(_Settings.AdministrativePipes); } UpdateIpRadioButtons(); if (DirFocus) { TemporaryDirectory.Focus(); TemporaryDirectory.SelectAll(); } else { ServerAE.Focus(); } ServerAE_TextChanged(null, null); }