Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            if (ApplicationUtils.IsOnlyProcess("Patient Updater") || args.Length > 0)
            {
                if (MustRunAsAdmin(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

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

                if (!InitializeLicense())
                {
                    return;
                }

#if LEADTOOLS_V175_OR_LATER
                if (RasterSupport.IsLocked(RasterSupportType.DicomCommunication))
                {
                    MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.DicomCommunication.ToString()), "Warning");
                    return;
                }
#else
                if (RasterSupport.IsLocked(RasterSupportType.MedicalNet))
                {
                    MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.MedicalNet.ToString()), "Warning");
                    return;
                }
#endif
                Leadtools.DicomDemos.Utils.EngineStartup();
                Leadtools.DicomDemos.Utils.DicomNetStartup();

                Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                try
                {
                    if (Login())
                    {
                        Application.Run(CreateMainForm());
                    }
                }
                catch (Exception)
                {
                }
                finally
                {
                    DicomShutdown();
                }
            }
        }