Ejemplo n.º 1
0
        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);
            };
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
    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);
        }
    }
Ejemplo n.º 4
0
        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.");
            };
        }
Ejemplo n.º 5
0
        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;
		}
Ejemplo n.º 7
0
 public override void ApplyUpdate()
 {
     BoundObject.Update(ID, ProcessA.Concept, ProcessB.Concept, SequenceSign.Concept);
 }
Ejemplo n.º 8
0
 public override void ApplyUpdate()
 {
     BoundObject.Update(ID, LeftValue.Concept, RightValue.Concept, ComparisonSign.Concept);
 }
Ejemplo n.º 9
0
 public override void ApplyUpdate()
 {
     BoundObject.Update(ID, Area.Concept, Concept.Concept);
 }
Ejemplo n.º 10
0
 public override void ApplyUpdate()
 {
     BoundObject.Update(ID, Whole.Concept, Part.Concept);
 }
Ejemplo n.º 11
0
 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);
 }
Ejemplo n.º 13
0
 public override void ApplyUpdate()
 {
     BoundObject.Update(ID, Ancestor.Concept, Descendant.Concept);
 }