Пример #1
0
        // Used to create child (popup) windows.
        internal WebForm(WebView view, int width, int height)
        {
            // Initialize delegates.
            asyncCallback   = (JavascriptAsyncMethodHandler)OnCustomJavascriptAsyncMethod;
            syncCallback    = (JavascriptMethodHandler)OnCustomJavascriptMethod;
            _onDOMMouseMove = (JSFunctionAsyncHandler)onDOMMouseMove;
            // Cache the view.
            webView = view;

            this.Width  = width;
            this.Height = height;

            InitializeComponent();
        }
Пример #2
0
        public WebForm()
        {
            // Initialize delegates.
            asyncCallback   = (JavascriptAsyncMethodHandler)OnCustomJavascriptAsyncMethod;
            syncCallback    = (JavascriptMethodHandler)OnCustomJavascriptMethod;
            _onMyInterval   = (JavascriptAsyncMethodHandler)onMyInterval;
            _onDOMMouseMove = (JSFunctionAsyncHandler)onDOMMouseMove;

            if (!WebCore.IsInitialized)
            {
                WebConfig webConfig = WebConfig.Default;

                // Using our executable as a child rendering process, is not
                // available when debugging in VS.
                if (!Process.GetCurrentProcess().ProcessName.EndsWith("vshost"))
                {
                    // We demonstrate using our own executable as child rendering process.
                    webConfig.ChildProcessPath = Assembly.GetExecutingAssembly().Location;
                }

                // Initialize the WebCore.
                WebCore.Initialize(webConfig);
            }

            // Create and cache a WebSession.
            session = WebCore.CreateWebSession(
                String.Format("{0}{1}Cache", Path.GetDirectoryName(Application.ExecutablePath), Path.DirectorySeparatorChar),
                new WebPreferences()
            {
                SmoothScrolling = true,
                CustomCSS       = Properties.Resources.FontFace_1,
                WebGL           = true,
                // Windowed views, support full hardware acceleration.
                EnableGPUAcceleration = true
            });

            InitializeComponent();

            // We create the view in OnHandleCreated.
        }