示例#1
0
        private void InitBrowser()
        {
            Browser = new EnhancedChromiumWebBrowser(string.Empty)
            {
                BrowserSettings = CefBootstrapper.GetStandardBrowserSettings(),
                Dock            = DockStyle.Fill,
            };
            Browser.ConsoleMessageUiThreadSafe += Browser_ConsoleMessageUiThreadSafe;
            Browser.AddressChangedUiThreadSafe += Browser_AddressChangedUiThreadSafe;

            // register objects for JavaScript
            //   must happen immediately after Browser instantiated
            //   per https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#3-how-do-you-expose-a-net-class-to-javascript
            _toDoStoreProxy = new ToDoStoreProxy();
            _toDoStoreProxy.StoreUpdated += _toDoStoreProxy_StoreUpdated;
            Browser.RegisterJsObject("todoStoreProxy", _toDoStoreProxy);

            splitTodos.Panel1.Controls.Add(Browser);
        }
示例#2
0
        private void InitBrowser()
        {
            Browser = new EnhancedChromiumWebBrowser(string.Empty)
            {
                BrowserSettings = CefBootstrapper.GetStandardBrowserSettings(),
                Dock = DockStyle.Fill,
            };
            Browser.ConsoleMessageUiThreadSafe += Browser_ConsoleMessageUiThreadSafe;
            Browser.AddressChangedUiThreadSafe += Browser_AddressChangedUiThreadSafe;

            // register objects for JavaScript
            //   must happen immediately after Browser instantiated
            //   per https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#3-how-do-you-expose-a-net-class-to-javascript
            _toDoStoreProxy = new ToDoStoreProxy();
            _toDoStoreProxy.StoreUpdated += _toDoStoreProxy_StoreUpdated;
            Browser.RegisterJsObject("todoStoreProxy", _toDoStoreProxy);

            splitTodos.Panel1.Controls.Add(Browser);
        }