Пример #1
0
        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);

            SciterApi.SciterSetOption(IntPtr.Zero, SciterXDef.SCITER_RT_OPTIONS.SCITER_SET_DEBUG_MODE, new IntPtr(1));

            SciterWindow = SciterWindow
                           .CreateChildWindow(Handle);

            Host.SetupWindow(SciterWindow)
            .AttachEventHandler(HostEventHandler);

            if (LoadUri != null)
            {
                var loadUriEventArgs = new LoadUriEventArgs();

                LoadUri?.Invoke(this, loadUriEventArgs);
                Host.Window.TryLoadPage(loadUriEventArgs.Uri);
            }
            else
            {
                var loadHtmlEventArgs = new LoadHtmlEventArgs()
                {
                    Html = Html
                };

                LoadHtml?.Invoke(this, loadHtmlEventArgs);
                Host.Window.LoadHtml(loadHtmlEventArgs?.Html ?? this.Html ?? string.Format(DEFAULT_HTML, Name));
            }

            OnClientSizeChanged(EventArgs.Empty);
            Host.Window.Show();
            //Host.ConnectToInspector();
        }
Пример #2
0
        protected override void OnHandleCreated(EventArgs e)
        {
            if (this.DesignMode)
            {
                this.DoubleBuffered = true;
                return;
            }

            SciterWindow = SciterWindow
                           .CreateChildWindow(Handle);

            this.WindowCreated?.Invoke(this, new WindowCreatedEventArgs(SciterWindow));

            if (SciterWindow != null && SciterWindow?.Handle != IntPtr.Zero)
            {
                //var loadHtmlEventArgs = new LoadHtmlEventArgs()
                //{
                //	Html = this.Html
                //};

                //LoadHtml?.Invoke(this, loadHtmlEventArgs);
                //
                //SciterWnd.LoadHtml(loadHtmlEventArgs?.Html ?? this.Html ?? DEFAULT_HTML);

                SciterWindow?.Show(this.Visible);
            }

            base.OnHandleCreated(e);
        }
Пример #3
0
        protected override HandleRef BuildWindowCore(HandleRef hwndParent)
        {
            _wnd = new SciterWindow();
            _wnd.CreateChildWindow(hwndParent.Handle);
            _wnd.LoadHtml("<style>html { background: silver; }</style> <h1>Hello world!</h1>");

            return(new HandleRef(this, _wnd._hwnd));
        }
Пример #4
0
        protected override HandleRef BuildWindowCore(HandleRef hwndParent)
        {
            _wnd = new SciterWindow();
            _wnd.CreateChildWindow(hwndParent.Handle);

            // Create the SciterHost to handle window-level events
            _host = new Host(_wnd);

            // Load the HTML
            _wnd.LoadHtml(@"
<script type='text/tiscript'>
	$(h1).text = view.Host_Msg();
</script>

<h1 style='color: blue' />
");

            return(new HandleRef(this, _wnd._hwnd));
        }
Пример #5
0
            protected override HandleRef BuildWindowCore(HandleRef hwndParent)
            {
                Debug.Assert(_wnd == null);

                OmniViewHost.Setup();                // ensures creating the dummy window before the child one
                _wnd = new SciterWindow();
                _wnd.CreateChildWindow(hwndParent.Handle, SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_CHILD | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_OWNS_VM | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_ENABLE_DEBUG);
                _wnd.ModifyStyleEx(PInvokeWindows.SetWindowLongFlags.WS_EX_CLIENTEDGE, 0);
                _wnd.SetSciterOption(SciterXDef.SCITER_RT_OPTIONS.SCITER_SET_DEBUG_MODE, new IntPtr(1));                // SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_ENABLE_DEBUG don't work
                Utils.DebugOutputString("BuildWindowCore - " + _wnd._hwnd.ToString());

                _host = new OmniViewHost(_wnd);
                _host.SetupPage("host.html");

                if (OnCreated != null)
                {
                    OnCreated(null, null);
                }

                return(new HandleRef(this, _wnd._hwnd));
            }