private void InitializeChromium() { var settings = new CefSettings(); settings.IgnoreCertificateErrors = true; Cef.Initialize(settings, true, null); Browser = new ChromiumWebBrowser { LifeSpanHandler = new MyLifeSpanHandler(), RequestHandler = new MyRequestHandler(), RenderProcessMessageHandler = new MyRenderProcessMessageHandler(), BrowserSettings = { ImageLoading = CefState.Disabled } }; var boundObj = new BoundObject(); Browser.RegisterJsObject("bound", boundObj); DockPanel.Children.Add(Browser); UpdateBindings(); Browser.ConsoleMessage += (sender, eventArgs) => { Debug.WriteLine(eventArgs.Message); }; }
private static void InitializeChromium() { var settings = new CefSettings(); settings.IgnoreCertificateErrors = true; //Perform dependency check to make sure all relevant resources are in our output directory. Cef.Initialize(settings, true, null); // Create the offscreen Chromium Browser. Browser = new ChromiumWebBrowser("about:blank") { LifeSpanHandler = new MyLifeSpanHandler(), RequestHandler = new MyRequestHandler(), RenderProcessMessageHandler = new MyRenderProcessMessageHandler(), BrowserSettings = { ImageLoading = CefState.Disabled } }; var boundObj = new BoundObject(); Browser.RegisterJsObject("bound", boundObj); Browser.ConsoleMessage += (sender, eventArgs) => { Console.WriteLine(eventArgs.Message); }; Browser.WaitForInitialization(); }
void HandleReadyForBindings(int frameId, string path, bool isMainFrame) { if (isMainFrame) { // bind ApplyOptions to "ApplyOptions" in JavaScript m_View.View.BindCall("ApplyOptions", (Action <GameOptions>) this.ApplyOptions); m_View.View.BindCall("GetLatency", (Func <int>) this.GetNetworkLatency); m_View.View.BindCall("GetGameTime", (Func <int>) this.GetGameTime); m_View.View.BindCall("GetMath", (Func <BoundObject>)(() => { return(BoundObject.BindMethods(new MyMath())); })); // triggered by the view when it has loaded m_View.View.RegisterForEvent("ViewReady", (Action)this.ViewReady); } }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { //browser.ShowDevTools(); //CefSharpSettings.LegacyJavascriptBindingEnabled = true; this.browser.Address = AppDomain.CurrentDomain.BaseDirectory + @"index.html"; var obj = new BoundObject(); obj.OnReceiveMsg += Obj_OnReceiveMsg; browser.JavascriptObjectRepository.Register("boundAsync", obj, true, BindingOptions.DefaultBinder); //js是否已成功绑定 browser.JavascriptObjectRepository.ObjectBoundInJavascript += (sender1, e1) => { var name = e1.ObjectName; Debug.WriteLine($"Object {e1.ObjectName} was bound successfully."); }; }
public void InitializeChromium() { var bitness = Environment.Is64BitProcess ? "x64" : "x86"; var version = $"Chromium: {Cef.ChromiumVersion}, CEF: {Cef.CefVersion}, CefSharp: {Cef.CefSharpVersion}, Environment: {bitness}"; DisplayOutput(version); Cef.EnableHighDPISupport(); var settings = new CefSettings(); settings.CefCommandLineArgs.Add("disable-gpu", "1"); //settings.RemoteDebuggingPort = 9222; settings.IgnoreCertificateErrors = true; Cef.Initialize(settings, true, null); Browser = new ChromiumWebBrowser("about:blank") { Dock = DockStyle.Fill, LifeSpanHandler = new MyLifeSpanHandler(), RequestHandler = new MyRequestHandler(), RenderProcessMessageHandler = new MyRenderProcessMessageHandler(), BrowserSettings = { ImageLoading = CefState.Disabled } }; var boundObj = new BoundObject(); Browser.RegisterJsObject("bound", boundObj); toolStripContainer.ContentPanel.Controls.Add(Browser); Browser.LoadingStateChanged += OnLoadingStateChanged; Browser.ConsoleMessage += OnBrowserConsoleMessage; Browser.StatusMessage += OnBrowserStatusMessage; Browser.TitleChanged += OnBrowserTitleChanged; Browser.AddressChanged += OnBrowserAddressChanged; Browser.ConsoleMessage += (sender, eventArgs) => { Debug.WriteLine(eventArgs.Message); }; }
public object ExportObject(BoundObject target, Coherent.UI.Mobile.View view) { return null; }
public override void ApplyUpdate() { BoundObject.Update(ID, ProcessA.Concept, ProcessB.Concept, SequenceSign.Concept); }
public override void ApplyUpdate() { BoundObject.Update(ID, LeftValue.Concept, RightValue.Concept, ComparisonSign.Concept); }
public override void ApplyUpdate() { BoundObject.Update(ID, Area.Concept, Concept.Concept); }
public override void ApplyUpdate() { BoundObject.Update(ID, Whole.Concept, Part.Concept); }
public override void ApplyUpdate() { BoundObject.Update(ID, Concept.Concept, Sign.Concept, Value.Concept); }
public object ExportObject(BoundObject target, Coherent.UI.Mobile.View view) { return(null); }
public override void ApplyUpdate() { BoundObject.Update(ID, Ancestor.Concept, Descendant.Concept); }