Exemplo n.º 1
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.º 2
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.º 3
0
 public static bool IsDatabaseUpToDate( )
 {
     return(GlobalPacsUpdater.IsProductDatabaseUpTodate(DicomDemoSettingsManager.ProductNameStorageServer));
 }
Exemplo n.º 4
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( );
                }
            }
        }