コード例 #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            string cefPath             = Path.Combine(Path.GetDirectoryName(GetProjectPath()), "cef");
            bool   externalMessagePump = e.Args.Contains("--external-message-pump");

            var settings = new CefSettings();

            settings.MultiThreadedMessageLoop = !externalMessagePump;
            settings.ExternalMessagePump      = externalMessagePump;
            settings.NoSandbox = true;
            settings.WindowlessRenderingEnabled = true;
            settings.LocalesDirPath             = Path.Combine(cefPath, "Resources", "locales");
            settings.ResourcesDirPath           = Path.Combine(cefPath, "Resources");
            settings.LogSeverity                = CefLogSeverity.Warning;
            settings.IgnoreCertificateErrors    = true;
            settings.UncaughtExceptionStackSize = 8;

            app = new CefAppImpl();
            app.ScheduleMessagePumpWorkCallback = OnScheduleMessagePumpWork;
            app.Initialize(Path.Combine(cefPath, "Release"), settings);

            if (externalMessagePump)
            {
                messagePump = new Timer(_ => Dispatcher.BeginInvoke(new Action(CefApi.DoMessageLoopWork)), null, messagePumpDelay, messagePumpDelay);
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            // 检测更新
            AU.Updater updater = new AU.Updater();
            if (updater.NeedUpdate())
            {
                Process.Start("AutoUpdater.exe");
                Environment.Exit(0);
            }

            // BasisPlatform:应用程序初始化
            Basiser basiser = Basiser.GetInstance();

            //basiser.EnabledEbiaSupport = true;
            //basiser.Init(CommonAppConfig.GetInstance().AppIdentifier, PlatformType.Winform);

            DotNetBarUtil.InitLocalization();

            //bool notRunning;
            //using (Mutex mutex = new Mutex(true, Application.ProductName, out notRunning))
            //{
            //    if (notRunning)
            //    {
            using (CefAppImpl application = new CefAppImpl())
            {
                application.Run();
            }
            //}
            //else
            //    MessageBox.Show("程序正在运行中","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
            //}
        }
コード例 #3
0
        public static IntPtr Test1()
        {
            var    test = new TestClass();
            var    app  = new CefAppImpl();
            IntPtr key  = (IntPtr)app.GetNativeInstance();

            app  = null;
            test = null;
            return(key);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: wuzlai/CefNet
        static void Main(string[] args)
        {
            //Application.SetHighDpiMode(HighDpiMode.SystemAware);
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);


            string cefPath             = Path.Combine(Path.GetDirectoryName(GetProjectPath()), "cef");
            bool   externalMessagePump = args.Contains("--external-message-pump");

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            var settings = new CefSettings();

            settings.MultiThreadedMessageLoop = !externalMessagePump;
            settings.ExternalMessagePump      = externalMessagePump;
            settings.NoSandbox = true;
            settings.WindowlessRenderingEnabled = true;
            settings.LocalesDirPath             = Path.Combine(cefPath, "Resources", "locales");
            settings.ResourcesDirPath           = Path.Combine(cefPath, "Resources");
            settings.LogSeverity                = CefLogSeverity.Warning;
            settings.IgnoreCertificateErrors    = true;
            settings.UncaughtExceptionStackSize = 8;

            var app = new CefAppImpl();

            app.ScheduleMessagePumpWorkCallback = OnScheduleMessagePumpWork;
            try
            {
                app.BeforeInitialize += App_BeforeInitialize;
                app.Initialize(Path.Combine(cefPath, "Release"), settings);

                if (externalMessagePump)
                {
                    messagePump = new System.Threading.Timer(_ => Application.RunOnUIThread(CefApi.DoMessageLoopWork), null, messagePumpDelay, messagePumpDelay);
                }

                mainForm = new MainForm();
                //mainForm.UseSystemDecorations = true;
                Application.Run(mainForm);
            }
            finally
            {
                messagePump?.Dispose();
                app.Shutdown();
                app.Dispose();
            }
        }
コード例 #5
0
ファイル: App.xaml.cs プロジェクト: jingyiliu/CefNet
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            string cefPath = Path.Combine(Path.GetDirectoryName(GetProjectPath()), "cef");


            var settings = new CefSettings();

            settings.MultiThreadedMessageLoop = true;
            settings.NoSandbox = true;
            settings.WindowlessRenderingEnabled = true;
            settings.LocalesDirPath             = Path.Combine(cefPath, "Resources", "locales");
            settings.ResourcesDirPath           = Path.Combine(cefPath, "Resources");
            settings.LogSeverity                = CefLogSeverity.Warning;
            settings.IgnoreCertificateErrors    = true;
            settings.UncaughtExceptionStackSize = 8;

            app = new CefAppImpl();
            app.Initialize(Path.Combine(cefPath, "Release"), settings);
        }
コード例 #6
0
        static void Main(string[] args)
        {
            // 检测更新
            AU.Updater updater = new AU.Updater();
            if (updater.NeedUpdate())
            {
                Process.Start("AutoUpdater.exe");
                Environment.Exit(0);
            }

            // BasisPlatform:应用程序初始化
            //Basiser basiser = Basiser.GetInstance();
            //basiser.EnabledEbiaSupport = true;
            //basiser.InitBasisPlatform(CommonAppConfig.GetInstance().AppIdentifier, PlatformType.Winform);

            DotNetBarUtil.InitLocalization();

            using (CefAppImpl application = new CefAppImpl())
            {
                application.Run();
            }
        }
コード例 #7
0
        public static void Test2(IntPtr key)
        {
            CefAppImpl app = (CefAppImpl)CefAppImpl.GetInstance(key);

            app.Release();
        }