Exemple #1
0
        public override void Dispose(bool bUnmanaged)
        {
            base.Dispose();

            DicomNet.Shutdown();
            DicomEngine.Shutdown();
        }
Exemple #2
0
        public void Initialize(AdvancedSettings advancedSettings, ServerSettings Settings, string ServerDirectory)
        {
            _AdvancedSettings = advancedSettings;
            _Settings         = Settings;

            Module.InitializeLicense();
            DicomEngine.Startup();
            DicomNet.Startup();
            Module.InitializeFailureDirectory(ServerDirectory);
            Module.ServiceName      = Settings.ServiceName;
            Module.ServiceDirectory = ServerDirectory;

            try
            {
                if (Settings != null)
                {
                    Module.ServiceName = Settings.ServiceName;
                }
                Module.ServiceDirectory = ServerDirectory;
                Module.ConfigureRuleProcessor(_AdvancedSettings);

                _dlgConfigure              = new ConfigureDialog();
                _dlgConfigure.FormClosing += new FormClosingEventHandler(_dlgConfigure_FormClosing);
                _Presenter = new RuleEditorPresenter(Module._Options, ServerDirectory);
                _Presenter.RunView(_dlgConfigure, advancedSettings);
            }
            catch (Exception e)
            {
                Logger.Global.Exception(Module.Source, e);
            }
        }
Exemple #3
0
        private void dataGridViewServers_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {
            DataGridView d = sender as DataGridView;

            if (d != null)
            {
                DataGridViewCheckBoxCell cb = d.CurrentCell as DataGridViewCheckBoxCell;
                if (cb != null)
                {
                    if (cb.Value is bool)
                    {
                        bool bValue = (bool)cb.Value;
                        if (bValue)
                        {
                            DicomOpenSslVersion version = DicomNet.GetOpenSslVersion();
                            if (Utils.VerifyOpensslVersion(this) == false)
                            {
                                cb.Value = false;
                                dataGridViewServers.RefreshEdit();
                            }
                        }
                    }
                    d.CommitEdit(DataGridViewDataErrorContexts.CurrentCellChange);
                    EnableDialogItems();
                }
            }
        }
Exemple #4
0
        public static void LogEvent(LogType type, MessageDirection messageDirection, string description,
                                    DicomCommandType command, DicomDataSet dataset,
                                    StoreScu Client, SerializableDictionary <string, object> customInformation)
        {
            try
            {
                string   ae  = Client.AETitle;
                DicomNet net = Client as DicomNet;

                SerializableDictionary <string, object> logCustomInformation = DicomLogEntry.CustomInformationDicomMessage;
                if (customInformation != null)
                {
                    logCustomInformation = new SerializableDictionary <string, object>();
                    foreach (KeyValuePair <string, object> kvp in customInformation)
                    {
                        logCustomInformation.Add(kvp.Key, kvp.Value);
                    }
                    logCustomInformation.Add(DicomLogEntry.DicomMessageKey, DicomLogEntry.DicomMessageValue);
                }

                Logger.Global.Log("Auto Copy", Client.CurrentScp.AETitle, Client.CurrentScp.PeerAddress.ToString(),
                                  Client.CurrentScp.Port, net.IsAssociated() ? net.Association.Calling : ae,
                                  net.HostAddress != null ? net.HostAddress.ToString() : string.Empty,
                                  net.IsConnected() ? net.HostPort : -1, command, DateTime.Now, type,
                                  messageDirection, description, dataset, logCustomInformation);
            }
            catch (Exception exception)
            {
                Logger.Global.Exception("Auto Copy", exception);
            }
        }
Exemple #5
0
 private static void DicomShutdown()
 {
     try
     {
         DicomNet.Shutdown();
         DicomEngine.Shutdown();
     }
     catch (Exception)
     {
     }
 }
Exemple #6
0
        public static void SetSecurityCertificates(DicomNet dicomNet)
        {
            if (_dicomSecurityAgent == null)
            {
                return;
            }

            dicomNet.SetTlsClientCertificate(
                _dicomSecurityAgent.CertificateFileName,
                _dicomSecurityAgent.CertificateType,
                _dicomSecurityAgent.KeyFileName.Length > 0 ? _dicomSecurityAgent.KeyFileName : null);
        }
Exemple #7
0
        public static void SetCiphers(DicomNet dicomNet)
        {
            if (_dicomSecurityCiphersAgent == null)
            {
                return;
            }

            int index = 0;

            foreach (DicomTlsCipherSuiteType cipher in _dicomSecurityCiphersAgent.CipherSuiteList)
            {
                dicomNet.SetTlsCipherSuiteByIndex(index, cipher);
                index++;
            }
        }
Exemple #8
0
        /*
         * Notifies a member of a connection that the connection was closed.
         */
        protected override void OnClose(DicomExceptionCode error, DicomNet net)
        {
            if (Clients.ContainsKey(net.PeerAddress))
            {
                Client client = Clients[net.PeerAddress];

                Clients.Remove(net.PeerAddress);

                client.Dispose( );
            }
            else
            {
                net.Dispose( );
            }
        }
Exemple #9
0
        protected override void OnClose(DicomExceptionCode error, DicomNet net)
        {
            if (Clients.ContainsKey(net.PeerAddress + "_" + net.PeerPort))
            {
                Client client = Clients[net.PeerAddress + "_" + net.PeerPort];

                mf.RemoveClient(client);
                Clients.Remove(net.PeerAddress + "_" + net.PeerPort);
                client.Terminate();
                client.Dispose();
            }
            else
            {
                net.Dispose();
            }
        }
Exemple #10
0
        private void SetCipherSuites(DicomNet scu)
        {
            // Zero out the CipherSuite list
            scu.SetTlsCipherSuiteByIndex(0, DicomTlsCipherSuiteType.None);

            // Add the new CipherSuites in order of priority
            int cipherCount = 0;

            foreach (CipherSuiteItem cipherSuiteItem in _mySettings.CipherSuites.ItemList)
            {
                if (cipherSuiteItem.IsChecked)
                {
                    scu.SetTlsCipherSuiteByIndex(cipherCount, cipherSuiteItem.Cipher);
                    cipherCount++;
                }
            }
        }
Exemple #11
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                Globals._closing = true;

                foreach (UserControl page in _pages)
                {
                    page.Dispose();
                }

                DicomNet.Shutdown();
                SaveSettings();
            }
            catch (Exception)
            {
            }
        }
Exemple #12
0
 public static void Log
 (
     DicomNet client,
     DicomCommandType command,
     LogType logType,
     MessageDirection direction,
     DicomDataSet dataSet,
     string description
 )
 {
     Log(client.IsAssociated( ) ? client.Association.Calling : string.Empty,
         client.HostAddress,
         client.HostPort,
         command,
         logType,
         direction,
         dataSet,
         description);
 }
Exemple #13
0
 protected override void OnClose(DicomExceptionCode error, DicomNet net)
 {
     base.OnClose(error, net);
 }
Exemple #14
0
 protected override void OnClose(DicomExceptionCode error, DicomNet net)
 {
     _mainForm.LogText("Server Closed Connection", string.Empty);
     base.OnClose(error, net);
 }
Exemple #15
0
 public DICOMJob(DICOMJobSettings js)
 {
     Settings = js;
     DicomEngine.Startup();
     DicomNet.Startup();
 }
Exemple #16
0
        static void Startup()
        {
            try
            {
                SupportLock.Unlock();
                DicomEngine.Startup();
                DicomNet.Startup();

                //chance for any override
                ServiceUtils.RegisterInterfaces();

                LoadTimeStamp();
                //Debug.WriteLine("lt: " + (_timeStamp.HasValue? _timeStamp.ToString():"none"));
                //PACS client settings
                {
                    //the client AE/IP/port used for connecting to remote PACS for query
                    _clientConnection.AETitle = ConfigurationManager.AppSettings.Get("ClientAe");
                    if (string.IsNullOrEmpty(_clientConnection.AETitle))
                    {
                        _clientConnection.AETitle = "LTCLIENT19";
                    }
                    _clientConnection.IPAddress = ConfigurationManager.AppSettings.Get("ClientIP");
                    if (string.IsNullOrEmpty(_clientConnection.IPAddress))
                    {
                        _clientConnection.IPAddress = ServiceUtils.GetLocalIPAddressesV4();
                    }

                    _clientConnection.Port = ServiceUtils.ToInt(ConfigurationManager.AppSettings.Get("ClientPort"), ServiceUtils.GetFreeIPPort());
                }

                //Storage server settings
                {
                    //the path for the local storage server service, used by the store add-in to read the server configuration
                    _storageServerServicePath = ConfigurationManager.AppSettings.Get("storageServerServicePath");
                    _storageServerServicePath = ServiceUtils.MapConfigPath(_storageServerServicePath);

                    _storageServerConnection.AETitle   = ConfigurationManager.AppSettings.Get("ServerAe");
                    _storageServerConnection.IPAddress = ConfigurationManager.AppSettings.Get("ServerIP");
                    _storageServerConnection.Port      = ServiceUtils.ToInt(ConfigurationManager.AppSettings.Get("ServerPort"), -1);

                    //read default storage server dicom connection settings
                    if (!string.IsNullOrEmpty(_storageServerServicePath) &&
                        (string.IsNullOrEmpty(_storageServerConnection.AETitle) ||
                         string.IsNullOrEmpty(_storageServerConnection.IPAddress) ||
                         _storageServerConnection.Port <= 0))
                    {
                        try
                        {
                            var settingsFile = Path.Combine(_storageServerServicePath, "settings.xml");
                            var doc          = XDocument.Load(settingsFile);
                            {
                                _storageServerConnection.Port      = ServiceUtils.ToInt(doc.Descendants("Port").First().Value, -1);
                                _storageServerConnection.IPAddress = doc.Descendants("IpAddress").First().Value;
                                _storageServerConnection.AETitle   = doc.Descendants("AETitle").First().Value;
                            }
                        }
                        catch
                        {
                        }
                    }

                    if (string.IsNullOrEmpty(_storageServerConnection.AETitle))
                    {
                        _storageServerConnection.AETitle = "LTSTORAGESERVER";
                    }
                }

                //read static settings
                {
                    //the path for storing the annotations files (not used anymore)
                    _annotationsPath = ConfigurationManager.AppSettings.Get("AnnotationsPath");

                    if (string.IsNullOrEmpty(_annotationsPath))
                    {
                        _annotationsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Annotations");
                    }
                }

                //initialize external storage
                ExternalStorage.Startup();
            }
            catch (Exception ex)
            {
                ServiceUtils.Log(ex.ToString());
                throw new ServiceException("Failed to startup: " + ex.Message, HttpStatusCode.InternalServerError);
            }

            //caching workers
            LTCachingCtrl.QeueuWorkers();
        }
Exemple #17
0
        private void cstore_Status(object sender, StatusEventArgs e)
        {
            string message = "";
            bool   done    = false;

            if (e.Type == StatusType.Error)
            {
                message = "DICOM error. The process will be terminated! -- Error code is: " + e.Error.ToString();
            }
            else
            {
                switch (e.Type)
                {
                case StatusType.ConnectFailed:
                    message = "Connect operation failed.";
                    done    = true;
                    break;

                case StatusType.ConnectSucceeded:
                    message  = "Connected successfully.\n";
                    message += "\tPeer Address:\t" + e.PeerIP.ToString() + "\n";
                    message += "\tPeer Port:\t\t" + e.PeerPort.ToString();
                    break;

                case StatusType.SendAssociateRequest:
                    message = "Sending association request...";
                    break;

                case StatusType.ReceiveAssociateAccept:
                    message  = "Received Associate Accept.\n";
                    message += "\tCalling AE:\t" + e.CallingAE + "\n";
                    message += "\tCalled AE:\t" + e.CalledAE;
                    break;

                case StatusType.ReceiveAssociateReject:
                    message  = "Received Associate Reject!";
                    message += "\tResult: " + e.Result.ToString();
                    message += "\tReason: " + e.Reason.ToString();
                    message += "\tSource: " + e.Source.ToString();
                    break;

                case StatusType.AbstractSyntaxNotSupported:
                    message = "Abstract Syntax NOT supported!";
                    break;

                case StatusType.SendCStoreRequest:
                    message = "Sending C-STORE Request...";
                    break;

                case StatusType.ReceiveCStoreResponse:
                    if (e.Error == DicomExceptionCode.Success)
                    {
                        message = "**** Storage completed successfully ****";
                    }
                    else
                    {
                        message = "**** Storage failed with status: " + e.Status.ToString();
                    }
                    break;

                case StatusType.ConnectionClosed:
                    message = "Network Connection closed!";
                    done    = true;
                    break;

                case StatusType.ProcessTerminated:
                    message = "Process has been terminated!";
                    done    = true;
                    break;

                case StatusType.SendReleaseRequest:
                    message = "Sending release request...";
                    break;

                case StatusType.ReceiveReleaseResponse:
                    message = "Receiving release response";
                    done    = true;
                    break;

                case StatusType.Timeout:
                    message = "Communication timeout. Process will be terminated.";
                    done    = true;
                    break;

                case StatusType.SecureLinkReady:
                {
                    DicomNet net = sender as DicomNet;
                    if (net != null)
                    {
                        DicomTlsCipherSuiteType cipher = net.GetTlsCipherSuite();
                        if (e.Error == DicomExceptionCode.Success)
                        {
                            message = string.Format("\n\tSecure Link Ready\n\tCipher Suite: {0}", cipher.GetCipherFriendlyName());
                        }
                        else
                        {
                            message =
                                "\n\t" + "Secure Link Failed" +
                                "\n\t" + "Error:\t" + e.Error.ToString();
                        }
                    }
                }
                break;
                }
            }
            LogText(message);
            if (done)
            {
                EnableFileMenu(true);

                if (cstore.IsConnected())
                {
                    cstore.Close();
                }
            }
        }
Exemple #18
0
        static int Main(string[] args)
        {
#if LEADTOOLS_V19_OR_LATER
            if (!Support.SetLicense())
            {
                return(0);
            }
#else
            Support.SetLicense();
            if (RasterSupport.KernelExpired)
            {
                return(0);
            }
#endif

            Mutex m;
            if (DemosGlobal.MustRestartElevated())
            {
                DemosGlobal.TryRestartElevated(args);
                return(0);
            }
#if !FOR_DOTNET4
            bool dotNet35Installed = DemosGlobal.IsDotNet35Installed();
            if (!dotNet35Installed)
            {
                return(0);
            }
#endif

            bool ok;

#if LEADTOOLS_V175_OR_LATER
            m = new Mutex(true, "LEADTOOLS_V175_OR_LATER", out ok);

            if (!ok)
            {
                return(1);
            }
#else
            SingleInstanceController controller;
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);



#if LEADTOOLS_V175_OR_LATER
            if (RasterSupport.IsLocked(RasterSupportType.DicomCommunication))
#else
            if (RasterSupport.IsLocked(RasterSupportType.MedicalNet))
#endif
            {
                MessageBox.Show("Support for LEADTOOLS PACS Module is locked!\nServer Manager cannot run!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(-1);
            }

#if (LEADTOOLS_V20_OR_LATER)
            if (DemosGlobal.IsDotNet45OrLaterInstalled() == false)
            {
                MessageBox.Show("To run this application, you must first install Microsoft .NET Framework 4.5 or later.",
                                "Microsoft .NET Framework 4.5 or later Required",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return(-1);
            }
#endif

            {
                string   message         = string.Empty;
                string[] productsToCheck = new string[] { DicomDemoSettingsManager.ProductNameStorageServer };
                bool     dbConfigured    = GlobalPacsUpdater.IsDbComponentsConfigured(productsToCheck, out message);

                if (!dbConfigured &&
                    !RequestUserToConfigureDbSucess(message))
                {
                    return(-1);
                }

                if (!GlobalPacsUpdater.IsProductDatabaseUpTodate(DicomDemoSettingsManager.ProductNameDemoServer) &&
                    !RequestUserToUpgradeDbSucess())
                {
                    return(-1);
                }

                if (!ok)
                {
                    return(-1);
                }
            }


            BaseDir = Path.GetFullPath(GetWorkingDirectory()).ToLower();
            DicomEngine.Startup();
            DicomNet.Startup();
#if !LEADTOOLS_V175_OR_LATER
            controller = new SingleInstanceController();
            controller.Run(Environment.GetCommandLineArgs());
#else
            try
            {
                Application.Run(new MainForm());
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show("File not found exception.\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
#endif
            DicomNet.Shutdown();
            DicomEngine.Shutdown();
#if LEADTOOLS_V175_OR_LATER
            GC.KeepAlive(m);
#endif
            return(0);
        }
Exemple #19
0
 public static void DicomNetShutdown( )
 {
     DicomNet.Shutdown();
 }
Exemple #20
0
 public static void DicomNetStartup( )
 {
     DicomNet.Startup();
 }
Exemple #21
0
        private void SendCopy(AutoCopyItem item)
        {
            AeInfoExtended[] aes   = _aeManagementAgent.GetRelatedAeTitles(item.SourceAE, Module.AUTOCOPY_RELATION);
            StoreScu         store = new StoreScu();

            Module.InitializeDicomSecurity(false);
            StoreScu storeSecure = null;

            DicomOpenSslVersion dicomOpenSslVersion = DicomNet.GetOpenSslVersion();

            if (dicomOpenSslVersion.IsAvailable)
            {
                storeSecure = new StoreScu(Module._Server.TemporaryDirectory, DicomNetSecurityMode.Tls, Module._openSslOptions);
                Module.SetCiphers(storeSecure);
            }

            DicomScp scp = null;

            string[] sopInstances = item.Datasets.ToArray();

            if (aes == null || aes.Length == 0)
            {
                return;
            }

            string clientAe = Module.Options.UseCustomAE ? Module.Options.AutoCopyAE : item.ClientAE;

            AddEventHandlers(store, clientAe);
            AddEventHandlers(storeSecure, clientAe);

            foreach (AeInfoExtended ae in aes)
            {
#if LEADTOOLS_V20_OR_LATER
                // Update dbo.AeInfo.LastAccessDate to Date.Now
                ae.LastAccessDate = DateTime.Now;
                _aeManagementAgent.Update(ae.AETitle, ae);
#endif

                bool useTls = ae.ClientPortUsage == ClientPortUsageType.Secure || ((ae.ClientPortUsage == ClientPortUsageType.SameAsServer) && (Module._Server.Secure));
                useTls = (useTls && dicomOpenSslVersion.IsAvailable);

                foreach (string sopInstance in sopInstances)
                {
                    MatchingParameterCollection mpc = new MatchingParameterCollection();
                    MatchingParameterList       mpl = new MatchingParameterList();

                    ICatalogEntity instanceEntity = RegisteredEntities.GetInstanceEntity(sopInstance);
                    mpl.Add(instanceEntity);
                    mpc.Add(mpl);

                    DataSet instanceData = _StorageAgent.QueryCompositeInstances(mpc);
                    // if (instanceData.Instance.Rows.Count == 1)
                    if (instanceData.Tables[DataTableHelper.InstanceTableName].Rows.Count == 1)
                    {
                        // string file = instanceData.Instance[0].ReferencedFile;
                        DataRow instanceRow = instanceData.Tables[DataTableHelper.InstanceTableName].Rows[0];
                        string  file        = RegisteredDataRows.InstanceInfo.ReferencedFile(instanceRow);

                        scp = new DicomScp(IPAddress.Parse(ae.Address), ae.AETitle, ae.Port);
                        try
                        {
                            if (useTls)
                            {
                                storeSecure.Store(scp, file);
                            }
                            else
                            {
                                store.Store(scp, file);
                            }
                        }
                        catch (ClientAssociationException ce)
                        {
                            string message = string.Format("[Auto Copy] Failed to establish association with server: {0}.", ce.Reason);

                            LogEvent(LogType.Error, MessageDirection.None, message, DicomCommandType.Undefined, null, store, null);
                        }
                        catch (DicomException de)
                        {
                            string message = string.Format("[Auto Copy] Error: {0}.", de.Message);

                            LogEvent(LogType.Error, MessageDirection.Input, message, DicomCommandType.Undefined, null, store, null);
                        }
                        catch (Exception e)
                        {
                            string message = "[Auto Copy] " + e.Message;

                            Logger.Global.Log(string.Empty, string.Empty, -1, string.Empty, string.Empty, -1, DicomCommandType.Undefined,
                                              DateTime.Now, LogType.Error, MessageDirection.None, message, null, null);
                        }
                    }
                }
            }

            RemoveEventHandlers(store);
            RemoveEventHandlers(storeSecure);

            foreach (string sopInstance in sopInstances)
            {
                item.Datasets.Remove(sopInstance);
            }
        }
Exemple #22
0
        //called once for the lifetime of the app domain
        protected void Application_Start()
        {
            AppDomainException = null;

            GlobalConfiguration.Configure(WebApiConfig.Register);

            //allow xml serialization
            //GlobalConfiguration.Configuration.Formatters.XmlFormatter.UseXmlSerializer = true;

            // ServicePointManager setup
            ServicePointManager.UseNagleAlgorithm      = false;
            ServicePointManager.Expect100Continue      = false;
            ServicePointManager.DefaultConnectionLimit = int.MaxValue;
            ServicePointManager.EnableDnsRoundRobin    = true;
            //ServicePointManager.ReusePort = true;

            try
            {
                //initialize
                SupportLock.SetLicense();
                DicomEngine.Startup();
                DicomNet.Startup();

                //Unity dependency injection container
                var unity = new UnityContainer();

                //register types

                //controllers that should be injectable
                unity.RegisterType <AuthController>();
                unity.RegisterType <AuditController>();
                unity.RegisterType <TemplateController>();
                unity.RegisterType <StoreController>();
                unity.RegisterType <PatientController>();
                unity.RegisterType <PatientAccessRightsController>();
                unity.RegisterType <PACSRetrieveController>();
                unity.RegisterType <PacsQueryController>();
                unity.RegisterType <OptionsController>();
                unity.RegisterType <MonitorCalibrationController>();
                unity.RegisterType <ExportController>();
                unity.RegisterType <RetrieveController>();
                unity.RegisterType <QueryController>();
                unity.RegisterType <ThreeDController>();
                unity.RegisterType <AutoController>();

                //injectable types
                unity.RegisterType <AddinsFactory>();

                //injectable types/base
                unity.RegisterType <IAuthHandler, AuthHandler>();
                unity.RegisterType <IAuditHandler, AuditHandler>();
                unity.RegisterType <ITemplateHandler, TemplateHandler>();
                unity.RegisterType <IStoreHandler, StoreHandler>();
                unity.RegisterType <IPatientHandler, PatientHandler>();
                unity.RegisterType <IPatientAccessRightsHandler, PatientAccessRightsHandler>();

                unity.RegisterType <IOptionsHandler, OptionsHandler>();
                unity.RegisterType <IMonitorCalibrationHandler, MonitorCalibrationHandler>();
                //unity.RegisterType<IStreamExportHandler, StreamExportHandler>();
                unity.RegisterType <IHashingProvider, HashingProvider>();
                unity.RegisterType <IExportHandler, ExportHandler>();

                unity.RegisterType <IRetrieveHandler, RetrieveHandler>("local");
                unity.RegisterType <IRetrieveHandler, WadoRetrieveHandler>("wado");

                unity.RegisterType <IQueryHandler, QueryHandler>("local");
                unity.RegisterType <IQueryHandler, WadoQueryHandler>("wado");
                unity.RegisterType <IThreeDHandler, ThreeDHandler>();

                unity.RegisterType <IPacsQueryHandler, PacsQueryHandler>("pacsquery");
                unity.RegisterType <IPacsQueryHandler, WadoAsPacsQueryHandler>("wadoaspacsquery");

                unity.RegisterType <IPacsRetrieveHandler, PacsRetrieveHandler>("pacsretrieve");
                unity.RegisterType <IPacsRetrieveHandler, WadoAsPacsRetrieveHandler>("wadoaspacsretrieve");

                unity.RegisterType <IAutoHandler, AutoHandler>();

                {
                    //register singletons
                    CreateSingletons();

                    unity.RegisterInstance <Lazy <IMessagesBus> >(_messageBus, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <IStorageDataAccessAgent3> >(_storageAgent, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <ILoggingDataAccessAgent> >(_loggingAgent, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <IUserManagementDataAccessAgent4> >(_userManagementDataAccessAgent, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <IPermissionManagementDataAccessAgent2> >(_permissionManagementDataAccessAgent, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <IOptionsDataAccessAgent> >(_optionsDataAccessAgent, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <IPatientRightsDataAccessAgent> >(_patientRightsDataAccess, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <IDownloadJobsDataAccessAgent> >(_downloadJobsDataAccessAgent, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <IAuthorizedStorageDataAccessAgent2> >(_authorizedStorageDataAccessAgent, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <IMonitorCalibrationDataAccessAgent> >(_monitorCalibrationDataAccessAgent, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <ITemplateDataAccessAgent> >(_templateDataAccessAgent, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <IExternalStoreDataAccessAgent> >(_externalStoreAgent, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <Leadtools.Dicom.Imaging.IDataCacheProvider> >(_dataCache, new ExternallyControlledLifetimeManager());
                    unity.RegisterInstance <Lazy <ConnectionSettings> >(_connectionSettings, new ExternallyControlledLifetimeManager());
                }

                //set default dependency resolver to Unity (with the wrapper)
                GlobalConfiguration.Configuration.DependencyResolver = new IoCContainer(unity);

                //caching workers
                LTCachingCtrl.QeueuWorkers();
            }
            catch (ServiceSetupException ex)
            {
                AppDomainException = ex;
                //handle on first request
            }
            catch (Exception)
            {
                HttpRuntime.UnloadAppDomain();
                throw;
            }
        }
Exemple #23
0
 protected DICOMJob()
 {
     Settings = null;
     DicomEngine.Startup();
     DicomNet.Startup();
 }