Ejemplo n.º 1
0
        public void LoadImageScanner()
        {
            if (!DemosGlobal.CheckKnown3rdPartyTwainIssues(this, twainSession.SelectedSourceName()))
            {
                return;
            }

            bool showUI = false;

            inTwainAcquire = true;

            //Set the scanner to scan a specified number of pages, scan at 1bpp B/W, and at 300DPI
            try
            {
                twainSession.MaximumTransferCount = 1;
                twainSession.Resolution           = new SizeF(300, 300);
            }
            catch
            {
                MessageBox.Show("Unable to set scanner to 300DPI.");
                showUI = true;
            }

            if (showUI)
            {
                twainSession.Acquire(TwainUserInterfaceFlags.Modal);
            }
            else
            {
                twainSession.Acquire(TwainUserInterfaceFlags.None);
            }

            inTwainAcquire = false;
        }
Ejemplo n.º 2
0
        private void Acquire(bool cleanup)
        {
            try
            {
                SetTransferMode();

                if (!DemosGlobal.CheckKnown3rdPartyTwainIssues(this, _twainSession.SelectedSourceName()))
                {
                    return;
                }

                _cleanupAfterAcquire = cleanup;
                if (_cleanupAfterAcquire)
                {
                    ShowCleanUpMessage();
                }

                // Acquire one or more images from a TWAIN source.
                _twainSession.Acquire(TwainUserInterfaceFlags.Show | TwainUserInterfaceFlags.Modal);
            }
            catch (Exception ex)
            {
                AddErrorToErrorList(ex.Message);
                MessageBox.Show(this, ex.Message);
            }
        }
Ejemplo n.º 3
0
        private void buttonShowHelp_Click(object sender, EventArgs e)
        {
            bool bHelpFound = true;

            try
            {
#if (LTV20_CONFIG)
                //DemosGlobal.LaunchHelp2("WCF.Topics.LEADTOOLSModalityWorklistWCFandMPPSWCF 20");
                Process.Start("https://www.leadtools.com/help/leadtools/v20/dh/to/leadtools-modality-worklist-wcf-and-mpps-wcf.html");
#elif (LTV19_CONFIG)
                DemosGlobal.LaunchHelp2("WCF.Topics.LEADTOOLSModalityWorklistWCFandMPPSWCF 19");
#elif (LTV18_CONFIG)
                DemosGlobal.LaunchHelp2("WCF.Topics.LEADTOOLSModalityWorklistWCFandMPPSWCF 18");
#elif (LTV175_CONFIG)
                DemosGlobal.LaunchHelp2("WCF.Topics.LEADTOOLSModalityWorklistWCFandMPPSWCF 175");
#else
                DemosGlobal.LaunchHelp2("WCF.Topics.LEADTOOLSModalityWorklistWCFandMPPSWCF");
#endif
            }
            catch (Exception)
            {
                bHelpFound = false;
            }
            finally
            {
                if (!bHelpFound)
                {
                    Messager.ShowWarning(this, "Help failed to load.");
                }
            }
        }
Ejemplo n.º 4
0
        private void BeginClipCursor()
        {
            Rectangle rc = Rectangle.Intersect(DemosGlobal.FixRectangle(SourceRectangle), ClientRectangle);

            rc = RectangleToScreen(rc);
            Control parent = Parent;

            while (parent != null)
            {
                rc = Rectangle.Intersect(rc, Parent.RectangleToScreen(Parent.ClientRectangle));
                if (parent is Form)
                {
                    Form form = parent as Form;
                    if (form.IsMdiChild && form.Owner != null)
                    {
                        rc = Rectangle.Intersect(rc, form.Owner.RectangleToScreen(form.Owner.ClientRectangle));
                    }
                }

                parent = parent.Parent;
            }

            _rcClip          = Cursor.Clip;
            Cursor.Clip      = rc;
            _isCursorClipped = true;
        }
Ejemplo n.º 5
0
        private void _btnAcquirePage_Click(object sender, EventArgs e)
        {
            if (scannedImage != null)
            {
                scannedImage.Dispose();
                scannedImage = null;
            }

            try
            {
                Messager.Show(this, "For best results, scan at 150DPI (or higher) and 1 bits per pixel", MessageBoxIcon.Information, MessageBoxButtons.OK);

                StartupTwain();

                if (!DemosGlobal.CheckKnown3rdPartyTwainIssues(this, twainSession.SelectedSourceName()))
                {
                    return;
                }

                if (twainSession.SelectSource(String.Empty) == DialogResult.OK)
                {
                    twainSession.Acquire(TwainUserInterfaceFlags.Show);
                }

                if (twainSession != null)
                {
                    twainSession.Shutdown();
                }
            }
            catch (Exception exp)
            {
                Messager.ShowError(this, exp);
            }
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            if (!Support.SetLicense())
            {
                return;
            }

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

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

            try
            {
                Leadtools.Dicom.DicomEngine.Startup( );
                Application.Run(new Form1());
            }
            finally
            {
                Leadtools.Dicom.DicomEngine.Shutdown( );
            }
        }
Ejemplo n.º 7
0
        private void CheckWebComponents()
        {
            bool isAdmin     = DemosGlobal.IsAdmin();
            bool isWebHosted = WebDemoHosted();

            if (isAdmin && isWebHosted)
            {
                StartCcowServer();
                this.linkLabelWebWarning.Visible = false;
                EnableWebUIElements(true);
            }
            else
            {
                if (!isAdmin)
                {
                    this.labelWebWarning.Visible = true;
                }
                else if (!isWebHosted)
                {
                    this.linkLabelWebWarning.Visible = true;
                }

                EnableWebUIElements(false);
            }
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

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

#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

            Messager.Caption = "Medical Web Viewer Configuration";
            Application.Run(new Form1());
        }
Ejemplo n.º 9
0
 private static bool MustRunAsAdmin(string[] args)
 {
     if (DemosGlobal.MustRestartElevated())
     {
         DemosGlobal.TryRestartElevated(args);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 10
0
 private void howToToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         DemosGlobal.LaunchHowTo("Jpip.html");
     }
     catch (Exception ex)
     {
         Messager.ShowError(this, ex.Message);
     }
 }
Ejemplo n.º 11
0
 private void _menuItemFileSave_Click(object sender, EventArgs e)
 {
     try
     {
         DemosGlobal.SetDefaultComments(ActiveViewerForm.Viewer.Image, _codecs);
         _saver.Save(this, _codecs, ActiveViewerForm.Viewer.Image);
     }
     catch (Exception ex)
     {
         Messager.ShowFileSaveError(this, _saver.FileName, ex);
     }
 }
        static void Main()
        {
            try
            {
                if (IsWindowsVista() && !IsAdmin())
                {
                    RestartElevated();
                    return;
                }

#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

                Messager.Caption = ConfigurationData.ApplicationName;

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

                DicomEngine.Startup();
                if (!InitializeLicense())
                {
                    return;
                }
                Form mainForm = GetMainForm();
                if (mainForm == null)
                {
                    return;
                }
                Application.Run(mainForm);
            }
            catch (Exception exception)
            {
                MessageBox.Show("An error has occured. The program will be terminated.\n" + exception.Message,
                                Messager.Caption,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            finally
            {
                DicomEngine.Shutdown();
            }
        }
Ejemplo n.º 13
0
        private void _menuItemFileAcuire_Click(object sender, EventArgs e)
        {
            if (!DemosGlobal.CheckKnown3rdPartyTwainIssues(this, _twnSession.SelectedSourceName()))
            {
                return;
            }

            if (Directory.Exists(_twainSaveFilePath))
            {
                using (WaitCursor cursor = new WaitCursor())
                {
                    try
                    {
                        if (_viewer.Image != null)
                        {
                            _viewer.Image.Dispose();
                        }

                        _twainSaveFileName = ChangeSaveFileName(_saveFilesCount.ToString());
                        //Call the Acquire method to start the scanning process
                        if (_twnSession.Acquire(TwainUserInterfaceFlags.Show) != DialogResult.OK)
                        {
                            Messager.ShowError(this, "Error Acquiring From Source");
                        }
                        else
                        {
                            _saveFilesCount++;
                            _twainSaveFileName = ChangeSaveFileName(_saveFilesCount.ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                        Messager.ShowError(this, ex.Message);
                    }
                    finally
                    {
                        UpdateControls();
                        UpdateStatusBarText();
                    }
                }
            }
            else
            {
                Messager.ShowError(this, "Set Results Path please.");
            }
        }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            if (!Support.SetLicense())
            {
                return;
            }

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

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
Ejemplo n.º 15
0
        private void _pdfObject_SavePDFImageObjectAs(object sender, EventArgs e)
        {
            ImageFileSaver saver = new ImageFileSaver();

            try
            {
                RasterImage image = _document.DecodeImage(_selectedPdfImageObject.ImageObjectNumber);
                using (RasterCodecs codecs = new RasterCodecs())
                {
                    DemosGlobal.SetDefaultComments(image, codecs);
                    saver.Save(this, codecs, image);
                }
            }
            catch (Exception ex)
            {
                Messager.ShowFileSaveError(this, saver.FileName, ex);
            }
        }
Ejemplo n.º 16
0
        private static void startApplication(string[] args)
        {
//设置License
            if (!Support.SetLicense())
            {
                return;
            }
            //leadtools验证liccense
            if (RasterSupport.IsLocked(RasterSupportType.DicomCommunication))
            {
                MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.DicomCommunication.ToString()),
                                "Warning");
                return;
            }
            //对Uac进行判断,如果需要提升权限进行运行,已通过manifest设置requireAdministrator绕过
            if (DemosGlobal.MustRestartElevated())
            {
                DemosGlobal.TryRestartElevated(args);
                return;
            }
            //启动leadtools引擎,DicomEngine.Startup();
            Utils.EngineStartup();
            //DicomNet.Startup();
            Utils.DicomNetStartup();

            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(true);
                //运行主界面
                Application.Run(new MainForm());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Utils.EngineShutdown();
                Utils.DicomNetShutdown();
            }
        }
Ejemplo n.º 17
0
        private void showDetailedHelpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool bHelpFound = true;

            try
            {
                DemosGlobal.LaunchHelp2("CcowDashboardDemo");
            }
            catch (Exception)
            {
                bHelpFound = false;
            }
            finally
            {
                if (!bHelpFound)
                {
                    Messager.ShowWarning(this, "Help failed to load.");
                }
            }
        }
Ejemplo n.º 18
0
        private void _btnSave_Click(object sender, EventArgs e)
        {
            ImageFileSaver _saver = new ImageFileSaver();

            try
            {
                using (RasterCodecs codecs = new RasterCodecs())
                {
                    using (RasterImage rasterImage = RasterImageConverter.ConvertFromImage(image, ConvertFromImageOptions.None))
                    {
                        DemosGlobal.SetDefaultComments(rasterImage, codecs);
                        _saver.Save(this, codecs, rasterImage);
                    }
                }
                this.Close();
            }
            catch (Exception ex)
            {
                Messager.ShowFileSaveError(this, _saver.FileName, ex);
            }
        }
Ejemplo n.º 19
0
            void ServiceManager_ServerError(object sender, Leadtools.Dicom.Server.Admin.ErrorEventArgs e)
            {
               if ( ( null != e.Error ) && ( e.Error is BadImageFormatException ) )
               {
                  string demoVersoin   = "32";
                  string addInsVersion = "64";
                  
                  string msg = 
                    "Error loading [{0}].\n\n" + 
                    "This {1}-bit {3} process cannot load {2}-bit AddIn dlls, so the AddIn options can not be displayed.  " +
                    "Please use the {2}-bit version of the {3} to view the AddIn options.\n\n" + 
                    "Note:\n" +
                    "If you prefer to use the {1}-bit version of the AddIn dlls you can delete the current service and reinstall it from this {3}:\n" + 
                    "* To delete the service, click on 'Delete Server' button from the Workstation Listener Service Manager.\n" + 
                    "* To install a new service, click on 'Add Server' and enter the service information -or leave the defaults- in the dialog then click ok.\n" ;

                  string message = string.Empty;

                   if ( DemosGlobal.Is64Process ( ) )
                   {
                      demoVersoin   = "64";
                      addInsVersion = "32";
                   }
                   else
                   {
                      demoVersoin   = "32";
                      addInsVersion = "64";
                   }
                   
                   message = string.Format(msg, (e.Error as BadImageFormatException).FileName, demoVersoin, addInsVersion, Messager.Caption );
                   
                   ThreadSafeMessager.ShowWarning (  message ) ;
               }
               else
               {
                  ThreadSafeMessager.ShowError (  e.Error.Message ) ;
               }
            }
Ejemplo n.º 20
0
        private void Acquire(bool cleanup)
        {
            try
            {
                if (!DemosGlobal.CheckKnown3rdPartyTwainIssues(this, _twainSession.SelectedSourceName()))
                {
                    return;
                }

                _cleanupAfterAcquire = cleanup;

                if (_cleanupAfterAcquire)
                {
                    ShowCleanUpMessage();
                }

                _twainSession.Acquire(TwainUserInterfaceFlags.Show | TwainUserInterfaceFlags.Modal);
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
        }
Ejemplo n.º 21
0
        static void Main(string[] args)
        {
            if (!Support.SetLicense())
            {
                return;
            }

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

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

            Utils.EngineStartup();
            Utils.DicomNetStartup();

            Application.Run(new MainForm());
        }
        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);
        }
Ejemplo n.º 23
0
        static void Main(string[] args)
        {
            try
            {
                if (IsWindowsVista() && !IsAdmin())
                {
                    RestartElevated();
                    return;
                }

#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

                Messager.Caption = ConfigurationData.ApplicationName;

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

                DicomEngine.Startup();
                if (!InitializeLicense())
                {
                    return;
                }

                bool success = false;
                if (args.Length > 0)
                {
                    // Redirect console output to parent process -- must be before any calls to Console.WriteLine()
                    AttachConsole(ATTACH_PARENT_PROCESS);
                    Console.WriteLine();

                    if (ReadCommandLine(args))
                    {
                        if (_commandLineOptions.IsValid() == false)
                        {
                            MessageBox.Show("Invalid CommandLine Options");
                            return;
                        }
                        success = SilentConfigure();
                    }
                }

                else
                {
                    _mainForm = GetMainForm();
                    if (_mainForm == null)
                    {
                        return;
                    }
                    Application.Run(_mainForm);
                }
            }
            catch (Exception exception)
            {
                Program.MyShowError("An error has occured. The program will be terminated.\n" + exception.Message);
            }
            finally
            {
                DicomEngine.Shutdown();
                Program.MyShowInformation("Finished.");
            }
        }
Ejemplo n.º 24
0
        private void LoadSettings( )
        {
            _mySettings = DicomDemoSettingsManager.LoadSettings(_demoName);
            if (_mySettings == null)
            {
                _mySettings          = new DicomDemoSettings();
                _mySettings.FirstRun = false;
                DicomDemoSettingsManager.SaveSettings(_demoName, _mySettings);
            }

            RegistryKey user     = Registry.CurrentUser;
            RegistryKey settings = user.OpenSubKey(_settingsLocation, true);

            if (settings == null)
            {
                //
                // We haven't saved any setting yet.  Will use the default
                //  settings.
                return;
            }

            _useTls = Convert.ToBoolean(settings.GetValue("UseTls", false));

            if (_useTls)
            {
                if (Utils.VerifyOpensslVersion(this) == false)
                {
                    _useTls = false;
                }
            }

            server.AETitle = Convert.ToString(settings.GetValue("ServerAE"));
            server.Port    = Convert.ToInt32(settings.GetValue("ServerPort", 104));
            string sValue = Convert.ToString(settings.GetValue("ServerIpType"));

            if (string.IsNullOrEmpty(sValue))
            {
                server.IpType = DicomNetIpTypeFlags.Ipv4;
            }
            else
            {
                server.IpType = (DicomNetIpTypeFlags)DemosGlobal.StringToEnum(typeof(DicomNetIpTypeFlags), sValue);
            }
            _ipType        = server.IpType;
            server.Address = IPAddress.Parse(Convert.ToString(settings.GetValue("ServerAddress", "127.0.0.1")));
            server.Timeout = Convert.ToInt32(settings.GetValue("ServerTimeout", 0));

            AETitle                 = Convert.ToString(settings.GetValue("ClientAE"));
            disableLogging          = Convert.ToBoolean(settings.GetValue("DisableLogging"));
            GroupLengthDataElements = Convert.ToBoolean(settings.GetValue("GroupLengthDataElements", false));


            _presentationContextType = Convert.ToInt32(settings.GetValue("PresentationContextType"));
            _cstoreCompressionType   = (DicomImageCompressionType)Enum.Parse(typeof(DicomImageCompressionType), Convert.ToString(settings.GetValue("Compression")));

            if (cstore != null)
            {
                cstore.PresentationContextType = _presentationContextType;
                cstore.Compression             = _cstoreCompressionType;
            }
        }
 public static bool Restart()
 {
     return(DemosGlobal.MustRestartElevated());
 }
Ejemplo n.º 26
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);
        }
Ejemplo n.º 27
0
        private void DoWork()
        {
            if (!DemosGlobal.CheckKnown3rdPartyTwainIssues(this, _twainSession.SelectedSourceName()))
            {
                _canceled    = true;
                DialogResult = DialogResult.Cancel;
                return;
            }

            // Create an OCR document
            // Acquire the page(s)
            // Deskew the page
            // Add the pages to the engine
            // Recognize
            // Save to final document

            _lblProcessing.Text = "Acquiring a page...";

            _canceled = false;

            _twainSession.AcquirePage += new EventHandler <TwainAcquirePageEventArgs>(_twainSession_AcquirePage);

            try
            {
                if (!_canceled)
                {
                    DialogResult res = _twainSession.Acquire(TwainUserInterfaceFlags.Show);
                    if (res != DialogResult.OK && _document.Pages.Count <= 0)
                    {
                        _canceled = true;
                    }
                }

                if (_document.Pages.Count > 0)
                {
                    // We have the pages in the OCR engine, recognize them
                    if (!_canceled)
                    {
                        _document.Pages.Recognize(new OcrProgressCallback(OcrProgress));
                    }
                    if (!_canceled)
                    {
                        _document.Save(_documentFileName, _format, new OcrProgressCallback(OcrProgress));
                    }

                    // Show the final document
                    if (!_canceled && File.Exists(_documentFileName))
                    {
                        Process.Start(_documentFileName);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
            finally
            {
                // Unhook from the twain events
                _twainSession.AcquirePage -= new EventHandler <TwainAcquirePageEventArgs>(_twainSession_AcquirePage);

                // Remove all the pages from the document
                _document.Pages.Clear();
                _document.Dispose();

                if (!_canceled)
                {
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    DialogResult = DialogResult.Cancel;
                }
            }
        }
Ejemplo n.º 28
0
        static void Main(string[] args)
        {
#pragma warning disable 436

#if LEADTOOLS_V19_OR_LATER
            if (!Support.SetLicense())
            {
                return;
            }
#else
            Support.SetLicense();
            if (RasterSupport.KernelExpired)
            {
                return;
            }
#endif

#pragma warning restore 436

            if (Elevation.Restart())
            {
                DemosGlobal.TryRestartElevated(args);
                return;
            }

            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;
            }
#endif

            try
            {
                Leadtools.Dicom.DicomEngine.Startup( );
                Leadtools.Dicom.DicomNet.Startup( );

                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

                WorkstationShellController.Instance.Run( );
            }
            catch (Exception exception)
            {
                ViewErrorDetailsDialog detailedError;


                detailedError = new ViewErrorDetailsDialog(exception);

                detailedError.ShowDialog( );
            }
            finally
            {
                Leadtools.Dicom.DicomEngine.Shutdown( );
                Leadtools.Dicom.DicomNet.Shutdown( );
            }
        }
Ejemplo n.º 29
0
        private void Acquire(bool cleanup)
        {
            try
            {
                if (!DemosGlobal.CheckKnown3rdPartyTwainIssues(this, _twainSession.SelectedSourceName()))
                {
                    return;
                }

                // get the output file name and file format
                RasterSaveDialog dlg = new RasterSaveDialog(_codecs);

                dlg.Title           = "File Acquire Path";
                dlg.AutoProcess     = false;
                dlg.EnableSizing    = true;
                dlg.FileFormatsList = new RasterSaveDialogFileFormatsList(RasterDialogFileFormatDataContent.Default);
                dlg.ShowFileOptionsBasicJ2kOptions = false;
                dlg.ShowFileOptionsJ2kOptions      = false;
                dlg.ShowFileOptionsMultipage       = false;
                dlg.ShowFileOptionsProgressive     = false;
                dlg.ShowFileOptionsQualityFactor   = false;
                dlg.ShowFileOptionsStamp           = false;
                dlg.ShowHelp          = false;
                dlg.ShowOptions       = false;
                dlg.ShowQualityFactor = false;

                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    // save the output file name
                    _fileName = dlg.FileName;

                    // save the output file format
                    _fileFormat   = dlg.Format;
                    _bitsPerPixel = dlg.BitsPerPixel;

                    string pathName = Path.GetDirectoryName(_fileName);
                    if (Directory.Exists(pathName))
                    {
                        // initialize the page counter
                        _pageNo = 0;

                        // Add the Acquire page event.
                        _twainSession.AcquirePage += new EventHandler <TwainAcquirePageEventArgs>(_twain_AcquirePage);
                        // Acquire pages

                        _cleanupAfterAcquire = cleanup;

                        if (_cleanupAfterAcquire)
                        {
                            ShowCleanUpMessage();
                        }

                        _twainSession.Acquire(TwainUserInterfaceFlags.Show);
                        // Remove the Acquire page event.
                        _twainSession.AcquirePage -= new EventHandler <TwainAcquirePageEventArgs>(_twain_AcquirePage);
                    }
                    else
                    {
                        Messager.ShowError(this, "Invalid File Name");
                    }
                }
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
            finally
            {
                UpdateMyControls();
                UpdateStatusBarText();
            }
        }
Ejemplo n.º 30
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( );
                }
            }
        }