Exemplo n.º 1
0
        public static bool AddDicomServiceNameToGlobalPacsConfig()
        {
            bool success = true;

            try
            {
                OptionsDataAccessConfigurationView optionsConfigView = new OptionsDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsConfiguration(), DicomDemoSettingsManager.ProductNameStorageServer, null);
                IOptionsDataAccessAgent            optionsAgent      = DataAccessFactory.GetInstance(optionsConfigView).CreateDataAccessAgent <IOptionsDataAccessAgent>();
                if (optionsAgent != null)
                {
                    StorageServerInformation serverInfo = null;
                    string name = typeof(StorageServerInformation).Name;

                    if (optionsAgent.OptionExits(name))
                    {
                        serverInfo = optionsAgent.Get <StorageServerInformation>(name, null, new Type[0]);
                        if (serverInfo != null && !string.IsNullOrEmpty(serverInfo.ServiceName))
                        {
                            GlobalPacsUpdater.ModifyGlobalPacsConfiguration(DicomDemoSettingsManager.ProductNameStorageServer, serverInfo.ServiceName, GlobalPacsUpdater.ModifyConfigurationType.Add);
                        }
                    }
                }
            }
            catch (Exception)
            {
                success = false;
            }
            return(success);
        }
Exemplo n.º 2
0
        private static bool RequestUserToUpgradeDbSucess()
        {
            string       message;
            DialogResult result;
            string       Caption = "Upgrade Notice";

            message = "The Worklist database needs to be upgraded.\n\n" +
                      "Do you want to upgrade the database now?";

            result = MessageBox.Show(message,
                                     Caption,
                                     MessageBoxButtons.YesNo,
                                     MessageBoxIcon.Warning);

            if (DialogResult.Yes == result)
            {
                GlobalPacsUpdater.UpgradeProductDatabase(DicomDemoSettingsManager.ProductNameDemoServer);

                if (GlobalPacsUpdater.IsProductDatabaseUpTodate(DicomDemoSettingsManager.ProductNameDemoServer))
                {
                    MessageBox.Show("Database upgraded successfully",
                                    Caption,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);

                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 3
0
        public static bool IsDataAccessSettingsValid()
        {
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();

            WorklistDataAccessConfigurationView view = new WorklistDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameDemoServer, null);

            ConfigurationManager.RefreshSection(view.DataAccessSettingsSectionName);

            return(GlobalPacsUpdater.IsDataAccessSettingsValid(configuration, view.DataAccessSettingsSectionName, DicomDemoSettingsManager.ProductNameDemoServer));
        }
Exemplo n.º 4
0
        public static void RemoveGlobalPacsConfig()
        {
            string globalPacsConfigPath       = DicomDemoSettingsManager.GlobalPacsConfigFullFileName;
            string backupGlobalPacsConfigPath = GlobalPacsUpdater.BackupFile(globalPacsConfigPath);

            try
            {
                if (File.Exists(globalPacsConfigPath))
                {
                    File.Delete(globalPacsConfigPath);
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 5
0
        void View_DeleteServer(object sender, EventArgs e)
        {
            if (null != ServerState.Instance.ServerService)
            {
                using (ConfirmWithReasonDialog confirmDlg = new ConfirmWithReasonDialog())
                {
                    confirmDlg.Text = "Confirm Delete";

                    confirmDlg.Message = string.Format("Are you sure you want to delete {0}?\n\nType the reason for deleting {0}.", ServerState.Instance.ServerService.Settings.AETitle);

                    confirmDlg.ConfirmIcon = Resources.Warning_128;

                    confirmDlg.ConfirmCheckBoxVisible = false;

                    if (confirmDlg.ShowDialog(View) != DialogResult.OK)
                    {
                        return;
                    }


                    string serviceName    = ServerState.Instance.ServerService.ServiceName;
                    string additionalInfo = string.Format("\n\nReason for deleting: {0}", confirmDlg.Reason);

                    GlobalPacsUpdater.ModifyGlobalPacsConfiguration(DicomDemoSettingsManager.ProductNameStorageServer, serviceName, GlobalPacsUpdater.ModifyConfigurationType.Remove);

#if (LEADTOOLS_V19_OR_LATER_MEDICAL_VERIFY_ADDINS) || (LEADTOOLS_V19_OR_LATER)
                    ServerState.Instance.ServerService.Message -= new EventHandler <MessageEventArgs>(Shell.ServerService_Message);
#endif
                    ServerState.Instance.ServiceAdmin.UnInstallService(ServerState.Instance.ServerService);

                    ServerState.Instance.ServerService.Dispose();

                    StorageModuleConfigurationManager sotrageConfigManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager>();
                    LoggingModuleConfigurationManager loggingConfigManager = ServiceLocator.Retrieve <LoggingModuleConfigurationManager>();

                    sotrageConfigManager.Unload();
                    loggingConfigManager.Unload();

                    ServerState.Instance.ServerService = null;

                    LocalAuditLogQueue.AddAuditMessage(AuditMessages.ServerServiceDeleted.Key,
                                                       string.Format(AuditMessages.ServerServiceDeleted.Message, serviceName) + additionalInfo);
                }
            }
        }
Exemplo n.º 6
0
        private static bool UpgradeConfigFiles()
        {
#if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER)
            string exeName = Path.GetFileNameWithoutExtension(Application.ExecutablePath);
            string globalPacsConfigPath       = DicomDemoSettingsManager.GlobalPacsConfigFullFileName;
            string backupGlobalPacsConfigPath = string.Empty;

            // Upgrade GlobalPacs.Config if necessary

            bool bNeedsUpdateExternalStore = GlobalPacsUpdater.AddExternalStoreToGlobalPacsConfig(globalPacsConfigPath, false);
            bool bNeedsUpdate = bNeedsUpdateExternalStore;


#if (LEADTOOLS_V20_OR_LATER)
            bool bNeedsUpdateExportLayout = GlobalPacsUpdater.AddExportLayoutToGlobalPacsConfig(globalPacsConfigPath, false);
            bNeedsUpdate = bNeedsUpdate | bNeedsUpdateExportLayout;
#endif
            if (bNeedsUpdate)
            {
                string       msg = string.Format("The existing globalPacs.config must be upgraded\n\nDo you want to continue?", exeName);
                DialogResult dr  = MessageBox.Show(msg, "Upgrade Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dr != DialogResult.Yes)
                {
                    return(false);
                }

                backupGlobalPacsConfigPath = GlobalPacsUpdater.BackupFile(globalPacsConfigPath);

                if (bNeedsUpdateExternalStore)
                {
                    GlobalPacsUpdater.AddExternalStoreToGlobalPacsConfig(globalPacsConfigPath, true);
                }
            }
#endif // #if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER)

#if (LEADTOOLS_V20_OR_LATER)
            if (bNeedsUpdateExportLayout)
            {
                GlobalPacsUpdater.AddExportLayoutToGlobalPacsConfig(globalPacsConfigPath, true);
            }
#endif // (LEADTOOLS_V20_OR_LATER)
            return(true);
        }
        public DicomService InstallWorkstationService(ServerSettings settings, string [] addInsDlls, string [] configurationAddInsDlls)
        {
            if (WorkstationService != null)
            {
                throw new InvalidOperationException("Workstation Service already installed.");
            }

            CreateServiceAdmin(settings.AETitle);

            DicomService service;


            InstallAddIns(addInsDlls, settings.AETitle);

            InstallConfigurationAddIns(configurationAddInsDlls, settings.AETitle);

            GlobalPacsUpdater.ModifyGlobalPacsConfiguration(DicomDemoSettingsManager.ProductNameWorkstation, settings.AETitle, GlobalPacsUpdater.ModifyConfigurationType.Add);

            service = ServiceAdmin.InstallService(settings);

            WorkstationService = service;

            return(service);
        }
        static int Main(string[] args)
        {
            if (!DicomDemoSettingsManager.Is64Process())
            {
                _demoName = "LEADTOOLS PACS Configuration Demo  (32 bit)";
            }
            else
            {
                _demoName = "LEADTOOLS PACS Configuration Demo  (64 bit)";
            }

            if (DemosGlobal.MustRestartElevated())
            {
                DemosGlobal.TryRestartElevated(args);
                return(0);
            }

            ReadCommandLine(args);
            MySettings mySettings = new MySettings();

            if (_bInitialize)
            {
#if !FOR_DOTNET4
                if (false == DemosGlobal.IsDotNet35Installed())
                {
                    return(0);
                }
#endif

                MyUtils.RemoveConfigurationFiles();
                MyUtils.RemoveGlobalPacsConfig();
                mySettings.Save();
                return(0);
            }

            bool showUI = !_bUninstall && !_bInitialize;

#if !FOR_DOTNET4
            bool dotNet35Installed = DemosGlobal.IsDotNet35Installed();
            if (showUI && !dotNet35Installed)
            {
                Messager.ShowWarning(null, ".NET Framework 3.5 could not be found on this machine.\n\nPlease install the .NET Framework 3.5 runtime and try again. This program will now exit.");
            }
            if (!dotNet35Installed)
            {
                return(0);
            }
#endif

            mySettings.Load();

#if LEADTOOLS_V19_OR_LATER
            if (showUI)
            {
                if (!Support.SetLicense())
                {
                    return(-1);
                }
            }
#endif

            // If calling with the /uninstall flag, do not display the nag message
            if (_bUninstall == false)
            {
                if (RasterSupport.KernelExpired)
                {
                    return(-1);
                }
            }

#if LEADTOOLS_V175_OR_LATER
            if (showUI)
            {
                if (RasterSupport.IsLocked(RasterSupportType.DicomCommunication))
                {
                    MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.DicomCommunication.ToString()), "Warning");
                    return(-1);
                }
            }
#else
            if (RasterSupport.IsLocked(RasterSupportType.MedicalNet))
            {
                MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.MedicalNet.ToString()), "Warning");
                return(-1);
            }

            if (RasterSupport.IsLocked(RasterSupportType.MedicalServer))
            {
                MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.MedicalServer.ToString()), "Warning");
                return(-1);
            }
#endif

            //_admin = new ServiceAdministrator(_baseDir);
            //_admin.Unlock(Support.MedicalServerKey);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

#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

            //Utils.EngineStartup();
            DicomEngine.Startup();

            if (_bUninstall)
            {
                try
                {
                    using (ServiceAdministrator serviceAdmin = CreateServiceAdministrator())
                    {
                        MyUtils.UninstallAllDicomServersSilent(serviceAdmin);
                        MyUtils.RemoveConfigurationFiles();
                    }
                }
                catch (Exception)
                {
                }
            }
            else
            {
                string       missingDbComponents;
                DialogResult result = DialogResult.Yes;
                Messager.Caption = _demoName;
                string platform = "32-bit";
                if (DicomDemoSettingsManager.Is64Process())
                {
                    platform = "64-bit";
                }

                string [] productsToCheck = new string[] { DicomDemoSettingsManager.ProductNameDemoServer, DicomDemoSettingsManager.ProductNameWorkstation, DicomDemoSettingsManager.ProductNameStorageServer };

                bool isDbConfigured = GlobalPacsUpdater.IsDbComponentsConfigured(productsToCheck, out missingDbComponents);
                if (!isDbConfigured) // databases not configured
                {
                    string message = "The following databases are not configured:\n\n{0}\nRun the {1} CSPacsDatabaseConfigurationDemo to configure the missing databases then run this demo again.\n\nDo you want to run the {2} CSPacsDatabaseConfigurationDemo wizard now?";
                    message = string.Format(message, missingDbComponents, platform, platform);

                    result = Messager.ShowQuestion(null, message, MessageBoxButtons.YesNo);
                    if (DialogResult.Yes == result)
                    {
                        RunDatabaseConfigurationDemo();
                    }
                }

                mySettings._settings.FirstRun = false;
                mySettings.Save();

                // Add event handler for handling UI thread exceptions to the event
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

                // Set the unhandled exception mode to force all Windows Forms errors to go through our handler.
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

                // Add the event handler for handling non-UI thread exceptions to the event.
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                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);
                }
            }
            DicomEngine.Shutdown();
            return(0);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        private static bool RequestUserToConfigureDbSucess(string missingDbComponents)
        {
            string       message;
            DialogResult result;
            string       Caption = "Warning";

            string pacsDatabaseConfigDemoFileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), PacsDatabaseConfigurationDemoNames[0]);

            if (!File.Exists(pacsDatabaseConfigDemoFileName) && PacsDatabaseConfigurationDemoNames.Length > 1)
            {
                pacsDatabaseConfigDemoFileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), PacsDatabaseConfigurationDemoNames[1]);
            }

            message = "The following databases are not configured:\n\n{0}\nRun the " +
                      PacsDatabaseConfigurationDemoNames[0] + " to configure the missing databases.\n\n" +
                      "Do you want to run the " + PacsDatabaseConfigurationDemoNames[0] + " wizard now?";

            message = string.Format(message, missingDbComponents);

            result = MessageBox.Show(message,
                                     Caption,
                                     MessageBoxButtons.YesNo,
                                     MessageBoxIcon.Warning);

            if (DialogResult.Yes == result)
            {
                if (File.Exists(pacsDatabaseConfigDemoFileName))
                {
                    Process dbConfigProcess;


                    dbConfigProcess = new Process();
                    dbConfigProcess.StartInfo.FileName = pacsDatabaseConfigDemoFileName;

                    dbConfigProcess.Start();

                    dbConfigProcess.WaitForExit();

                    string[] productsToCheck = new string[] { DicomDemoSettingsManager.ProductNameStorageServer };

                    bool isDbConfigured = GlobalPacsUpdater.IsDbComponentsConfigured(productsToCheck, out missingDbComponents);

                    if (!isDbConfigured)
                    {
                        MessageBox.Show("Database is not configured.",
                                        Caption,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);


                        return(false);
                    }
                }
                else
                {
                    MessageBox.Show("Could not find the " + PacsDatabaseConfigurationDemoNames[0] + " wizard",
                                    Caption,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);

                    return(false);
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 11
0
 public static bool IsDatabaseUpToDate( )
 {
     return(GlobalPacsUpdater.IsProductDatabaseUpTodate(DicomDemoSettingsManager.ProductNameStorageServer));
 }
Exemplo n.º 12
0
        /// <summary>
        /// Checks if the Storage server DB is configured/created
        /// </summary>
        /// <returns></returns>
        public static bool IsDatabaseConfigured( )
        {
            string missingDb;

            return(GlobalPacsUpdater.IsDbComponentsConfigured(new string [] { DicomDemoSettingsManager.ProductNameStorageServer }, out missingDb));
        }
Exemplo n.º 13
0
        void View_AddServer(object sender, EventArgs e)
        {
            ServerSettings settings;
            DicomService   service;

            if (null == ServerState.Instance.ServiceAdmin)
            {
                CreateServiceAdmin(ServerState.Instance.ServiceName);
            }

            settings = new ServerSettings( );

            UpdateServerSettings(settings);

            string[] addIns = GetAddIns();
            //string [] addIns =  new string [] {
            //   "Leadtools.Medical.AutoCopy.AddIn.dll",
            //   "Leadtools.Medical.PatientUpdater.AddIn.dll",
            //   "Leadtools.Medical.Storage.Addins.dll",
            //   "Leadtools.Medical.Forwarder.AddIn.dll",
            //};

            string[] configurationAddIns = GetConfigurationAddIns();
            //string[] configurationAddIns = new string[] {
            //   "Leadtools.Medical.Ae.Configuration.dll",
            //   "Leadtools.Medical.Logging.Addin.dll",
            //   "Leadtools.Medical.License.Configuration.dll",
            //};

            InstallAddIns(addIns, configurationAddIns, settings.AETitle);

            // Delete the advanced.config if it exsists
            // It might be left over from a previous uninstall
            string configLocation = Path.Combine(Path.Combine(ServerState.Instance.ServiceAdmin.BaseDirectory, settings.AETitle), "advanced.config");

            try
            {
                if (File.Exists(configLocation))
                {
                    File.Delete(configLocation);
                }
            }
            catch (Exception)
            {
            }

            service = ServerState.Instance.ServiceAdmin.InstallService(settings);

            StorageModuleConfigurationManager sotrageConfigManager = ServiceLocator.Retrieve <StorageModuleConfigurationManager> ( );
            LoggingModuleConfigurationManager loggingConfigManager = ServiceLocator.Retrieve <LoggingModuleConfigurationManager> ( );

            sotrageConfigManager.Load(service.ServiceDirectory);
            loggingConfigManager.Load(service.ServiceDirectory);

            ServerState.Instance.ServerService = service;

#if (LEADTOOLS_V19_OR_LATER_MEDICAL_VERIFY_ADDINS) || (LEADTOOLS_V19_OR_LATER)
            ServerState.Instance.ServerService.Message += new EventHandler <MessageEventArgs>(Shell.ServerService_Message);
#endif
            InitializeStorageAddinsSettings();

            AddConfigAssemblies(service.ServiceDirectory, "Leadtools.Medical.Logging.Addin.dll");
            GlobalPacsUpdater.ModifyGlobalPacsConfiguration(DicomDemoSettingsManager.ProductNameStorageServer, settings.AETitle, GlobalPacsUpdater.ModifyConfigurationType.Add);

            LocalAuditLogQueue.AddAuditMessage(AuditMessages.ServerServiceCreated.Key,
                                               string.Format(AuditMessages.ServerServiceCreated.Message, service.ServiceName, service.Settings.AETitle, service.Settings.IpAddress, service.Settings.Port));
        }
Exemplo n.º 14
0
        static void Main()
        {
            // Still want to let this application run with an expired license (as this is an enterprise level application), but in very a limited mode
            // For example, the user should be able to view the log
            //Support.SetLicense();
            //if (Support.KernelExpired)
            //   return;
            InitializeLicense();

            if (ProcessChecker.IsOnlyProcess(Shell.storageServerName))
            {
#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;
                }
#endif
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                PacsProduct.ProductName = DicomDemoSettingsManager.ProductNameStorageServer;

                bool ok;

                string exeName = Path.GetFileNameWithoutExtension(Application.ExecutablePath);

                if (Demos.DemosGlobal.Is64Process( ))
                {
                    exeName += "64";
                }
                else
                {
                    exeName += "32";
                }

                Mutex m = new Mutex(true, exeName, out ok);

#if !TUTORIAL_CUSTOM_DATABASE && !LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE
                CheckPacsConfigDemo();
#endif

                string globalPacsConfigPath = DicomDemoSettingsManager.GlobalPacsConfigFullFileName;
                if (File.Exists(globalPacsConfigPath))
                {
                    try
                    {
                        if (false == UpgradeConfigFiles())
                        {
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        string msg = string.Format("Upgrade Failed!\n\n{0}", ex.Message);
                        MessageBox.Show(msg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

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

#if TUTORIAL_CUSTOM_DATABASE
                    // When manually configuring the storage server to use a different database schema, the helper funciton 'IsDbComponentsConfigured'
                    // will incorrectly detect that the database has not been configured.  In this case, set 'dbConfigured' to true.
                    // For more details, see the "Changing the LEAD Medical Storage Server to use a different database schema" tutorial.
                    dbConfigured = true;
#endif

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


#if !TUTORIAL_CUSTOM_DATABASE
                    if (!GlobalPacsUpdater.IsProductDatabaseUpTodate(DicomDemoSettingsManager.ProductNameStorageServer) &&
                        !RequestUserToUpgradeDbSucess( ))
                    {
                        return;
                    }
#endif

                    IOptionsDataAccessAgent            optionsAgent;
                    System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();

                    if (!ok)
                    {
                        return;
                    }

                    optionsAgent = DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IOptionsDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent>(optionsAgent);

                    if (Login(string.Empty, false))
                    {
//#if !DEBUG
                        SplashForm.ShowSplash();
// #endif
                        Shell shell = new Shell( );

                        shell.Run( );
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("The program failed to run with the following error:\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
#if LEADTOOLS_V19_OR_LATER
                    ProducerConsumerQueue.Instance.Shutdown(true);
#endif
                    m.Close( );
                }
            }
        }
Exemplo n.º 15
0
        static bool SilentConfigure()
        {
            bool success = true;

            try
            {
                if (_commandLineOptions.DatabaseType == DatabaseTypeEnum.New)
                {
                    DicomStorageServerSqlInstaller.InstallDatabase(_commandLineOptions.GetConnectionString());
                }

                MainForm.ConfigMachine           = MainForm.GetConfiguration();
                MainForm.GlobalPacsAlreadyExists = MainForm.VerifyAlreadyExistGlobalPacsConfig();
                MainForm.ConfigGlobalPacs        = DicomDemoSettingsManager.GetGlobalPacsConfiguration();
                MainForm.ConfigSource            = MainForm.GetConfigurationSource();

                if (MainForm.ConfigGlobalPacs != null)
                {
                    GlobalPacsUpdater.BackupFile(MainForm.ConfigGlobalPacs.FilePath);
                }

                List <ConnectionStringSettings> connectionStringSettingList = new List <ConnectionStringSettings>();

                ConnectionStringSettings storageServerConnectionStringSetting =
                    new ConnectionStringSettings(_commandLineOptions.DatabaseName, _commandLineOptions.GetConnectionString(), ConnectionProviders.SqlServerProvider.Name);
                connectionStringSettingList.Add(storageServerConnectionStringSetting);
                MainForm.StoreConnectionStringsCommandLine(connectionStringSettingList);

                MainForm.RegisterConfigSectionsCommandLine();

                if (_commandLineOptions.DatabaseType == DatabaseTypeEnum.Existing)
                {
                    // Get DICOM listening service name from options database table
                    // Update globalpacs.config to include service name for each DataAccesLayer entry

                    AddDicomServiceNameToGlobalPacsConfig();
                }

                if (_commandLineOptions.DatabaseType == DatabaseTypeEnum.New)
                {
                    //if (databaseOptions1.WorklistDbSelected)
                    //{
                    //   // FillModalityWorklistDummyData ( ) ;
                    //}

                    //if (databaseOptions1.UserManagementDbSelected)
                    //{
                    //   InsertWorkstationUser();
                    //}
                }

                if (_commandLineOptions.DatabaseType == DatabaseTypeEnum.New)
                {
                    bool storageServerDbSelected = true;
                    if (storageServerDbSelected)
                    {
                        MainForm.InsertStorageServerUser(_commandLineOptions.DicomServerUsername, _commandLineOptions.DicomServerPassword);

                        if (Program.IsToolkitDemo == true)
                        {
                            // Program.AddDefaultImages(MainForm.ConfigGlobalPacs);
                        }
                        MainForm.AddDefaultIodClasses();
                    }
                }
            }
            catch (Exception ex)
            {
                success = false;
                MyShowError(ex.Message);
            }
            return(success);
        }