Beispiel #1
0
        void server_AdvancedSettingsChanged(object sender, EventArgs e)
        {
            AdvancedSettings settings = AdvancedSettings.Open(ServiceDirectory);

            if (settings != null)
            {
                settings.RefreshSettings();
                Options = settings.GetAddInCustomData <PatientUpdaterOptions>(_AddIn, _Name);
                if (Options != null)
                {
                    //
                    // Change auto update settings
                    //
                    if (Options.EnableAutoUpdate)
                    {
                        if (UpdateQueue != null)
                        {
                            return;
                        }

                        UpdateQueue = new AutoUpdateQueue(Options.AutoUpdateThreads);
                        UpdateQueue.InitializeDatabase();
                    }
                    else
                    {
                        if (UpdateQueue != null)
                        {
                            UpdateQueue.Dispose();
                            UpdateQueue = null;
                        }
                    }

                    //
                    // Change retry settings
                    //
                    if (Options.EnableRetry)
                    {
                        if (RetryProcessor != null)
                        {
                            return;
                        }

                        RetryProcessor = new AutoRetryProcessor(Options.RetryDirectory);
                        RetryProcessor.Start(Options.RetrySeconds, Options.RetryDays);
                    }
                    else
                    {
                        if (RetryProcessor != null)
                        {
                            RetryProcessor.Stop();
                            RetryProcessor = null;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void Break(BreakType type)
        {
            if (UpdateQueue != null)
            {
                UpdateQueue.Dispose();
                UpdateQueue = null;
            }

            if (RetryProcessor != null)
            {
                RetryProcessor.Stop();
                RetryProcessor = null;
            }
        }
Beispiel #3
0
        public override void Load(string serviceDirectory, string displayName)
        {
            System.Configuration.Configuration configuration;
            DicomServer server = ServiceLocator.Retrieve <DicomServer>();

            ServiceDirectory = serviceDirectory;
            ServiceName      = server.Name;
            ServerAE         = server.AETitle;

            server.ServerSettingsChanged += new EventHandler(server_ServerSettingsChanged);
            StorageConfigManager          = new StorageModuleConfigurationManager(true);
            StorageConfigManager.Load(serviceDirectory);

            configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory);
            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
            {
                StorageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, displayName)).CreateDataAccessAgent <IStorageDataAccessAgent>();
                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(StorageAgent);
            }
            else
            {
                StorageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
            }

            try
            {
                AdvancedSettings settings = AdvancedSettings.Open(ServiceDirectory);
                string           name     = Assembly.GetExecutingAssembly().GetName().Name;

                RegisterServerEvents(settings);
                Options = settings.GetAddInCustomData <PatientUpdaterOptions>(_AddIn, _Name);
                if (Options == null)
                {
                    Options = new PatientUpdaterOptions();
                }

                if (Options.EnableAutoUpdate)
                {
                    UpdateQueue = new AutoUpdateQueue(Options.AutoUpdateThreads);
                    UpdateQueue.InitializeDatabase();
                }
            }
            catch (Exception e)
            {
                if (Options == null)
                {
                    Options = new PatientUpdaterOptions();
                }

                Logger.Global.Error(Source, e.Message);
            }

            if (Options.EnableRetry)
            {
                if (string.IsNullOrEmpty(Module.Options.RetryDirectory))
                {
                    Module.Options.RetryDirectory = Path.Combine(ServiceDirectory, @"AutoUpdate\");
                }

                RetryProcessor = new AutoRetryProcessor(Options.RetryDirectory);
                RetryProcessor.Start(Options.RetrySeconds, Options.RetryDays);
            }
        }