예제 #1
0
        private void ConfigureAutoCopy(AdvancedSettings settings)
        {
            string name = Assembly.GetExecutingAssembly().GetName().Name;

            Options = GetAutoCopyOptions(settings);

            if (Options.EnableAutoCopy)
            {
                if (CopyQueue != null)
                {
                    CopyQueue.Dispose();
                }

                CopyQueue = new AutoCopyQueue(Options.AutoCopyThreads);
                CopyQueue.InitializeDatabase();
            }
            else
            {
                if (CopyQueue != null)
                {
                    CopyQueue.Dispose();
                    CopyQueue = null;
                }
            }
        }
예제 #2
0
        public override void Load(string serviceDirectory, string displayName)
        {
            try
            {
                AdvancedSettings settings = AdvancedSettings.Open(serviceDirectory);

                ServiceDirectory = serviceDirectory;
                DisplayName      = displayName;
                _Server          = ServiceLocator.Retrieve <DicomServer> ( );
                ServiceName      = _Server.Name;

                if (!ServiceLocator.IsRegistered <SettingsChangedNotifier>())
                {
                    SettingsChangedNotifier configChangedNotifier = new SettingsChangedNotifier(settings);

                    configChangedNotifier.SettingsChanged += new EventHandler(configChangedNotifier_SettingsChanged);
                    configChangedNotifier.Enabled          = true;
                    ServiceLocator.Register <SettingsChangedNotifier>(configChangedNotifier);
                }
                else
                {
                    ServiceLocator.Retrieve <SettingsChangedNotifier>().SettingsChanged += new EventHandler(configChangedNotifier_SettingsChanged);
                }

                ConfigureAutoCopy(settings);
            }
            catch (Exception e)
            {
                if (Options == null)
                {
                    Options = new AutoCopyOptions();
                }

                Logger.Global.Error(Source, e.Message);
            }
        }
예제 #3
0
        public static AutoCopyOptions GetAutoCopyOptions(AdvancedSettings settings)
        {
            AutoCopyOptions options = null;

            try
            {
                options = settings.GetAddInCustomData <AutoCopyOptions>(Source, "AutoCopyOptions");
                if (options == null)
                {
                    options = new AutoCopyOptions();
                }
            }
            catch (Exception e)
            {
                if (options == null)
                {
                    options = new AutoCopyOptions();
                }

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

            return(options);
        }