示例#1
0
        public override void Save()
        {
            try
            {
                if (HasFileStoreChanged)
                {
                    _hasFileStoreEverChanged = true;
                }

                StudyStore.UpdateConfiguration(_configuration);

                // if the default deletion rule was modified, kick-off a re-apply rules work item
                if (HasDeletionRuleChanged)
                {
                    var bridge = new ReapplyRulesBridge();
                    bridge.ReapplyAll(new RulesEngineOptions {
                        ApplyDeleteActions = true
                    });
                }

                _fileStoreDirectory  = _currentFileStoreDirectory = _configuration.FileStoreDirectory;
                _currentDeletionRule = _configuration.DefaultDeletionRule.Clone();

                //Just update all kinds of properties.
                NotifyFileStoreChanged();
                NotifyDeletionRuleChanged(null);
                NotifyServiceControlLinkPropertiesChanged();

                ShowValidation(false);
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, Host.DesktopWindow);
            }
        }
        public void RunApplication(string[] args)
        {
            var commandLine = new CommandLine();

            try
            {
                commandLine.Parse(args);
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Info, e);
                Console.WriteLine(e.Message);
                commandLine.PrintUsage(Console.Out);
                Environment.Exit(-1);
            }

            try
            {
                DicomServer.DicomServer.UpdateConfiguration(new DicomServerConfiguration
                {
                    HostName = commandLine.HostName,
                    AETitle  = commandLine.AETitle,
                    Port     = commandLine.Port
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Platform.Log(LogLevel.Warn, e);
                Environment.Exit(-1);
            }

            try
            {
                if (!String.IsNullOrEmpty(commandLine.FileStoreDirectory))
                {
                    StudyStore.UpdateConfiguration(new StorageConfiguration
                    {
                        FileStoreDirectory      = commandLine.FileStoreDirectory,
                        MinimumFreeSpacePercent =
                            commandLine.MinimumFreeSpacePercent != null
                                                               ? double.Parse(commandLine.MinimumFreeSpacePercent)
                                                               : StorageConfiguration.AutoMinimumFreeSpace
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Platform.Log(LogLevel.Warn, e);
                Environment.Exit(-1);
            }
        }