Example #1
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);
            }
        }
Example #2
0
 public DICOMJob(DICOMJobSettings js)
 {
     Settings = js;
     DicomEngine.Startup();
     DicomNet.Startup();
 }
Example #3
0
 protected DICOMJob()
 {
     Settings = null;
     DicomEngine.Startup();
     DicomNet.Startup();
 }
Example #4
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;
            }
        }
Example #5
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);
        }
Example #6
0
 public static void DicomNetStartup( )
 {
     DicomNet.Startup();
 }
Example #7
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();
        }