private static void InitializeCef()
        {
            CefRuntime.Load();
            CefMainArgs    cefArgs = new CefMainArgs(new[] { "--force-renderer-accessibility" });
            CefApplication cefApp  = new CefApplication();

            CefRuntime.ExecuteProcess(cefArgs, cefApp);
            CefSettings cefSettings = new CefSettings
            {
                SingleProcess            = false,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.ErrorReport,
                LogFile     = "CefGlue.log",
            };

            CefRuntime.Initialize(cefArgs, cefSettings, cefApp);
        }
Beispiel #2
0
        private static int Main(string[] args)
        {
            try
            {
                try
                {
                    CefRuntime.Load();
                }
                catch (DllNotFoundException ex)
                {
                    MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(1);
                }
                catch (CefRuntimeException ex)
                {
                    MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(2);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(3);
                }

                var mainArgs = new CefMainArgs(args);
                var app      = new CefApplication();

                int exitCode = CefRuntime.ExecuteProcess(mainArgs, app);
                if (exitCode != -1)
                {
                    return(exitCode);
                }

                var settings = new CefSettings
                {
                    SingleProcess            = false,
                    MultiThreadedMessageLoop = true,
                    LogSeverity = CefLogSeverity.Disable,
                    LogFile     = "CefGlue.log",
                };

                CefRuntime.Initialize(mainArgs, settings, app);

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

                if (!settings.MultiThreadedMessageLoop)
                {
                    Application.Idle += (sender, e) => { CefRuntime.DoMessageLoopWork(); };
                }
                InitDevExpress();
                UpdateHelper.ForcedUpdate();
                Application.ThreadException += Application_ThreadException;
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                BaseSystemInfo.StartupPath         = Application.StartupPath;
                BaseSystemInfo.CustomerCompanyName = "申通快递";
                BaseSystemInfo.SoftFullName        = "申通打印专家";
                BaseSystemInfo.SoftName            = BaseSystemInfo.SoftFullName;
                BaseSystemInfo.MailUserName        = "******";
                BaseSystemInfo.MailServer          = "smtp.qq.com";
                BaseSystemInfo.MailPassword        = "******";
                BaseSystemInfo.SystemCode          = "ZTOPrint";
                //  ZipFile();
                Synchronous.Synchronous.BeforeLogOn();
                // new FrmWaiting().ShowDialog();
                CheckPrinterWindowsServer();
                CheckInitData();
                var t = new Task(() => ComputerHelper.GetServerDataTime());
                t.Start();

                // Application.Run(new FrmLogOnByMobile());
                Application.Run(new FrmMain());
                return(0);
            }
            catch (Exception ex)
            {
                LogUtil.WriteException(ex);
                MessageBox.Show(ex.Message);
            }
            CefRuntime.Shutdown();
            return(0);
        }