public static void Startup() { var settings = new Settings(); if (CEF.Initialize(settings)) { CEF.RegisterJsObject(CallbackObjectName, CallbackHandler); } }
public BrowserWindow() { InitializeComponent(); CefSharp.Settings settings = new Settings(); settings.PackLoadingDisabled = true; CEF.Initialize(settings); Loaded += new RoutedEventHandler(BrowserWindow_Loaded); }
public static void Init() { Settings settings = new Settings(); if (CEF.Initialize(settings)) { CEF.RegisterScheme("test", new SchemeHandlerFactory()); CEF.RegisterJsObject("bound", new BoundObject()); } }
public MainForm() { InitializeComponent(); CEF.Initialize(new Settings()); Menu = GetMenu(); ChangePage("http://localhost:8001/janes/home", null); }
public MainForm() { InitializeComponent(); CEF.Initialize(new Settings()); Menu = GetMenu(); ChangePage("http://www.red-gate.com", null); }
public void SetUp() { var settings = new Settings(); if (!CEF.Initialize(settings)) { Assert.Fail(); } web_view = new WebView(); }
public static void Init(IEventAggregator eventAggregator) { CefSharp.Settings settings = new CefSharp.Settings(); if (CEF.Initialize(settings)) { CEF.RegisterScheme("theme", new ThemeSchemeHandlerFactory()); //CEF.RegisterScheme("test", new SchemeHandlerFactory()); //CEF.RegisterJsObject("bound", new BoundObject()); CEF.RegisterScheme("md", new MarkdownHandlerFactory(eventAggregator, () => DocDirectory)); //CEF.RegisterJsObject("MDLink", new MDLink()); } }
public event PropertyChangedEventHandler PropertyChanged; //To Update Content on the Form public ChromiumSessionWindow(Session session) { InitializeComponent(); _Session = session; WebView.PropertyChanged += OnWebViewPropertyChanged; CEF.Initialize(new Settings()); Header = session.GetSessionServer().GetServerName(); IconSource = session.GetSessionProtocol().ProtocolIconSmall; TabToolTip = session.GetSessionServer().GetServerHostName(); }
public virtual void InitControl() { var settings = new CefSharp.Settings(); string currentPath = Application.StartupPath; settings.AddPluginPath(currentPath + @"\NPSWF32.dll"); if (!CEF.IsInitialized) { CEF.Initialize(settings); } LoadBrowser(); }
public static void Init() { Settings settings = new Settings(); settings.Locale = "zh-CN"; //settings.LogFile = profilePath + "log"; if (CEF.Initialize(settings)) { //CEF.RegisterScheme("test", new SchemeHandlerFactory()); //CEF.RegisterJsObject("bound", new BoundObject()); } }
private void InitChrome() { var settings = new CefSharp.Settings { PackLoadingDisabled = true, }; if (CEF.Initialize(settings)) { _webView = new WebView(); _webView.Loaded += _webView_Loaded; gridBrowser.Children.Add(_webView); } }
public static void InitializeChromiumEmbedded() { _isCefInitialized = true; var settings = new CefSharp.Settings { PackLoadingDisabled = false, }; if (!CEF.Initialize(settings)) { throw new Exception("Could not initialize CEF"); } }
public static void Run() { Settings settings = new Settings(); if (CEF.Initialize(settings)) { CEF.RegisterScheme("play", new SchemeHandlerFactory()); CEF.RegisterJsObject("bound", new BoundObject()); player = new fPlayer(); Application.Run(player); } }
private static void InitCEF() { Settings settings = new Settings() { // PackLoadingDisabled = true, // PackLoadingDisabled is to disable developer tools. LogSeverity = CefSharp.LogSeverity.Error, LogFile = Path.Combine(".\\", "Data", "CefSharp.log"), // Set the log file path. }; if (CEF.Initialize(settings)) { // CEF is initialized Console.WriteLine("CEF is initialized"); } }
private void Initialize() { CEF.Initialize(new Settings() { LogFile = @".\debug.log", LogSeverity = LogSeverity.Verbose }); RegisterAutomationObject(); WebView.RequestHandler = new RequestHandler(); Recorder = new UserActionRecorder { Browser = WebView }; Recorder.UserActionPlaying += RecorderUserActionPlaying; Recorder.UserActionPlayed += RecorderUserActionPlayed; Recorder.FinishedPlaying += RecorderFinishedPlaying; }
public static void Main() { if (!System.Diagnostics.Debugger.IsAttached) { Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); } CefSharp.Settings settings = new CefSharp.Settings(); settings.CachePath = string.Empty; CEF.Initialize(settings); Application.ApplicationExit += Application_ApplicationExit; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); }
static void Main(string[] args) { Settings settings = new Settings(); BrowserSettings browserSettings = new BrowserSettings(); if (!CEF.Initialize(settings, browserSettings)) { Console.WriteLine("Couldn't initialise CEF"); return; } CEF.RegisterScheme("test", new TestSchemeHandlerFactory()); CEF.RegisterJsObject("bound", new BoundObject()); Browser browser = new Browser(); Application.Run(browser); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (!CEF.Initialize(new Settings())) { if (Environment.GetCommandLineArgs().Contains("--type=renderer")) { Environment.Exit(0); } else { return; } } Application.Run(new BrowserForm()); }
public ChromiumControl(string address, params IBindableToJs[] objectsToBind) { address = AddInternalDomain(address); m_Log = ObjectFactory.Get <ILog>(); CEF.Initialize(new Settings()); CEF.SetCookiePath(TheProduct.ProductApplicationData); m_WebView = new WebView(address, new BrowserSettings { WebSecurityDisabled = true }) { Dock = DockStyle.Fill, RequestHandler = new InterceptingRequestHandler(c_InternalDomain, new OwinBasedFileServer(new EmbeddedResourceFileSystemWithDirectorySupport(AssetsAssembly.Get())).Request) }; foreach (var toBind in objectsToBind) { m_WebView.RegisterJsObject(toBind.Name, toBind); } m_WebView.PropertyChanged += (sender, args) => { m_WebView.Address = address; if (args.PropertyName == "IsBrowserInitialized" && Keyboard.IsKeyDown(Key.LeftShift)) { m_WebView.ShowDevTools(); } }; m_WebView.ConsoleMessage += LogConsoleMessage; m_WebView.LifeSpanHandler = new PopupHandler(); // Without this: // The webview isn't initialized for a while after the tab is shown, so we have to wait, polling it. // About 1/3 times when the tab gets created the webview only fills the top left hand corner of it. SizeChanged += ReinitializeAndResize; Controls.Add(m_WebView); m_WebView.MenuHandler = this; }
private void InitCEF(string url) { CEF.Initialize(new Settings { LogSeverity = LogSeverity.Disable, PackLoadingDisabled = true }); BrowserSettings browserSettings = new BrowserSettings { ApplicationCacheDisabled = true, PageCacheDisabled = true }; view = new WebView(string.Empty, browserSettings) { Address = url, RequestHandler = this, Background = Brushes.White }; //register JS class //view.RegisterJsObject("callbackObj", new CallbackObjectForJs()); view.LoadCompleted += view_LoadCompleted; MainGrid.Children.Insert(0, view); }
public WebPageViewer(string url) { InitializeComponent(); CEF.Initialize(new Settings { LogSeverity = LogSeverity.Disable, PackLoadingDisabled = true }); BrowserSettings browserSetting = new BrowserSettings { FullscreenEnabled = true, ApplicationCacheDisabled = true, PageCacheDisabled = true }; _view = new WebView(string.Empty, browserSetting) { Address = url, RequestHandler = this, Background = Brushes.White }; _view.RegisterJsObject("callbackObj", new CallbackObjectForJs()); //_view.LoadCompleted += _view_LoadCompleted; MainGrid.Children.Insert(0, _view); }
public void InitializeWebview() { Settings settings = new Settings { #if DEBUG PackLoadingDisabled = false, #else PackLoadingDisabled = true, #endif CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Battlelogium", "cache") }; CEF.Initialize(settings); BrowserSettings browserSettings = new BrowserSettings { FileAccessFromFileUrlsAllowed = true, UniversalAccessFromFileUrlsAllowed = true, #if CEF_DEVTOOLS DeveloperToolsDisabled = false, #else DeveloperToolsDisabled = true, #endif UserStyleSheetEnabled = true, //UserStyleSheetLocation = "data:text/css;charset=utf-8;base64,Ojotd2Via2l0LXNjcm9sbGJhcnt2aXNpYmlsaXR5OmhpZGRlbn0NCiNjb21tdW5pdHktYmFyIC5vdXRlcmFycm93e2Rpc3BsYXk6bm9uZX0=" UserStyleSheetLocation = "data:text/css;charset=utf-8;base64,I2NvbW11bml0eS1iYXIgLm91dGVyYXJyb3d7ZGlzcGxheTpub25lfQ0KI2NvbW11bml0eS1iYXJ7cGFkZGluZzo1cHggMCFpbXBvcnRhbnR9DQo6Oi13ZWJraXQtc2Nyb2xsYmFye3dpZHRoOjZweDtoZWlnaHQ6NnB4O2JhY2tncm91bmQ6cmdiYSgxOSwyMiwyNiwwLjQpfQ0KOjotd2Via2l0LXNjcm9sbGJhci10cmFja3tiYWNrZ3JvdW5kOnJnYmEoMCwwLDAsMC4xKX0NCjo6LXdlYmtpdC1zY3JvbGxiYXItdGh1bWJ7YmFja2dyb3VuZDpyZ2JhKDAsMCwwLDAuMyl9DQo6Oi13ZWJraXQtc2Nyb2xsYmFyLXRodW1iOmhvdmVye2JhY2tncm91bmQ6cmdiYSgwLDAsMCwwLjQpfQ0KOjotd2Via2l0LXNjcm9sbGJhci10aHVtYjphY3RpdmV7YmFja2dyb3VuZDpyZ2JhKDAsMCwwLC42KX0=", /* UserStyleSheetLocation is the data in userstylesheet.css minified and encoded in utf8 base64 data URI*/ }; this.battlelogWebview = new WebView(this.battlelogURL, browserSettings); this.battlelogWebview.RegisterJsObject("app", javascriptObject); this.battlelogWebview.LoadCompleted += this.LoadCompleted; this.battlelogWebview.PropertyChanged += battlelogWebview_PropertyChanged; this.battlelogWebview.RequestHandler = this; this.IsWebviewInitialized = true; }
public InteropDemo() { InitializeComponent(); string url = "http://127.0.0.1/rispweb/rispservice/ajaxSvrLogin.aspx"; m_cookie = RealsunClientNet.m_CookieContainer.GetCookies(new System.Uri(url))[0].ToString(); CEF.Initialize(new Settings { LogSeverity = LogSeverity.Disable, PackLoadingDisabled = true }); BrowserSettings browserSetting = new BrowserSettings { ApplicationCacheDisabled = true, PageCacheDisabled = true }; setCefCookie(m_cookie); _view = new WebView(string.Empty, browserSetting) { Address = m_url, RequestHandler = this, Background = Brushes.White }; _view.RegisterJsObject("callbackObj", new CallbackObjectForJs()); _view.LoadCompleted += _view_LoadCompleted; MainGrid.Children.Insert(0, _view); /*new code */ //var setting = new CefSharp.CefSettings(); //BrowserSettings a = new BrowserSettings(); //////CEF.Initialize(new Settings { LogSeverity = LogSeverity.Disable, PackLoadingDisabled = true }); //////BrowserSettings browserSetting = new BrowserSettings { ApplicationCacheDisabled = true, PageCacheDisabled = true }; //////_view = new WebView(string.Empty, browserSetting) //////{ ////// Address = url, ////// RequestHandler = this, ////// Background = Brushes.White //////}; //////_view.RegisterJsObject("callbackObj", new CallbackObjectForJs()); //////_view.LoadCompleted += _view_LoadCompleted; //////MainGrid.Children.Insert(0, _view); //_view = new CefSharp.Wpf.ChromiumWebBrowser(); //if (!Cef.IsInitialized) //{ // Cef.Initialize(setting, true, false); //} //_view.Loaded += _view_Loaded; //_view.Address = m_url; //MainGrid.Children.Insert(0, _view); ////_view.Load(m_url); ////CEF.Initialize(new Settings { LogSeverity = LogSeverity.Disable, PackLoadingDisabled = true }); ///*old code */ ////var setting = new CefSharp.CefSettings(); ////if (!Cef.IsInitialized) ////{ CefSharp.Cef.Initialize(setting, true, false); } ////var webView = new CefSharp.Wpf.ChromiumWebBrowser(); ////this.Content = webView; ////setCefCookie(m_cookie); ////webView.Address = m_url; ////setcookie(m_cookie); ////WebBrowser.Url = new System.Uri(m_url); }
public GoogleV3TileSchema(string gmeClientID, string googleChannel, string referer, GoogleV3TileSource.MapTypeId mapType) { MapType = mapType; Height = 256; Width = 256; Extent = new Extent(-20037508.342789, -20037508.342789, 20037508.342789, 20037508.342789); OriginX = -20037508.342789; OriginY = 20037508.342789; Name = "GoogleSchema"; Format = "png"; Axis = AxisDirection.InvertedY; Srs = "EPSG:3857"; m_gmeClientID = gmeClientID; m_googleChannel = googleChannel; m_referer = referer; if (m_cachedUrLs.ContainsKey(mapType + "_base")) { MapUrlTemplates = m_cachedUrLs[mapType + "_base"]; } if (m_cachedUrLs.ContainsKey(mapType + "_overlay")) { OverlayUrlTemplates = m_cachedUrLs[mapType + "_overlay"]; } m_appContext = new ApplicationContext(); /* var frm = new Form(); * frm.Show(); * frm.Size = new System.Drawing.Size(600, 400); * Label l = new Label(); * l.Text = "Test"; * * WebBrowser bw = new WebBrowser(); * bw.Size = new System.Drawing.Size(600, 400); * frm.Size = new System.Drawing.Size(600, 400); * * frm.Controls.Add(l); * frm.Controls.Add(bw); */ wbThread = new Thread(() => { try { #if USE_CefSharp var settings = new CefSharp.Settings { PackLoadingDisabled = true, }; if (CEF.Initialize(settings)) { m_webView = new WebView(); m_webView.PropertyChanged += WebViewOnPropertyChanged; m_webView.Address = referer; } #else m_webBrowser = new WebBrowser(); m_webBrowser.Navigating += m_WebBrowser_Navigating; m_webBrowser.Visible = true; m_webBrowser.ScrollBarsEnabled = false; m_webBrowser.Size = new System.Drawing.Size(600, 400); m_webBrowser.ScriptErrorsSuppressed = true; m_webBrowser.DocumentCompleted += m_WebBrowser_DocumentCompleted; //bw.Invoke(new MethodInvoker(delegate //{ // bw.Navigating += new WebBrowserNavigatingEventHandler(m_WebBrowser_Navigating); // bw.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(m_WebBrowser_DocumentCompleted); // bw.DocumentText = // "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><style>BODY { background-color: red;}</style></head><body></body></html>"; //})); //m_webBrowser = bw; if (!string.IsNullOrEmpty(referer)) { m_webBrowser.Navigate(referer); } else { m_webBrowser.DocumentText = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><body></body></html>"; } #endif if (m_appContext != null) { Application.Run(m_appContext); } } catch (Exception ee) { m_logger.Error("Exception in WebBrowserThread, quitting", ee); } }); wbThread.Name = "WebBrowser Thread"; wbThread.SetApartmentState(ApartmentState.STA); wbThread.Start(); if (m_logger.IsDebugEnabled) { m_logger.Debug("WebBrowserThread Started"); } }