public MainWindow() { InitializeComponent(); CefSettings settings = new CefSettings(); //settings.PackLoadingDisabled = false; //settings.Locale = "ja-JP"; //settings.LocalesDirPath = System.AppDomain.CurrentDomain.BaseDirectory + "locales"; settings.LogSeverity = LogSeverity.Verbose; settings.CefCommandLineArgs.Add("enable-npapi", "1"); Cef.Initialize(settings); //cefbrowser.Language = XmlLanguage.GetLanguage(CultureInfo.CurrentUICulture.Name); //cefbrowser.RequestHandler = this; cefbrowser.PreviewTextInput += (sender, e) => { foreach (var character in e.Text) { cefbrowser.SendKeyEvent((int)0x0102, character, 0); } e.Handled = true; }; cefbrowser.FrameLoadEnd += Cefbrowser_FrameLoadEnd; }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); if (!Directory.Exists(Webexpresspath)) { Directory.CreateDirectory(Webexpresspath); Directory.CreateDirectory(Userdatapath); } if (!Directory.Exists(Userdatapath)) { Directory.CreateDirectory(Userdatapath); } if (!System.IO.Directory.Exists("Extensions")) { System.IO.Directory.CreateDirectory("Extensions"); } var cefSettings = new CefSettings(); cefSettings.CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "WebExpress\\user data\\Cache"); cefSettings.SetOffScreenRenderingBestPerformanceArgs(); cefSettings.UserDataPath = Userdatapath; cefSettings.BrowserSubprocessPath = "WebExpress.exe"; cefSettings.PersistSessionCookies = true; //Make sure all dependencies are present when the application runs, may wish to include a nicer error message Cef.Initialize(cefSettings, shutdownOnProcessExit:true, performDependencyCheck:true); }
public static void Initialize() { //todo: grab all the cool settings stuff from the main github repo winforms sample var settings = new CefSettings(); settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");//https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting settings.CefCommandLineArgs.Add("disable-gpu", "1");//https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting settings.CachePath = "cache"; // Register localfile scheme settings.RegisterScheme(new CefCustomScheme() { IsStandard = true, SchemeName = LocalFileSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new LocalFileSchemeHandlerFactory() }); // Register resouce scheme settings.RegisterScheme(new CefCustomScheme() { SchemeName = EmbeddedResourceSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new EmbeddedResourceSchemeHandlerFactory() }); Cef.Initialize(settings); }
public App() { //Perform dependency check to make sure all relevant resources are in our output directory. var settings = new CefSettings(); settings.EnableInternalPdfViewerOffScreen(); Cef.Initialize(settings, shutdownOnProcessExit: true, performDependencyCheck: true); }
public PackageManagerView(PackageManagerViewModel viewModel) { this.DataContext = viewModel; if (!Cef.IsInitialized) { var settings = new CefSettings { RemoteDebuggingPort = 8088 }; //to fix Fickering set disable-gpu to true settings.CefCommandLineArgs.Add("disable-gpu", "1"); Cef.Initialize(settings); } //viewModel.PublishPkgCommands.PublishSuccess += PackageViewModelOnPublishSuccess; InitializeComponent(); viewModel.ParentWindow = this; //cefHelper object for Explore Packages, Explore Authors and My Packages Tab this.cefBrowser.RegisterJsObject("cefHelper", viewModel); //publishCefHelper for Publish Package Tab //this.cefBrowser.RegisterJsObject("publishCefHelper", viewModel.PublishPkgCommands); viewModel.Browser = this.cefBrowser; //viewModel.PublishPkgCommands.Browser = this.cefBrowser; this.Height = (System.Windows.SystemParameters.PrimaryScreenHeight * 0.95); this.Width = (System.Windows.SystemParameters.PrimaryScreenWidth * 0.75); }
public static void Init() { // Set Google API keys, used for Geolocation requests sans GPS. See http://www.chromium.org/developers/how-tos/api-keys // Environment.SetEnvironmentVariable("GOOGLE_API_KEY", ""); // Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_ID", ""); // Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_SECRET", ""); var settings = new CefSettings(); settings.RemoteDebuggingPort = 8088; //settings.CefCommandLineArgs.Add("renderer-process-limit", "1"); //settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog"); //settings.CefCommandLineArgs.Add("disable-gpu", "1"); //settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1"); settings.LogSeverity = LogSeverity.Verbose; if (DebuggingSubProcess) { var architecture = Environment.Is64BitProcess ? "x64" : "x86"; settings.BrowserSubprocessPath = "..\\..\\..\\..\\CefSharp.BrowserSubprocess\\bin\\" + architecture + "\\Debug\\CefSharp.BrowserSubprocess.exe"; } settings.RegisterScheme(new CefCustomScheme { SchemeName = CefSharpSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new CefSharpSchemeHandlerFactory() }); if (!Cef.Initialize(settings)) { throw new Exception("Unable to Initialize Cef"); } }
public static void Init() { var settings = new CefSettings(); settings.RemoteDebuggingPort = 8088; if (debuggingSubProcess) { settings.BrowserSubprocessPath = "..\\..\\..\\..\\CefSharp.BrowserSubprocess\\bin\\x86\\Debug\\CefSharp.BrowserSubprocess.exe"; } settings.RegisterScheme(new CefCustomScheme { SchemeName = CefSharpSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new CefSharpSchemeHandlerFactory() }); if (!Cef.Initialize(settings)) { if (Environment.GetCommandLineArgs().Contains("--type=renderer")) { Environment.Exit(0); } else { return; } } Cef.RegisterJsObject("bound", new BoundObject()); }
public static void Init() { var settings = new CefSettings { RemoteDebuggingPort = 8088, LogFile = "browser-log.txt", // PackLoadingDisabled = true, UserAgent = "SoundBounce", CachePath = Path.GetTempPath() }; if (DebuggingSubProcess) { settings.BrowserSubprocessPath = "CefSharp.BrowserSubprocess.exe"; } if (!Cef.Initialize(settings)) { Log.Error("Fatal: Cef failed to initialize. "); MessageBox.Show("Fatal: Cef failed to initialize."); Environment.Exit(0); } Log.InfoFormat("Cef version {0} initialized OK.", settings.ProductVersion); }
public static void Init() { var settings = new CefSettings(); settings.RemoteDebuggingPort = 8088; //settings.CefCommandLineArgs.Add("renderer-process-limit", "1"); //settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog"); settings.LogSeverity = LogSeverity.Verbose; if (DebuggingSubProcess) { var architecture = Environment.Is64BitProcess ? "x64" : "x86"; settings.BrowserSubprocessPath = "..\\..\\..\\..\\CefSharp.BrowserSubprocess\\bin\\" + architecture + "\\Debug\\CefSharp.BrowserSubprocess.exe"; } settings.RegisterScheme(new CefCustomScheme { SchemeName = CefSharpSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new CefSharpSchemeHandlerFactory() }); if (!Cef.Initialize(settings)) { if (Environment.GetCommandLineArgs().Contains("--type=renderer")) { Environment.Exit(0); } else { return; } } }
public ConfirmationFormWeb(SteamGuardAccount steamAccount) { InitializeComponent(); this.steamAccount = steamAccount; this.Text = String.Format("Trade Confirmations - {0}", steamAccount.AccountName); CefSettings settings = new CefSettings(); settings.PersistSessionCookies = false; settings.UserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 6P Build/XXXXX; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/47.0.2526.68 Mobile Safari/537.36"; steamCookies = String.Format("mobileClientVersion=0 (2.1.3); mobileClient=android; steamid={0}; steamLogin={1}; steamLoginSecure={2}; Steam_Language=english; dob=;", steamAccount.Session.SteamID.ToString(), steamAccount.Session.SteamLogin, steamAccount.Session.SteamLoginSecure); if (!Cef.IsInitialized) { Cef.Initialize(settings); } browser = new ChromiumWebBrowser(steamAccount.GenerateConfirmationURL()) { Dock = DockStyle.Fill, }; this.splitContainer1.Panel2.Controls.Add(browser); BrowserRequestHandler handler = new BrowserRequestHandler(); handler.Cookies = steamCookies; browser.RequestHandler = handler; browser.AddressChanged += Browser_AddressChanged; browser.LoadingStateChanged += Browser_LoadingStateChanged; }
public App() { _webViewSettings = new CefSettings(); _webViewSettings.UserAgent = string.Format( "Mozilla/5.0 (Linux; 6.0; Android 6.0.1;) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{0} Mobile Safari/537.36", Cef.ChromiumVersion); Cef.Initialize(_webViewSettings); }
public App() { var settings = new CefSettings(); settings.EnableInternalPdfViewerOffScreen(); settings.CefCommandLineArgs.Add("disable-gpu", "1"); Cef.Initialize(settings, shutdownOnProcessExit: false, performDependencyCheck: false); }
private static int Main(string[] args) { try { CefRuntime.Load(); } 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.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; }
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) { // This needs to happen first. settingsTab.Initialize(pluginStatusText); settingsTab.OnButtonShowDevTools += (o, e) => { browserWindow.BrowserControl.Browser.ShowDevTools(); }; settingsTab.OnCheckboxIgnoresMouseChanged += (o, e) => { browserWindow.Clickable = !((CheckBox)o).Checked; }; settingsTab.OnCheckboxLayoutModeChanged += (o, e) => { const string enableLayoutModeStr = @" if (window.enableLayoutMode) window.enableLayoutMode(); "; const string disableLayoutModeStr = @" if (window.disableLayoutMode) window.disableLayoutMode(); "; bool layoutModeEnabled = ((CheckBox)o).Checked; browserWindow.BrowserControl.Browser.ExecuteScriptAsync( layoutModeEnabled ? enableLayoutModeStr : disableLayoutModeStr); browserWindow.Clickable = layoutModeEnabled; }; settingsTab.OnButtonReload += (o, e) => { bool ignoreCache = true; browserWindow.BrowserControl.Browser.Reload(ignoreCache); }; settingsTab.OnToggleWindowVisibility += (o, e) => { visibilityControl.visibleViaHotkey = !(visibilityControl.visibleViaHotkey); }; CefSettings cefSettings = new CefSettings(); cefSettings.CachePath = BrowserCacheDir(); Cef.Initialize(cefSettings); browserWindow = new BrowserWindow(); browserWindow.ShowInTaskbar = false; browserWindow.BrowserControl.CreationHandlers += OnBrowserCreated; browserWindow.Clickable = false; browserWindow.Show(); visibilityControl = new VisibilityControl(browserWindow); pluginScreenSpace.Text = "Cactbot"; pluginScreenSpace.Controls.Add(settingsTab); Application.ApplicationExit += OnACTShutdown; }
public static void Initialize() { var cef = new CefSettings { LogSeverity = LogSeverity.Verbose }; Cef.Initialize(cef, true, true); }
public App() { var settings = new CefSettings { BrowserSubprocessPath = "CefSharp.BrowserSubprocess.exe" }; Cef.Initialize(settings); }
static void RegisterSettings() { var settings = new CefSettings(); settings.RegisterScheme(new CefCustomScheme() { SchemeName = LocalSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new LocalSchemeHandlerFactory() }); Cef.Initialize(settings); }
public MainWindow() { var settings = new CefSettings(); settings.RegisterScheme(new CefCustomScheme { SchemeHandlerFactory = new LocalSchemeHandlerFactory(), SchemeName = LocalSchemeHandler.SchemeName }); Cef.Initialize(settings); InitializeComponent(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var appBuilder = new AppBuilder(); appBuilder.UseNancy(); var appFunc = appBuilder.Build<AppFunc>(); var settings = new CefSettings(); settings.RegisterOwinSchemeHandlerFactory("owin", appFunc); Cef.Initialize(settings); }
public int Run(string[] args) { CefRuntime.Load(); var settings = new CefSettings(); settings.MultiThreadedMessageLoop = CefRuntime.Platform == CefRuntimePlatform.Windows; settings.ReleaseDCheckEnabled = true; settings.LogSeverity = CefLogSeverity.Verbose; settings.LogFile = "cef.log"; settings.ResourcesDirPath = System.IO.Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetEntryAssembly().CodeBase).LocalPath); settings.RemoteDebuggingPort = 20480; var argv = args; if (CefRuntime.Platform != CefRuntimePlatform.Windows) { argv = new string[args.Length + 1]; Array.Copy(args, 0, argv, 1, args.Length); argv[0] = "-"; } var mainArgs = new CefMainArgs(argv); var app = new DemoCefApp(); var exitCode = CefRuntime.ExecuteProcess(mainArgs, app); Console.WriteLine("CefRuntime.ExecuteProcess() returns {0}", exitCode); if (exitCode != -1) return exitCode; // guard if something wrong foreach (var arg in args) { if (arg.StartsWith("--type=")) { return -2; } } CefRuntime.Initialize(mainArgs, settings, app); // register custom scheme handler CefRuntime.RegisterSchemeHandlerFactory("http", DumpRequestDomain, new DemoAppSchemeHandlerFactory()); // CefRuntime.AddCrossOriginWhitelistEntry("http://localhost", "http", "", true); PlatformInitialize(); var mainMenu = CreateMainMenu(); _mainView = CreateMainView(mainMenu); _mainView.NewTab(HomeUrl); PlatformRunMessageLoop(); _mainView.Dispose(); _mainView = null; CefRuntime.Shutdown(); PlatformShutdown(); return 0; }
private int RunInternal(string[] args) { CefRuntime.Load(); var settings = new CefSettings(); settings.MultiThreadedMessageLoop = MultiThreadedMessageLoop = CefRuntime.Platform == CefRuntimePlatform.Windows; settings.SingleProcess = false; settings.LogSeverity = CefLogSeverity.Verbose; settings.LogFile = "cef.log"; settings.ResourcesDirPath = System.IO.Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetEntryAssembly().CodeBase).LocalPath); settings.RemoteDebuggingPort = 20480; var argv = args; if (CefRuntime.Platform != CefRuntimePlatform.Windows) { argv = new string[args.Length + 1]; Array.Copy(args, 0, argv, 1, args.Length); argv[0] = "-"; } var mainArgs = new CefMainArgs(argv); var app = new DemoCefApp(); var exitCode = CefRuntime.ExecuteProcess(mainArgs, app); Console.WriteLine("CefRuntime.ExecuteProcess() returns {0}", exitCode); if (exitCode != -1) return exitCode; // guard if something wrong foreach (var arg in args) { if (arg.StartsWith("--type=")) { return -2; } } CefRuntime.Initialize(mainArgs, settings, app); RegisterSchemes(); RegisterMessageRouter(); PlatformInitialize(); var mainMenu = CreateMainMenu(); _mainView = CreateMainView(mainMenu); _mainView.NewTab(HomeUrl); PlatformRunMessageLoop(); _mainView.Dispose(); _mainView = null; CefRuntime.Shutdown(); PlatformShutdown(); return 0; }
private static void StartChromiumBrowser() { Cef.EnableHighDPISupport(); var settings = new CefSettings(); settings.RegisterScheme(new CefCustomScheme { SchemeName = LocalSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new LocalSchemeHandlerFactory() }); Cef.Initialize(settings); }
public void InitBrowser(Panel panel) { CefSettings cSettings = new CefSettings(); cSettings.RemoteDebuggingPort = 8088; Cef.Initialize(cSettings); // Open main page mChromeBrowser = new ChromiumWebBrowser(GetPagePath("main.html")); mEffectsJsObject = new EffectsJsObject(); mChromeBrowser.RegisterJsObject("EffectsJsObject", mEffectsJsObject); mChromeBrowser.LoadError += MChromeBrowser_LoadError; panel.Controls.Add(mChromeBrowser); mChromeBrowser.Dock = DockStyle.Fill; }
public static void Main() { //For Windows 7 and above, best to include relevant app.manifest entries as well Cef.EnableHighDPISupport(); //Perform dependency check to make sure all relevant resources are in our output directory. var settings = new CefSettings { RemoteDebuggingPort = 8088 }; Cef.Initialize(settings, shutdownOnProcessExit: false, performDependencyCheck: true); var browser = new BrowserForm(); Application.Run(browser); }
public static void Main() { var settings = new CefSettings(); settings.LogSeverity = LogSeverity.Verbose; var args = settings.CefCommandLineArgs; // Set up be default //settings.CefCommandLineArgs.Add("enable-system-flash", "1"); //Automatically discovered and load a system-wide installation of Pepper Flash. settings.CefCommandLineArgs.Add("enable-npapi", "1"); //Enable NPAPI plugs which were disabled by default in Chromium 43 (NPAPI will be removed completely in Chromium 45) var version = settings.ProductVersion; Cef.Initialize(settings); var browser = new BrowserForm(); Application.Run(browser); }
public App() { var settings = new CefSettings { LogSeverity = LogSeverity.Disable, }; //settings.RegisterScheme(new CefCustomScheme() //{ // SchemeName = LocalSchemeHandlerFactory.SchemeName, // SchemeHandlerFactory = new LocalSchemeHandlerFactory() //}); Cef.Initialize(settings); }
protected override void OnCreateMainForm() { var settings = new CefSettings(); settings.LogSeverity = LogSeverity.Disable; settings.RegisterScheme(new CefCustomScheme { SchemeName = CefSharpSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new CefSharpSchemeHandlerFactory() }); if (!Cef.Initialize(settings)) { throw new Exception("Unable to Initialize Cef"); } MainForm = new FormMain(); }
private void CefStartup() { CefSettings _settings = new CefSettings { PackLoadingDisabled = true }; Cef.Initialize(_settings); BrowserSettings settings = new BrowserSettings { FileAccessFromFileUrlsAllowed = true, UniversalAccessFromFileUrlsAllowed = true, WebSecurityDisabled = true }; b.BrowserSettings = settings; }
public MainWindow() { var cefSettings = new CefSettings(); cefSettings.LogFile = @"./cef_log.txt"; cefSettings.LogSeverity = LogSeverity.Info; do { Cef.Initialize(cefSettings); } while (!Cef.IsInitialized); InitializeComponent(); webView.Address = ConfigurationManager.ConnectionStrings["HomeUrl"].ConnectionString; }
public static void Init() { // Set Google API keys, used for Geolocation requests sans GPS. See http://www.chromium.org/developers/how-tos/api-keys // Environment.SetEnvironmentVariable("GOOGLE_API_KEY", ""); // Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_ID", ""); // Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_SECRET", ""); //Chromium Command Line args //http://peter.sh/experiments/chromium-command-line-switches/ //NOTE: Note all relevant in relation to `CefSharp`, use for reference purposes only. var settings = new CefSettings(); settings.RemoteDebuggingPort = 8088; //settings.UserAgent = "CefSharp Browser" + Cef.CefSharpVersion; // Example User Agent //settings.CefCommandLineArgs.Add("renderer-process-limit", "1"); //settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog"); //settings.CefCommandLineArgs.Add("disable-gpu", "1"); //settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1"); //settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //Enable WebRTC //settings.CefCommandLineArgs.Add("no-proxy-server", "1"); //Don't use a proxy server, always make direct connections. Overrides any other proxy server flags that are passed. //Disables the DirectWrite font rendering system on windows. //Possibly useful when experiencing blury fonts. //settings.CefCommandLineArgs.Add("disable-direct-write", "1"); settings.LogSeverity = LogSeverity.Verbose; if (DebuggingSubProcess) { var architecture = Environment.Is64BitProcess ? "x64" : "x86"; settings.BrowserSubprocessPath = "..\\..\\..\\..\\CefSharp.BrowserSubprocess\\bin\\" + architecture + "\\Debug\\CefSharp.BrowserSubprocess.exe"; } settings.RegisterScheme(new CefCustomScheme { SchemeName = CefSharpSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new CefSharpSchemeHandlerFactory() }); if (!Cef.Initialize(settings)) { throw new Exception("Unable to Initialize Cef"); } }
void InitializeCef() { Cef.EnableHighDPISupport(); var assemblyLocation = Assembly.GetExecutingAssembly().Location; var assemblyPath = Path.GetDirectoryName(assemblyLocation); var pathSubprocess = Path.Combine(assemblyPath, "CefSharp.BrowserSubprocess.exe"); CefSharpSettings.LegacyJavascriptBindingEnabled = true; var settings = new CefSettings { LogSeverity = LogSeverity.Verbose, LogFile = "ceflog.txt", BrowserSubprocessPath = pathSubprocess }; // Initialize cef with the provided settings Cef.Initialize(settings); }
public EnjazitBrowser(EmployeeDTO employee, BrowserTarget target) { CefSettings settings = new CefSettings(); string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\CEF"; settings.RemoteDebuggingPort = 8080; settings.CachePath = path; //Initialize Cef with the provided settings if (!Cef.IsInitialized) { Cef.Initialize(settings); } InitializeComponent(); Messenger.Default.Send <EmployeeDTO>(employee); Messenger.Default.Send <BrowserTarget>(target); Messenger.Reset(); UrlAndButtonsVisibility(target); }
public MainWindow() { InitializeComponent(); // Initialize cef with the provided settings CefSettings settings = new CefSettings(); Cef.Initialize(settings); //Binds GRE vocab collection list comboBox BindVocabListComboBox(vocabListComboBox); //Binds wordListView BindWordGrid(wordListView); List <Words> wrd = (greDatabase.GetWordsByStatus("Learning", 1)); selectedCategory.Text = String.Format("Learning ({0})", wrd.Count); LoadVocabularyPage(wrd[0].Word, wrd[0].WordId); }
private static void InitializeCefSharp() { var settings = new CefSettings(); // 웹 브라우저의 기본 언어를 한국어로 설정 settings.Locale = "kr"; // 캐시 데이터 저장 settings.CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"MyHomeAlert\Cache"); // debug.log 사용 중지 settings.LogSeverity = LogSeverity.Disable; // CefSharp가 서브폴더에 정상적으로 이동되면 BrowserSubProcessPath도 수정 if (resolved) { settings.BrowserSubprocessPath = Path.Combine(Application.StartupPath, cefSubFolder, "CefSharp.BrowserSubprocess.exe"); } // performDependencyCheck를 false로 해야 기존 어셈블리에 의존하지 않는다. Cef.Initialize(settings, performDependencyCheck: false); }
private void InitializeChromium() { string exeLocation = AppDomain.CurrentDomain.BaseDirectory; CefSettings cfsettings = new CefSettings { //UserAgent = "Mozilla/5..0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko", UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36", CachePath = exeLocation + CACHE_PATH, }; cfsettings.SetOffScreenRenderingBestPerformanceArgs(); cfsettings.CefCommandLineArgs.Add("disable-web-security", "true"); if (!Cef.IsInitialized) { Cef.Initialize(cfsettings); } }
/// <summary> /// The Initialize. /// </summary> public static void Initialize() { if (!Cef.IsInitialized) { System.AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.EnablePointerSupport", true); const bool multiThreadedMessageLoop = true; var browserProcessHandler = new BrowserProcessHandler(); var settings = new CefSettings { //UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0", MultiThreadedMessageLoop = multiThreadedMessageLoop, ExternalMessagePump = !multiThreadedMessageLoop }; settings.PersistSessionCookies = true; settings.SetOffScreenRenderingBestPerformanceArgs(); settings.CefCommandLineArgs.Remove("disable-gpu-compositing"); CefConfig.Init(settings, browserProcessHandler: browserProcessHandler); } }
public GameWindow(API_Instance api) { InitializeComponent(); Console.WriteLine("[GameWindow] WinForm initializing..."); if (api == null) { Close(); return; } API = api; var settings = new CefSettings() { UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36", CachePath = "Cache" }; Console.Write("[GameWindow] Initialize chromium... "); Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null); webBrowser.IsBrowserInitializedChanged += WebBrowser_IsBrowserInitializedChanged; }
public BrowserPage() { var path = System.IO.Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Seven", "Iridium", "Cache" ); var settings = new CefSettings { CachePath = path }; Cef.Initialize(settings); InitializeComponent(); Browser.LifeSpanHandler = new SampleLifeSpanHandler(); }
/// <summary> /// This method must be called from the main UI thread, before any instances of the embedded browser view /// are created anywhere in the application. This configures the global settings for the embedded browser view. /// </summary> public static void InitializeCefBrowser() { var settings = new CefSettings(); // create custom user agent to identify the add-in from OpenProject var chromiumVersion = Cef.ChromiumVersion; var userAgent = $"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{chromiumVersion} Safari/537.36" + $" /OpenProjectRevitAddIn {VersionsService.Version}"; settings.UserAgent = userAgent; // To enable caching, e.g. of assets and cookies, we're using a temp data folder settings.CachePath = Path.Combine(ConfigurationConstant.OpenProjectApplicationData, "BrowserCache"); // Additionally, we're persisting session cookies to ensure logins are persistent throughout // multiple sessions. settings.PersistSessionCookies = true; Cef.Initialize(settings); }
internal void Init() { var cefSettings = new CefSettings { CachePath = Path.Combine(Program.AppDataDirectory, "cache"), UserDataPath = Path.Combine(Program.AppDataDirectory, "userdata"), IgnoreCertificateErrors = true, LogSeverity = LogSeverity.Disable, WindowlessRenderingEnabled = true, PersistSessionCookies = true, PersistUserPreferences = true }; /*cefSettings.RegisterScheme(new CefCustomScheme * { * SchemeName = "vrcx", * DomainName = "app", * SchemeHandlerFactory = new FolderSchemeHandlerFactory(Application.StartupPath + "/../../../html") * });*/ // cefSettings.CefCommandLineArgs.Add("ignore-certificate-errors"); cefSettings.CefCommandLineArgs.Add("disable-plugins"); cefSettings.CefCommandLineArgs.Add("disable-spell-checking"); cefSettings.CefCommandLineArgs.Add("disable-pdf-extension"); cefSettings.CefCommandLineArgs.Add("disable-extensions"); cefSettings.CefCommandLineArgs["autoplay-policy"] = "no-user-gesture-required"; // cefSettings.CefCommandLineArgs.Add("allow-universal-access-from-files"); cefSettings.CefCommandLineArgs.Add("disable-web-security"); cefSettings.SetOffScreenRenderingBestPerformanceArgs(); CefSharpSettings.WcfEnabled = true; // TOOD: REMOVE THIS LINE YO CefSharpSettings.ShutdownOnExit = false; // Enable High-DPI support on Windows 7 or newer Cef.EnableHighDPISupport(); if (Cef.Initialize(cefSettings) == false) { throw new Exception("Cef.Initialize()"); } }
public Form1() { InitializeComponent(); browser = new ChromiumWebBrowser(); CefSettings settings = new CefSettings(); // Initialize cef with the provided settings Cef.Initialize(settings); tableLayoutPanel1.Controls.Add(browser, 1, 0); browser.Dock = DockStyle.Fill; browser.Enabled = false; //Wait for the MainFrame to finish loading browser.FrameLoadEnd += (sender, args) => { //Wait for the MainFrame to finish loading if (args.Frame.IsMain) { args.Frame.ExecuteJavaScriptAsync(string.Format("(function() {{document.getElementById('User_login').value='{0}';}})()", login)); //string returnValue = ""; args.Frame.ExecuteJavaScriptAsync(string.Format("(function() {{document.getElementById('User_password').value='{0}';}})()", password)); //var task1 = args.Frame.EvaluateScriptAsync(@"document.getElementsByName('login')[0].click();"); //await task1.ContinueWith(t => //{ // if (!t.IsFaulted) // { // var response = t.Result; // if (response.Success && response.Result != null) // { // returnValue = response.Result.ToString(); // } // } //}); } }; }
public CtrlBrowser(bool DevTools = false) { this.InitializeComponent(); //this.WebFunctions.ZoomIn += new EventHandler(this.ZoomIn); //this.WebFunctions.ZoomOut += new EventHandler(this.ZoomOut); //this.WebFunctions.DevTools += new EventHandler(this.ShowDevTools); if (!Cef.IsInitialized) { CefSettings settings = new CefSettings(); //settings.BrowserSubprocessPath = @"x86\CefSharp.BrowserSubprocess.exe"; settings.UserAgent = "CEF"; settings.Locale = "de"; settings.CefCommandLineArgs.Add("mute-audio", "false"); settings.CefCommandLineArgs.Add("enable-media-stream", "1"); settings.CefCommandLineArgs["autoplay-policy"] = "no-user-gesture-required"; Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null); //Cef.Initialize(settings); } this.InitializeChromium(); this.chromeBrowser.BrowserSettings.WebSecurity = CefState.Disabled; CefSharpSettings.LegacyJavascriptBindingEnabled = true; //this.chromeBrowser.RegisterJsObject("nativeHost", this.WebFunctions); //this.chromeBrowser.RequestHandler = new MyRequestHandler("Jonas", "Test"); //DownloadHandler downer = new DownloadHandler(this); //this.chromeBrowser.DownloadHandler = downer; //downer.OnBeforeDownloadFired += OnBeforeDownloadFired; //downer.OnDownloadUpdatedFired += OnDownloadUpdatedFired; if (DevTools) { this.BtnR.Visible = true; this.BtnD.Visible = true; } }
public static int Main(string[] args) { //For Windows 7 and above, best to include relevant app.manifest entries as well Cef.EnableHighDPISupport(); #if NETCOREAPP //We are using our current exe as the BrowserSubProcess //Multiple instances will be spawned to handle all the //Chromium proceses, render, gpu, network, plugin, etc. var subProcessExe = new CefSharp.BrowserSubprocess.BrowserSubprocessExecutable(); var result = subProcessExe.Main(args); if (result > 0) { return(result); } #endif var settings = new CefSettings() { //By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache") }; #if NETCOREAPP //We use our Applications exe as the BrowserSubProcess, multiple copies //will be spawned var exePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; settings.BrowserSubprocessPath = exePath; #endif //Example of setting a command line argument //Enables WebRTC settings.CefCommandLineArgs.Add("enable-media-stream"); //Perform dependency check to make sure all relevant resources are in our output directory. Cef.Initialize(settings, true, browserProcessHandler: null); var browser = new BrowserForm(); Application.Run(browser); return(0); }
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.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); }
static void Main() { string pathCache = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Cache"); if (!Directory.Exists(pathCache)) { Directory.CreateDirectory(pathCache); } if (!Directory.Exists("wcd")) { Directory.CreateDirectory("wcd"); } CefSettings settings = new CefSettings() { CachePath = pathCache }; //settings.RemoteDebuggingPort = 55555; settings.RegisterScheme(new CefCustomScheme { SchemeName = "http", DomainName = "192.168.56.102", SchemeHandlerFactory = new CefSharpSchemeHandlerFactory() }); if (!Cef.Initialize(settings)) { Console.WriteLine("Couldn't initialise CEF"); return; } //CEF.RegisterScheme("test", new TestSchemeHandlerFactory()); //CEF.RegisterJsObject("bound", new BoundObject()); //Application.Run(new TabulationDemoForm()); Application.Run(new fProxyBrowser()); STORE.ClearAll(); Cef.Shutdown(); }
private void Main_Shown(object sender, EventArgs e) { var d = new FolderBrowserDialog() { SelectedPath = @"C:\Users\kian\Desktop\workdir" }; d.ShowDialog(); workingDir = d.SelectedPath; LoadSetting(); var setting = new CefSettings(); if (Proxy) { setting.CefCommandLineArgs.Add("proxy-server", ProxyString); } Cef.Initialize(setting); foreach (var item in HostPriorities) { ListViewItemDic.Add(item, new ListViewItem()); } listView1.Items.Clear(); listView1.Items.AddRange(ListViewItemDic.Values.ToArray()); foreach (var item in Directory.GetDirectories(workingDir)) { if (File.GetAttributes(item).HasFlag(FileAttributes.Directory)) { SerieHolders.Add(SerieHolder.Load(item, workingDir)); } } foreach (var item in SerieHolders) { ListViewItemDic2.Add(item, new ListViewItem()); } listView2.Items.Clear(); listView2.Items.AddRange(ListViewItemDic2.Values.ToArray()); timer1.Enabled = true; }
public void Init() { //指定全局设置和命令行参数 CefSettings settings = new CefSettings(); //语言 settings.Locale = "zh-CN"; settings.AcceptLanguageList = "zh-CN"; settings.LocalesDirPath = @"webbrowerlib\locales\"; //日志输出 settings.LogFile = @"log\LogData.txt"; settings.LogSeverity = LogSeverity.Error; settings.CachePath = "cache"; settings.BrowserSubprocessPath = @"webbrowerlib\CefSharp.BrowserSubprocess.exe"; if (!Cef.IsInitialized) { Cef.Initialize(settings, true, false); } webBrower = new ChromiumWebBrowser("http://rendering/"); webBrower.LoadHtml(Resources.Loading, "http://rendering/"); webBrower.RegisterJsObject("jsObj", new JsEvent(), false); BrowserSettings browserSettings = new BrowserSettings(); browserSettings.DefaultEncoding = "UTF-8"; browserSettings.WebGl = CefState.Enabled; webBrower.BrowserSettings = browserSettings; //禁用右击菜单 webBrower.MenuHandler = new MenuHandler(); webBrower.JsDialogHandler = new JsDialogHandler(); Task.Run(() => { wellInfoService = new WellInfoService(); StringBuilder html = new StringBuilder(); string location = ReadWriteXml.ReadXml("DefaultLocation"); list = wellInfoService.GetWellInfo_List(null); json = JsonConvert.SerializeObject(list); html.AppendFormat(Resources.mapHeader, json, location); html.Append(Resources.mapContent); webBrower.LoadHtml(html.ToString(), "http://rendering/"); }); }
private string completeversionnumber; // holds complete version number for update checking purposes public signInInfo() { InitializeComponent(); // added a trusted Windows 10 64 bit Firefox user agent to prevent login issues with Google CefSettings settings = new CefSettings(); settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0"; Cef.Initialize(settings); updater.Load("https://realslinksoft.wixsite.com/slink-soft-portfolio/project-releases"); // load Slink Soft updater.FrameLoadEnd += new EventHandler <FrameLoadEndEventArgs>(updater_FrameLoadEnd); // Add FrameLoadEnd handler updater.Location = new System.Drawing.Point(-5000, -5000); this.Controls.Add(updater); // add chromium embedded to the UI version = 1; revision = 5; versionDisplay.Text = "Version: " + version + "." + revision; // update version display to UI completeversionnumber = "GDC: " + version + "." + revision; /* Check if the directory exists. If a fresh restart of the client, then create the dirextory and accounts file. Otherwise, read the contents of the * accounts file and update the account list */ if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/SSGoogleDriveClient")) { MessageBox.Show("Welcome to the Slink Soft Google Drive client. To get started, add your account for auto-login.\n" + "(IMPORTANT NOTE: Your information is stored LOCALLY onto your machine and THAT IS IT. No information is sent " + "to Slink Soft. The only communication between the client and Slink Soft is update checks for the client itself." + " If you are still skeptical, please do not use this client. Thank you.)\n\n- §link", "IMPORTANT NOTICE"); } else { updateAccountList(); } // enable all input controls foreach (Control c in this.Controls) { if (c.Name == "emailInput" || c.Name == "passwordInput" || c.Name == "label1" || c.Name == "label2" || c.Name == "addAccount") { c.Enabled = true; c.Visible = true; } } }
private void StartCef() { if (cefStarted) { return; } #if !UNITY_EDITOR #if UNITY_EDITOR CefRuntime.Load("./Assets/Plugins/x86_64"); #else CefRuntime.Load(); #endif var cefMainArgs = new CefMainArgs(new string[] { }); var cefApp = new OffscreenCEFClient.OffscreenCEFApp(); // This is where the code path diverges for child processes. //if (CefRuntime.ExecuteProcess(cefMainArgs, cefApp, IntPtr.Zero) != -1) // Debug.LogError("Could not start the secondary process."); var cefSettings = new CefSettings { //ExternalMessagePump = true, MultiThreadedMessageLoop = false, SingleProcess = true, LogSeverity = CefLogSeverity.Verbose, LogFile = "cef.log", WindowlessRenderingEnabled = true, NoSandbox = true, ExternalMessagePump = true, }; // Start the browser process (a child process). CefRuntime.Initialize(cefMainArgs, cefSettings, cefApp, IntPtr.Zero); #endif DontDestroyOnLoad(this.gameObject.transform.root.gameObject); iStartedCef = true; cefStarted = true; }
public Task Initialize() { return(DoInUi(() => { Window = new Window(); var cefsettings = new CefSettings(); cefsettings.BrowserSubprocessPath = Path.Combine(Environment.CurrentDirectory, "CefSharp.BrowserSubprocess.exe"); cefsettings.LogSeverity = LogSeverity.Verbose; cefsettings.LocalesDirPath = Path.Combine(Environment.CurrentDirectory, "locales"); cefsettings.PackLoadingDisabled = true; if (!Cef.Initialize(cefsettings)) { } Window.Content = Browser = new ChromiumWebBrowser(); Window.Show(); }).ContinueWith((t) => { if (t.IsFaulted) { throw t.Exception; } using (var evt = new ManualResetEvent(false)) { Browser.IsBrowserInitializedChanged += (o, e) => evt.Set(); DoInUi(() => { if (Browser.IsBrowserInitialized) { evt.Set(); } }); evt.WaitOne(); } }, DispatcherThread.TaskFactory.Scheduler)); }
static void Main() { /* * Setup CEF Enviornment */ // For Windows 7 and above. Cef.EnableHighDPISupport(); // Enable browser creation from local file path. var settings = new CefSettings(); settings.RegisterScheme ( new CefCustomScheme { SchemeName = "LocalFiles", DomainName = null, SchemeHandlerFactory = new FolderSchemeHandlerFactory(rootFolder: Environment.CurrentDirectory) } ); // Monitor parent process exit and close subprocesses if parent process exits first // This will at some point in the future becomes the default CefSharpSettings.SubprocessExitIfParentProcessClosed = true; // Allows for website autoplay. settings.CefCommandLineArgs["autoplay-policy"] = "no-user-gesture-required"; // Starts browser in guest mode (a lot of this is already done by default). settings.CefCommandLineArgs.Add("--bwsi", "1"); // Mutes any audio playing in the browser instances, eventually this will be configurable. settings.CefCommandLineArgs.Add("--mute-audio", "1"); /* * Initialize CEF Enviornment & launch Tray Client. */ Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null); Application.Run(new TrayClient()); }
private void Form1_Load(object sender, EventArgs e) { CefSharpSettings.WcfEnabled = true; CefSettings settings = new CefSettings(); Cef.EnableHighDPISupport(); browser.Dock = DockStyle.Fill; guna2Panel2.Controls.Add(browser); browser.TitleChanged += Browser_TitleChanged; this.Text = browser.Text; ProtonMenuHandler handler = new ProtonMenuHandler(); browser.MenuHandler = handler; browser.AddressChanged += Browser_AddressChanged; if (Program.executesJs) { StartJSHandler jshandler = new StartJSHandler(); jshandler.startScript = Program.jsExecuted; browser.RenderProcessMessageHandler = jshandler; } browser.LoadingStateChanged += Browser_LoadingStateChanged; titleBar.ExecuteScriptAsyncWhenPageLoaded("document.body.style.backgroundColor = 'rgb(64, 64, 64)';"); titleBar.ExecuteScriptAsyncWhenPageLoaded("document.body.style.color = 'white';"); titleBar.ExecuteScriptAsyncWhenPageLoaded("document.body.style.overflow = 'hidden';"); titleBar.ExecuteScriptAsyncWhenPageLoaded("document.body.style.marginTop = '5px';"); titleBar.AllowDrop = false; guna2Panel3.Controls.Add(titleBar); titleBar.MenuHandler = handler; ProtonEssentials proton = new ProtonEssentials(this); browser.JavascriptObjectRepository.Register("proton", proton, isAsync: false, options: BindingOptions.DefaultBinder); //Icon = Icon.ExtractAssociatedIcon(Program.iconPath); if (Program.isOverlay) { this.Location = new Point(0, 0); this.TopMost = true; guna2ControlBox1.Visible = false; guna2ControlBox2.Location = guna2ControlBox1.Location; KeyPreview = true; } }
private static void CefInitialize() { var cefSettings = new CefSettings() { CachePath = CefBridge.CachePath, }; cefSettings.CefCommandLineArgs.Add("proxy-server", Models.Settings.NetworkSettings.LocalProxySettingsString); cefSettings.BrowserSubprocessPath = @"lib\CefSharp.BrowserSubprocess.exe"; cefSettings.Locale = "ko-KR"; // cefSettings.LogSeverity = LogSeverity.Verbose; // cefSettings.CefCommandLineArgs.Add("disable-webgl", "1"); // cefSettings.CefCommandLineArgs.Add("disable-gpu", "1"); // cefSettings.CefCommandLineArgs.Add("disable-gpu-vsync", "1"); // cefSettings.CefCommandLineArgs.Add("disable-gpu-compositing", "1"); // cefSettings.SetOffScreenRenderingBestPerformanceArgs(); CefSharpSettings.SubprocessExitIfParentProcessClosed = true; Cef.EnableHighDPISupport(); Cef.Initialize(cefSettings, performDependencyCheck: false, browserProcessHandler: null); }
internal static void Build() { string lib, browser, locales, res; // Assigning file paths to varialbles lib = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"x86\cef\libcef.dll"); browser = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"x86\cef\CefSharp.BrowserSubprocess.exe"); locales = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"x86\cef\locales\"); res = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"x86\cef\"); //var libraryLoader = new CefLibraryHandle(lib); //bool isValid = !libraryLoader.IsInvalid; var settings = new CefSettings(); settings.BrowserSubprocessPath = browser; settings.LocalesDirPath = locales; settings.ResourcesDirPath = res; Cef.Initialize(settings, true, null); }
static CefYoutubeController() { var settings = new CefSettings(); settings.RegisterScheme(new CefCustomScheme { SchemeName = CefSharpSchemeHandlerFactory.SchemeName, SchemeHandlerFactory = new CefSharpSchemeHandlerFactory() }); //if (!CefSharp.Cef.Initialize(settings, shutdownOnProcessExit: true, performDependencyCheck: !DebuggingSubProcess)) //{ // throw new Exception("Unable to Initialize Cef"); //} // The changes for Initialize, but not sure working perfectly. if (!CefSharp.Cef.Initialize(settings)) { throw new Exception("Unable to Initialize Cef"); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var settings = new CefSettings(); settings.CefCommandLineArgs["javascript-harmony"] = "1"; settings.CefCommandLineArgs["allow-file-access-from-files"] = "1"; settings.CefCommandLineArgs["disable-web-security"] = "1"; var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); settings.CachePath = Path.Combine(appDataPath, "MP3CutAd", "cef-cache"); //Perform dependency check to make sure all relevant resources are in our output directory. Cef.Initialize(settings, shutdownOnProcessExit: true, performDependencyCheck: true); Application.Run(new MainForm()); Application.ApplicationExit += OnApplicationExit; }
public Main() { InitializeComponent(); _itemBl = new ItemBL(); UserCount = _itemBl.GetItemCount(); UpdateUserCountLabel(UserCount); var settings = new CefSettings(); Cef.Initialize(settings); jsObj = new JavascriptCallbackObject(); jsObj.UserCount = UserCount; jsObj.UserCountCallback = UpdateUserCountLabel; // Handlers Load += MainForm_Load; Closing += MainForm_Closing; this.btnAddUser.Click += addUser_Click; this.btnListUsers.Click += listUser_Click; }
public App() { //Monitor parent process exit and close subprocesses if parent process exits first //This will at some point in the future becomes the default CefSharpSettings.SubprocessExitIfParentProcessClosed = true; var settings = new CefSettings() { //By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache") }; //Example of setting a command line argument //Enables WebRTC settings.CefCommandLineArgs.Add("enable-media-stream", "1"); settings.CefCommandLineArgs.Add("disable-application-cache", "1"); //Perform dependency check to make sure all relevant resources are in our output directory. Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null); }
private void FormExecute_Load(object sender, EventArgs e) { if (Cef.IsInitialized == false) { var settings = new CefSettings(); CefSharp.Cef.Initialize(settings); } ChromiumWebBrowser browser = new ChromiumWebBrowser("") { Location = new Point(0, 0), Dock = DockStyle.Fill, }; this.Controls.Add(browser); browser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged; browser.FrameLoadEnd += OnFrameLoadEnd; browser.LoadError += OnLoadError; browser.ConsoleMessage += OnConsoleMessage; browser.RequestHandler = new MyRequestHandler(); browser.JsDialogHandler = new JsDialogHandler(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CefSettings settings = new CefSettings(); settings.CachePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\vecksapp"; CefSharp.Cef.Initialize(settings); var mainForm = new mainForm(); var browser = new ChromiumWebBrowser("https://web.whatsapp.com/"); browser.LifeSpanHandler = new vecksappLifeSpanHandler(); mainForm.Controls.Add(browser); mainForm.ShowInTaskbar = false; Application.Run(mainForm); }