Exemplo n.º 1
0
            public ValidationResult GetResult(IApplicationComponent component)
            {
                DicomServerEditComponent serverComponent = (DicomServerEditComponent)component;

                ServerTree serverTree = serverComponent._serverTree;

                bool   isConflicted;
                string conflictingServerPath;

                if (serverTree.CurrentNode.IsServer)
                {
                    isConflicted = !serverTree.CanEditCurrentServer(serverComponent.ServerName,
                                                                    serverComponent.ServerAE,
                                                                    serverComponent.ServerHost,
                                                                    serverComponent.ServerPort, out conflictingServerPath);
                }
                else
                {
                    isConflicted = !serverTree.CanAddServerToCurrentGroup(serverComponent.ServerName,
                                                                          serverComponent.ServerAE,
                                                                          serverComponent.ServerHost,
                                                                          serverComponent.ServerPort, out conflictingServerPath);
                }

                if (isConflicted)
                {
                    return(new ValidationResult(false, String.Format(SR.FormatServerConflict, conflictingServerPath)));
                }

                return(new ValidationResult(true, ""));
            }
Exemplo n.º 2
0
        public DicomServerEditComponent(ServerTree dicomServerTree)
        {
            _serverTree = dicomServerTree;
            if (_serverTree.CurrentNode.IsServer)
            {
                _serverNameReadOnly = true;
                var server = (IServerTreeDicomServer)_serverTree.CurrentNode;
                _serverName        = server.Name;
                _serverLocation    = server.Location;
                _serverAE          = server.AETitle;
                _serverHost        = server.HostName;
                _serverPort        = server.Port;
                _isStreaming       = server.IsStreaming;
                _headerServicePort = server.HeaderServicePort;
                _wadoServicePort   = server.WadoServicePort;

                GetServerNodeMetaProperties(_serverName, out _isPriorsServer);
            }
            else
            {
                _serverNameReadOnly = false;
                _serverName         = String.Empty;
                _serverLocation     = String.Empty;
                _serverAE           = String.Empty;
                _serverHost         = String.Empty;
                _serverPort         = ServerTreeDicomServer.DefaultPort;
                _isStreaming        = false;
                _headerServicePort  = ServerTreeDicomServer.DefaultHeaderServicePort;
                _wadoServicePort    = ServerTreeDicomServer.DefaultWadoServicePort;
            }
        }
            public ValidationResult GetResult(IApplicationComponent component)
            {
                DicomServerGroupEditComponent groupComponent = (DicomServerGroupEditComponent)component;

                ServerTree serverTree = groupComponent._serverTree;

                bool   valid           = true;
                string conflictingPath = "";

                if (groupComponent._isNewServerGroup && !serverTree.CanAddGroupToCurrentGroup(groupComponent._serverGroupName, out conflictingPath))
                {
                    valid = false;
                }
                else if (!groupComponent._isNewServerGroup && !serverTree.CanEditCurrentGroup(groupComponent._serverGroupName, out conflictingPath))
                {
                    valid = false;
                }

                if (!valid)
                {
                    return(new ValidationResult(false, String.Format(SR.FormatServerGroupConflict, groupComponent._serverGroupName, conflictingPath)));
                }

                return(new ValidationResult(true, ""));
            }
Exemplo n.º 4
0
        private void AddNewServerGroup()
        {
            ServerTree _serverTree = this.Context.ServerTree;

            this.Context.UpdateType = (int)ServerUpdateType.Add;
            DicomServerGroupEditComponent editor   = new DicomServerGroupEditComponent(_serverTree, ServerUpdateType.Add);
            ApplicationComponentExitCode  exitCode = ApplicationComponent.LaunchAsDialog(this.Context.DesktopWindow, editor, SR.TitleAddServerGroup);

            this.Context.UpdateType = (int)ServerUpdateType.None;
        }
 /// <summary>
 /// Constructor
 /// </summary>
 public DicomServerGroupEditComponent(ServerTree dicomServerTree, ServerUpdateType updatedType)
 {
     _isNewServerGroup = updatedType.Equals(ServerUpdateType.Add)? true : false;
     _serverTree       = dicomServerTree;
     if (!_isNewServerGroup)
     {
         _serverGroupName = _serverTree.CurrentNode.Name;
     }
     else
     {
         _serverGroupName = "";
     }
 }
Exemplo n.º 6
0
        public ServerTreeComponent()
        {
            _serverTree = new ServerTree();

            if (_serverTree.CurrentNode != null)
            {
                _selectedServers = new DicomServiceNodeList(_serverTree.CurrentNode.ToDicomServiceNodes())
                {
                    Name = _serverTree.CurrentNode.DisplayName, Id = _serverTree.CurrentNode.Path
                };
            }
            else
            {
                _selectedServers = new DicomServiceNodeList();
            }
        }
Exemplo n.º 7
0
        private void EditServer()
        {
            ServerTree serverTree = this.Context.ServerTree;

            this.Context.UpdateType = (int)ServerUpdateType.Edit;

            if (serverTree.CurrentNode.IsServer)
            {
                DicomServerEditComponent     editor   = new DicomServerEditComponent(serverTree);
                ApplicationComponentExitCode exitCode = ApplicationComponent.LaunchAsDialog(this.Context.DesktopWindow, editor, SR.TitleEditServer);
            }
            else
            {
                DicomServerGroupEditComponent editor   = new DicomServerGroupEditComponent(serverTree, ServerUpdateType.Edit);
                ApplicationComponentExitCode  exitCode = ApplicationComponent.LaunchAsDialog(this.Context.DesktopWindow, editor, SR.TitleEditServerGroup);
            }

            this.Context.UpdateType = (int)ServerUpdateType.None;
        }
        public void RunApplication(string[] args)
        {
            var cmd = new CommandLine();

            try
            {
                cmd.Parse(args);
            }
            catch (Exception)
            {
                cmd.PrintUsage(Console.Out);
                Environment.Exit(-1);
            }

            //Hack to redirect local shared settings to a different exe's config file.
            ExtendedLocalFileSettingsProvider.ExeConfigFileName = cmd.Target;
            foreach (var settingsClass in _applicationSettingsClasses)
            {
                var settingsType = Type.GetType(settingsClass);
                SettingsMigrator.MigrateSharedSettings(settingsType, cmd.Source);
            }

            try
            {
                if (!String.IsNullOrEmpty(cmd.DicomServersFileName) && File.Exists(cmd.DicomServersFileName))
                {
                    var existingServerTree = new ServerTree.ServerTree();
                    if (existingServerTree.RootServerGroup.GetAllServers().Count == 0)
                    {
                        //Settings NOT from an old xml file were just migrated, so
                        //if there's still no servers defined, import from old xml file.
                        var serverTree = new ServerTree.ServerTree(cmd.DicomServersFileName);
                        serverTree.Save();
                    }
                }
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Warn, e, "Failed to import legacy server tree '{0}'.", cmd.DicomServersFileName);
            }
        }
Exemplo n.º 9
0
        private void DeleteServerServerGroup()
        {
            ServerTree serverTree = this.Context.ServerTree;

            if (serverTree.CurrentNode.IsServer)
            {
                if (this.Context.DesktopWindow.ShowMessageBox(SR.MessageConfirmDeleteServer, MessageBoxActions.YesNo) != DialogBoxAction.Yes)
                {
                    return;
                }

                this.Context.UpdateType = (int)ServerUpdateType.Delete;
                serverTree.DeleteCurrentNode();
                serverTree.Save();
                this.Context.UpdateType = (int)ServerUpdateType.None;
            }
            else if (serverTree.CurrentNode.IsServerGroup)
            {
                if (this.Context.DesktopWindow.ShowMessageBox(SR.MessageConfirmDeleteServerGroup, MessageBoxActions.YesNo) != DialogBoxAction.Yes)
                {
                    return;
                }

                this.Context.UpdateType = (int)ServerUpdateType.Delete;
                try
                {
                    serverTree.DeleteCurrentNode();
                    serverTree.Save();
                }
                catch (Exception e)
                {
                    ExceptionHandler.Report(e, Context.DesktopWindow);
                }

                this.Context.UpdateType = (int)ServerUpdateType.None;
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Builds the root and first-level of the tree
        /// </summary>
        private void BuildServerTreeView(TreeView treeView, ServerTree.ServerTree dicomServerTree)
        {
            treeView.Nodes.Clear();
            treeView.ShowNodeToolTips = true;

			if (_component.ShowLocalServerNode)
			{
				TreeNode localServerNode = new TreeNode(dicomServerTree.LocalServer.DisplayName);
				localServerNode.Tag = dicomServerTree.LocalServer;
				localServerNode.ToolTipText = dicomServerTree.LocalServer.ToString();
				SetIcon(dicomServerTree.LocalServer, localServerNode);
				treeView.Nodes.Add(localServerNode);
			}

            // build the default server group
            TreeNode firstServerGroup = new TreeNode(dicomServerTree.RootServerGroup.DisplayName);
            firstServerGroup.Tag = dicomServerTree.RootServerGroup;
            firstServerGroup.ToolTipText = dicomServerTree.RootServerGroup.ToString();
            SetIcon(dicomServerTree.RootServerGroup, firstServerGroup);
            treeView.Nodes.Add(firstServerGroup);
            BuildNextTreeLevel(firstServerGroup);
			
			firstServerGroup.Expand();//expand main group by default.

			UpdateServerGroups();
		}
		public void RunApplication(string[] args)
		{
			var cmd = new CommandLine();
			try
			{
				cmd.Parse(args);
			}
			catch (Exception)
			{
				cmd.PrintUsage(Console.Out);
				Environment.Exit(-1);
			}

			//Hack to redirect local shared settings to a different exe's config file.
			ExtendedLocalFileSettingsProvider.ExeConfigFileName = cmd.Target;
			foreach (var settingsClass in _applicationSettingsClasses)
			{
				var settingsType = Type.GetType(settingsClass);
				SettingsMigrator.MigrateSharedSettings(settingsType, cmd.Source);
			}

			try
			{
				if (!String.IsNullOrEmpty(cmd.DicomServersFileName) && File.Exists(cmd.DicomServersFileName))
				{
					var existingServerTree = new ServerTree.ServerTree();
					if (existingServerTree.RootServerGroup.GetAllServers().Count == 0)
					{
						//Settings NOT from an old xml file were just migrated, so
						//if there's still no servers defined, import from old xml file.
						var serverTree = new ServerTree.ServerTree(cmd.DicomServersFileName);
						serverTree.Save();
					}
				}
			}
			catch (Exception e)
			{
				Platform.Log(LogLevel.Warn, e, "Failed to import legacy server tree '{0}'.", cmd.DicomServersFileName);
			}
		}