private void Startup(object sender, ControlledApplicationLifetimeStartupEventArgs e) { string cefPath; bool externalMessagePump = e.Args.Contains("--external-message-pump"); string projectPath = GetProjectPath(); string filePathLog = System.AppDomain.CurrentDomain.BaseDirectory + "Log"; if (PlatformInfo.IsMacOS) { externalMessagePump = true; cefPath = Path.Combine(projectPath, "Contents", "Frameworks", "Chromium Embedded Framework.framework"); } else if (PlatformInfo.IsLinux) { //cefPath = Path.Combine(Path.GetDirectoryName(GetProjectPath()), "cef"); cefPath = System.AppDomain.CurrentDomain.BaseDirectory + "win_cef"; } else { //cefPath = Path.Combine(Path.GetDirectoryName(GetProjectPath()), "cef"); cefPath = System.AppDomain.CurrentDomain.BaseDirectory + "win_cef"; } 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(PlatformInfo.IsMacOS ? cefPath : Path.Combine(cefPath, "Release"), settings); if (externalMessagePump) { messagePump = new Timer(_ => Dispatcher.UIThread.Post(CefApi.DoMessageLoopWork), null, messagePumpDelay, messagePumpDelay); } }
private void Startup(object sender, ControlledApplicationLifetimeStartupEventArgs 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); }
public static void Main(string[] args) { string cefPath; bool externalMessagePump = args.Contains("--external-message-pump"); if (PlatformInfo.IsMacOS) { externalMessagePump = true; cefPath = Path.Combine(GetProjectPath(), "Contents", "Frameworks", "Chromium Embedded Framework.framework"); } else { cefPath = Path.Combine(Path.GetDirectoryName(GetProjectPath()), "cef"); } 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.FrameworkInitialized += App_FrameworkInitialized; App.FrameworkShutdown += App_FrameworkShutdown; app = new CefAppImpl(); app.CefProcessMessageReceived += App_CefProcessMessageReceived; app.ScheduleMessagePumpWorkCallback = OnScheduleMessagePumpWork; app.Initialize(PlatformInfo.IsMacOS ? cefPath : Path.Combine(cefPath, "Release"), settings); BuildAvaloniaApp() // workaround for https://github.com/AvaloniaUI/Avalonia/issues/3533 .With(new AvaloniaNativePlatformOptions { UseGpu = !PlatformInfo.IsMacOS }) .StartWithCefNetApplicationLifetime(args); }