Пример #1
0
        private void WebBrowserCore_RemoteBrowserCreated(object sender, RemoteBrowserCreatedEventArgs e)
        {
            formV8Handler = new FormV8Handler(this);
#if XP
            CfrRuntime.RegisterExtension("nanui/form", NetDimension.NanUI.XP.Properties.Resources.nanui_formExtension, formV8Handler);
#else
            CfrRuntime.RegisterExtension("nanui/form", NetDimension.NanUI.Properties.Resources.nanui_formExtension, formV8Handler);
#endif
        }
Пример #2
0
        public WebBrowserFormImplement(Form form, BrowserCore browser)
        {
            parentForm  = form;
            browserCore = browser;


            browser.RemoteBrowserCreated += (_, e) => {
                formV8Handler = new FormV8Handler(parentForm);
#if XP
                CfrRuntime.RegisterExtension("nanui/form", NetDimension.NanUI.XP.Properties.Resources.nanui_formExtension, formV8Handler);
#else
                CfrRuntime.RegisterExtension("nanui/form", NetDimension.NanUI.Properties.Resources.nanui_formExtension, formV8Handler);
#endif
            };
            browser.LoadHandler.OnLoadEnd += (_, e) => {
                if (e.Frame.IsMain)
                {
                    foreach (var script in delayedScripts)
                    {
                        browserCore.ExecuteJavascript(script.Value);
                    }
                }
            };


            form.Move += (_, e) =>
            {
                if (browserCore != null && browserCore.BrowserHost != null)
                {
                    browserCore.BrowserHost.NotifyMoveOrResizeStarted();
                }
            };



            RegisterActivatedStateChangedHandler();
            RegisterSizeChangedEventHandler();
        }