Пример #1
0
        protected override void OnLeave(EventArgs e)
        {
            if ((_browser != null) && (_browser.WebBrowserFocus != null))
            {
                _browser.WebBrowserFocus.Deactivate();
            }

            _entered = false;

            base.OnLeave(e);
#if __MonoCS__
            Action EnsureXInputFocusIsRemovedFromReceivedWinFormsControl = () =>
            {
                var control = Control.FromHandle(NativeReplacements.MonoGetFocus());
                if (control is GeckoWebBrowser)
                {
                    return;
                }

                MoveInputFocusBacktoAWinFormsControl();

                // Setting the ActiveControl ensure a Focus event occurs on the control focus is moving to.
                // And this allows us to call RemoveinputFocus at the neccessary time.
                // This prevents keypress still going to the gecko controls when a winform TextBox has focus
                // and the mouse is over a gecko control.
                Form.ActiveForm.ActiveControl = control;
                EventHandler focusEvent = null;
                // Attach a execute once only focus handler to the Non GeckoWebBrowser control focus is moving too...
                focusEvent = (object sender, EventArgs eventArg) =>
                {
                    control.GotFocus -= focusEvent;
                    MoveInputFocusBacktoAWinFormsControl();
                };

                control.GotFocus += focusEvent;
            };

            ProgressUtils.InvokeLaterOnUIThread(() => EnsureXInputFocusIsRemovedFromReceivedWinFormsControl());
#endif
        }
Пример #2
0
        protected override void ShowLaterInternal(string text, string caption, AlertLevel alertLevel)
        {
            MessageBoxIcon icon = GetIconForAlertLevel(alertLevel);

            ProgressUtils.InvokeLaterOnUIThread(() => MessageBox.Show(text, caption, MessageBoxButtons.OK, icon));
        }