예제 #1
0
        protected override void OnDomKeyUp(object sender, EventArgs ea)
        {
            DomKeyEventArgs e       = new DomKeyEventArgs(ea);
            var             content = _browser.Document.GetElementById("main");

            if (!(e.KeyCode == (uint)Keys.Enter))             // carriage return
            {
                _keyPressed = true;
                Text        = content.TextContent;
            }
        }
예제 #2
0
        protected virtual void OnDomKeyDown(object sender, EventArgs ea)
        {
            DomKeyEventArgs e = new DomKeyEventArgs(ea);

            if (_inFocus)
            {
                if (_handleEnter && !MultiParagraph && e.KeyCode == (uint)Keys.Enter)                 // carriage return
                {
                    e.Handled = true;
                }
#if __MonoCS__
                SendKey(e);
#else
                if ((e.KeyCode == (uint)Keys.Tab) && !e.CtrlKey && !e.AltKey)
                {
                    e.Handled = true;
                    if (e.ShiftKey)
                    {
                        if (!ParentForm.SelectNextControl(this, false, true, true, true))
                        {
                            Debug.WriteLine("Failed to advance");
                        }
                    }
                    else
                    {
                        if (!ParentForm.SelectNextControl(this, true, true, true, true))
                        {
                            Debug.WriteLine("Failed to advance");
                        }
                    }
                    e.Handled = true;
                    return;
                }
#endif
                OnKeyDown(new KeyEventArgs((Keys)e.KeyCode));
            }
        }
예제 #3
0
        protected virtual void SendKey(DomKeyEventArgs e)
        {
            var builder = new StringBuilder();

            switch (e.KeyCode)
            {
            case (uint)Keys.Tab:
                if (e.CtrlKey)
                {
                    builder.Append("^");
                }
                if (e.AltKey)
                {
                    builder.Append("%");
                }
                if (e.ShiftKey)
                {
                    builder.Append("+");
                }
                builder.Append("{TAB}");
                break;

            case (uint)Keys.Up:
                builder.Append("{UP}");
                break;

            case (uint)Keys.Down:
                builder.Append("{DOWN}");
                break;

            case (uint)Keys.Left:
                builder.Append("{LEFT}");
                break;

            case (uint)Keys.Right:
                builder.Append("{RIGHT}");
                break;

            case (uint)Keys.Escape:
                builder.Append("{ESC}");
                break;

            case (uint)Keys.N:
                if (e.CtrlKey)
                {
                    builder.Append("^n");
                }
                break;

            case (uint)Keys.F:
                if (e.CtrlKey)
                {
                    builder.Append("^f");
                }
                break;

            case (uint)Keys.Delete:
                builder.Append("{DEL}");
                break;

            case (uint)Keys.Enter:
                builder.Append("{ENTER}");
                break;
            }
            string result = builder.ToString();

            if (!String.IsNullOrEmpty(result))
            {
                SendKeys.Send(result);
            }
        }
예제 #4
0
		protected override void OnDomKeyUp(object sender, EventArgs ea)
		{
			DomKeyEventArgs e = new DomKeyEventArgs(ea);
			var content = _browser.Document.GetElementById("main");
			if (!(e.KeyCode == (uint)Keys.Enter)) // carriage return
			{
				_keyPressed = true;
				Text = content.TextContent;
			}
		}
예제 #5
0
		protected virtual void SendKey(DomKeyEventArgs e)
		{
			var builder = new StringBuilder();
			switch (e.KeyCode)
			{
				case (uint)Keys.Tab:
					if (e.CtrlKey)
					{
						builder.Append("^");
					}
					if (e.AltKey)
					{
						builder.Append("%");
					}
					if (e.ShiftKey)
					{
						builder.Append("+");
					}
					builder.Append("{TAB}");
					break;
				case (uint)Keys.Up:
					builder.Append("{UP}");
					break;
				case (uint)Keys.Down:
					builder.Append("{DOWN}");
					break;
				case (uint)Keys.Left:
					builder.Append("{LEFT}");
					break;
				case (uint)Keys.Right:
					builder.Append("{RIGHT}");
					break;
				case (uint)Keys.Escape:
					builder.Append("{ESC}");
					break;
				case (uint)Keys.N:
					if (e.CtrlKey)
					{
						builder.Append("^n");
					}
					break;
				case (uint)Keys.F:
					if (e.CtrlKey)
					{
						builder.Append("^f");
					}
					break;
				case (uint)Keys.Delete:
					builder.Append("{DEL}");
					break;
				case (uint)Keys.Enter:
					builder.Append("{ENTER}");
					break;
			}
			string result = builder.ToString();
			if (! String.IsNullOrEmpty(result))
			{
				SendKeys.Send(result);
			}
		}
예제 #6
0
		protected virtual void OnDomKeyDown(object sender, EventArgs ea)
		{
			DomKeyEventArgs e = new DomKeyEventArgs(ea);
			if (_inFocus)
			{
				if (_handleEnter && !MultiParagraph && e.KeyCode == (uint)Keys.Enter) // carriage return
				{
					e.Handled = true;
				}
#if __MonoCS__
				SendKey(e);
#else
				if ((e.KeyCode == (uint)Keys.Tab) && !e.CtrlKey && !e.AltKey)
				{
					e.Handled = true;
					if (e.ShiftKey)
					{
						if (!ParentForm.SelectNextControl(this, false, true, true, true))
						{
							Debug.WriteLine("Failed to advance");
						}
					}
					else
					{
						if (!ParentForm.SelectNextControl(this, true, true, true, true))
						{
							Debug.WriteLine("Failed to advance");
						}
					}
					e.Handled = true;
					return;
				}

#endif
				OnKeyDown(new KeyEventArgs((Keys)e.KeyCode));
			}
		}