| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- namespace Xilium.CefGlue.Samples.WpfOsr
- {
- using System;
- using System.Windows;
- internal static class Program
- {
- [STAThread]
- private static int Main(string[] args)
- {
- try
- {
- var path = System.IO.Path.Combine(Environment.CurrentDirectory, "cef");
- CefRuntime.Load(path);
- }
- catch (DllNotFoundException ex)
- {
- MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
- return 1;
- }
- catch (CefRuntimeException ex)
- {
- MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
- return 2;
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString(), "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
- return 3;
- }
- var mainArgs = new CefMainArgs(args);
- var cefApp = new SampleCefApp();
- var exitCode = CefRuntime.ExecuteProcess(mainArgs, cefApp);
- if (exitCode != -1) { return exitCode; }
- var cefSettings = new CefSettings
- {
- // BrowserSubprocessPath = browserSubprocessPath,
- SingleProcess = false,
- WindowlessRenderingEnabled = true,
- MultiThreadedMessageLoop = true,
- LogSeverity = CefLogSeverity.Error, //CefLogSeverity.Verbose,
- LogFile = "cef.log",
- };
- try
- {
- CefRuntime.Initialize(mainArgs, cefSettings, cefApp);
- }
- catch (CefRuntimeException ex)
- {
- MessageBox.Show(ex.ToString(), "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
- return 4;
- }
- var app = new Xilium.CefGlue.Samples.WpfOsr.App();
- app.InitializeComponent();
- app.Run();
- // shutdown CEF
- CefRuntime.Shutdown();
- return 0;
- }
- }
- }
|