Example #1
0
        //--------------------------------------------------------------------------------------------------------------------------------------------------------------------

        public void txtBoxDescription_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                string keyVal;
                string keyCd;
                string searchKey;

                ManualBilling mb = new ManualBilling();

                keyVal = e.KeyValue.ToString(); //convert and assign pressed keyValue
                keyCd  = e.KeyCode.ToString();  //convert and assign pressed keystring



                KeyPressEvent kpe = new KeyPressEvent();
                searchKey = kpe.manualSearchkey(keyVal, keyCd, "Billingform", "des", this); //call manualSearchkey function



                if (searchKey == "exit")
                {
                    this.Close();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error Occured, Please Try Again, " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        public void textBox6_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                string keyVal;
                string keyCd;
                string searchKey;



                keyVal = e.KeyValue.ToString();          //keycode value
                keyCd  = e.KeyCode.ToString().ToLower(); //character


                KeyPressEvent kpe = new KeyPressEvent();

                searchKey = kpe.manualSearchkey(keyVal, keyCd, "admin", "search", this);



                if (searchKey == "exit")
                {
                    this.Close();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error Occured, Please Try Again, " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        public bool DoKeyPress(KeyPressEvent e)
        {
            if (!active)
            {
                return(false);
            }

            if (currentString.Length < 1024)
            {
                bool allowCharacter = false;

                if (font != null)
                {
                    allowCharacter = e.KeyChar >= 32 && font.IsCharacterInitialized(e.KeyChar);
                }
                else
                {
                    allowCharacter = e.KeyChar >= 32 && e.KeyChar < 128;
                }

                if (allowCharacter)
                {
                    currentString += e.KeyChar.ToString();
                }
            }

            return(true);
        }
Example #4
0
        protected override bool OnKeyPress(KeyPressEvent e)
        {
            if (Focused && IsEnabledInHierarchy() && browserHost != null)
            {
                browserHost.SendFocusEvent(true);

                try
                {
                    //_logger.Debug(string.Format("KeyDown: system key {0}, key {1}", arg.SystemKey, arg.Key));
                    CefKeyEvent keyEvent = new CefKeyEvent()
                    {
                        EventType      = CefKeyEventType.Char,
                        WindowsKeyCode = (int)e.KeyChar
                    };

                    keyEvent.Modifiers = GetCurrentKeyboardModifiers();

                    browserHost.SendKeyEvent(keyEvent);
                }
                catch (Exception ex)
                {
                    Log.Error("WebBrowserControl: Caught exception in OnKeyDown(): " + ex.Message);
                }

                //arg.Handled = true;

                return(true);
            }

            return(base.OnKeyPress(e));
        }
Example #5
0
        private void OnKeyPressed(object sender, KeyPressEvent e)
        {
            switch (e.Key.Key)
            {
            case ConsoleKey.LeftArrow:
                e.State.ActiveComponent = Parent;
                e.Rerender = true;
                e.Cancel   = true;
                break;

            case ConsoleKey.UpArrow:
                _tabIndex = (_tabIndex - 1).Mod(_items.Length + 1);
                SetFocus(e.State);
                e.Rerender = true;
                e.Cancel   = true;
                break;

            case ConsoleKey.Enter:
            case ConsoleKey.DownArrow:
            case ConsoleKey.Tab:
                _tabIndex = (_tabIndex + 1) % (_items.Length + 1);
                SetFocus(e.State);
                e.Rerender = true;
                e.Cancel   = true;
                break;
            }
        }
Example #6
0
        protected override IntPtr CustomHookProc(IntPtr wParam, IntPtr lParam)
        {
            KBDLLHOOKSTRUCT kbd =
                (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(KBDLLHOOKSTRUCT));
            bool injected = (kbd.flags & (uint)LLKHF.INJECTED) != 0;

            switch ((WM)wParam)
            {
            case WM.KEYDOWN:
            case WM.SYSKEYDOWN:
                if (GetAsyncKeyState((int)kbd.vkCode) >= 0 && KeyDownEvent?.Invoke(this, kbd.vkCode, injected) == true)
                {
                    return((IntPtr)(-1));
                }
                if (KeyPressEvent?.Invoke(this, kbd.vkCode, injected) == true)
                {
                    return((IntPtr)(-1));
                }
                break;

            case WM.KEYUP:
            case WM.SYSKEYUP:
                if (KeyUpEvent?.Invoke(this, kbd.vkCode, injected) == true)
                {
                    return((IntPtr)(-1));
                }
                break;
            }
            return(IntPtr.Zero);
        }
Example #7
0
 private void createServerPorttext_KeyPress(KeyPressEvent e)
 {
     if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "\\d+"))
     {
         SetInfo("Invalid port, try a numbers value > 0 and less then 65535", true);
     }
 }
 public void OnKeyPress(KeyPressEvent @event)
 {
     if (@event.KeysPressed == Keys.J)
     {
         GameHelper.ShowScreen(new GuiMapSettings());
     }
 }
Example #9
0
 public void HandleKeyPress(KeyPressEvent e)
 {
     OnKeyPress(e);
     if (!e.Handled && Parent != null)
     {
         Parent.HandleKeyPress(e);
     }
 }
Example #10
0
        void IScreen.KeyPress(KeyPressEvent e)
        {
            var widget = keyboardFocus;

            if (widget != null)
            {
                widget.HandleKeyPress(e);
            }
        }
Example #11
0
        private void RaiseKeyPressEvent(KeyEventArgs args)
        {
            if (FocusedElement == null)
            {
                return;
            }

            KeyPressEvent.RaiseEvent(FocusedElement, args);
        }
Example #12
0
 private void HandleEvent(KeyPressEvent eve)
 {
     if (eve.Keys == null)
     {
         return;
     }
     BindingsKeyPress.TryGetValue(eve.Keys, out var act);
     act?.Invoke();
 }
Example #13
0
        private void HandleEvent(KeyPressEvent eve)
        {
            if (eve.Keys != null)
            {
                Debug.WriteLine($"KPr, mod:{eve.Keys.Modifiers}, k: {eve.Keys.KeyPressed}, k_char{eve.Key}");
            }

            //Application.Current.MainWindow.Topmost = true;
        }
Example #14
0
 protected override void OnKeyPress(KeyPressEvent e)
 {
     if (char.IsControl(e.KeyChar))
     {
         return;
     }
     InsertText(caretIndex, e.KeyChar);
     CaretIndex++;
     e.Handled = true;
 }
        internal bool PerformKeyPress(Viewport viewport, KeyPressEvent e)
        {
            var handled = OnKeyPress(viewport, e);

            if (!handled)
            {
                KeyPress?.Invoke(this, viewport, e, ref handled);
            }
            return(handled);
        }
Example #16
0
        protected override bool OnKeyPress(KeyPressEvent e)
        {
            //Game mode
            if (gameMode != null && gameMode.ProcessInputMessage(this, new InputMessageKeyPress(e.KeyChar)))
            {
                return(true);
            }

            return(base.OnKeyPress(e));
        }
Example #17
0
 public void HandleInput(KeyPressEvent e)
 {
     TriggerAllMapped(new ControlDevice.TriggerEventArgs
     {
         FloatX = (e.XPosition / (float)GridWidth),
         FloatY = (e.YPosition / (float)GridHeight),
         X      = e.XPosition,
         Y      = e.YPosition
     });
 }
 /// <summary>
 /// Register a method to hook up to KeyDown events and the KeyCodes to listen for
 /// </summary>
 /// <param name="keyEvent">
 /// Method to call when the Keydown event occurs
 /// </param>
 /// <param name="keys">
 /// The Keycodes to listen for (pass in multiple keys separated by commas)
 /// </param>
 public void RegisterKeysDown(KeyPressEvent keyEvent, params KeyCode[] keys)
 {
     if (!initialized)
     {
         Init();
     }
     foreach (KeyCode key in keys)
     {
         RegisterKeyDown(keyEvent, key);
     }
 }
 /// <summary>
 /// Register a method to hook up to KeyHold events and the KeyCodes to listen for
 /// </summary>
 /// <param name="keyEvent">
 /// Method to call when the KeyHold event occurs
 /// </param>
 /// <param name="keys">
 /// The Keycodes to listen for (pass in multiple keys separated by commas)
 /// </param>
 public void RegisterKeysHold(KeyPressEvent keyEvent, params KeyCode[] keys)
 {
     if (!initialized)
     {
         Init();
     }
     foreach (KeyCode key in keys)
     {
         RegisterKeyHold(keyEvent, key);
     }
 }
Example #20
0
 private void OnKeyPressed(object sender, KeyPressEvent e)
 {
     if (e.Key.Key != ConsoleKey.Enter)
     {
         return;
     }
     Value = !(bool)Value;
     Console.Beep();
     e.Cancel   = true;
     e.Rerender = true;
 }
 /// <summary>
 /// Deregister methods from the event for the passed KeyCodes
 /// </summary>
 /// <param name="keyEvent"></param>
 /// <param name="keys"></param>
 public void DeregisterKeysDown(KeyPressEvent keyEvent, params KeyCode[] keys)
 {
     if (!initialized)
     {
         Init();
     }
     foreach (KeyCode key in keys)
     {
         DeregisterKeyDown(key, keyEvent);
     }
 }
 /// <summary>
 /// Deregister methods from the event for the passed KeyCodes
 /// </summary>
 /// <param name="keyEvent"></param>
 /// <param name="keys"></param>
 public void DeregisterKeysUp(KeyPressEvent keyEvent, params KeyCode[] keys)
 {
     if (!initialized)
     {
         Init();
     }
     foreach (KeyCode key in keys)
     {
         DeregisterKeyUp(key, keyEvent);
     }
 }
Example #23
0
        //------------------------------------------------------------------------------------------------------------------------------------------------------------------------



        public void dataGridView1_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                string keyVal;



                keyVal = e.KeyValue.ToString();

                if (int.Parse(keyVal) == 40)
                {
                    if (dataGridView1.RowCount != 0 || dataGridView1.RowCount != 1)
                    {
                        KeyPressEvent kpe = new KeyPressEvent();
                        kpe.downArrow("mb", "dgv", this); //mb=ManualBilling, dgv=DataGridView
                    }
                }
                else if (int.Parse(keyVal) == 38)
                {
                    KeyPressEvent kpe = new KeyPressEvent();

                    kpe.upArrow("mb", "dgv", this);
                }
                else if (int.Parse(keyVal) == 13)
                {
                    if (dataGridView1.RowCount != 0)
                    {
                        KeyPressEvent kpe = new KeyPressEvent();
                        kpe.enterButton("mb", "dgv", this, billingform);
                    }
                }

                else if (int.Parse(keyVal) == 27)
                {
                    ActiveControl                 = txtBoxDescription;          // focus on Description textbox
                    dataGridView1.BorderStyle     = BorderStyle.Fixed3D;        //change borderStyle to identify active control
                    txtBoxDescription.BorderStyle = BorderStyle.FixedSingle;    //change borderStyle to identify active control
                    txtBoxDescription.Select(txtBoxDescription.Text.Length, 0); //move cursor into the end of text in the textbox
                }

                else
                {
                    if (int.Parse(keyVal) < 65 && int.Parse(keyVal) > 105 && int.Parse(keyVal) != 32)
                    {
                        SystemSounds.Hand.Play();
                    }
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error Occured, Please Try Again, " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #24
0
 protected override void OnKeyPress(KeyPressEvent e)
 {
     if (char.IsNumber(e.KeyChar))
     {
         int option = (e.KeyChar == '0') ? 10 : (e.KeyChar - '1');
         if (option < optionCount)
         {
             Select(option);
         }
         e.Handled = true;
     }
 }
    private void KeyHold(KeyCode key)
    {
        KeyPressEvent keyEvent = null;

        if (keyHoldEvents.TryGetValue(key, out keyEvent))
        {
            if (keyEvent != null)
            {
                keyEvent(key);
            }
        }
    }
 private void RegisterKeyHold(KeyPressEvent keyEvent, KeyCode key)
 {
     if (keyHoldEvents.ContainsKey(key))
     {
         keyHoldEvents[key] += keyEvent;
     }
     else
     {
         AddKeyToCheck(key);
         keyHoldEvents.Add(key, keyEvent);
     }
 }
        //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



        public void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                string keyVal = e.KeyValue.ToString();


                if (int.Parse(keyVal) > 95 && int.Parse(keyVal) < 106)
                {
                    string key = e.KeyCode.ToString();
                    key = key.Substring(6, key.Length - 6);

                    textBox2.ReadOnly = false;
                    if (textBox2.Text.Length < 4)
                    {
                        textBox2.Text = textBox2.Text + key;
                    }
                    textBox2.Select(textBox2.Text.Length, 0);
                    textBox2.ReadOnly = true;
                }

                else if (int.Parse(keyVal) == 8) //validate BackSpace---------------------------------------------------------------
                {
                    if (textBox2.Text.Length != 0)
                    {
                        textBox2.Text = textBox2.Text.Substring(0, textBox2.Text.Length - 1); //remove last character from the text of the textbox

                        textBox2.Select(textBox2.Text.Length, 0);                             //move cursor into the end of text in the textbox
                    }
                    else
                    {
                        SystemSounds.Hand.Play();
                    }
                }
                else if (int.Parse(keyVal) == 37 || int.Parse(keyVal) == 39)
                {
                }
                else if (int.Parse(keyVal) == 13)
                {
                    KeyPressEvent kpe = new KeyPressEvent();
                    kpe.enterButton("bf", "qty", this);
                }
                else
                {
                    SystemSounds.Hand.Play();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error Occured, Please Try Again, " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #28
0
        public async Task <Result> KeyPress([FromBody] KeyPressEvent evt)
        {
            logger.LogInformation("{0} {1}", evt.Key, evt.KeyCode);

            Cached.Add((char)evt.KeyCode);
            await HubFunctions.FireKeyPress(hub.Clients, evt);

            await HubFunctions.FireSummary(hub.Clients, Cached.Dict);

            return(new Result {
                Success = true
            });
        }
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            if (controlManager != null)
            {
                KeyPressEvent keyEvent = new KeyPressEvent(e.KeyChar);
                if (controlManager.DoKeyPress(keyEvent))
                {
                    e.Handled = true;
                }
            }
        }
Example #30
0
 public static TextTypingResult ToDbo(Typing.TextTypingResult state, string userSessionId)
 {
     return(new TextTypingResult
     {
         Id = state.TextTypingResultId,
         TypingSessionTextIndex = state.TypingSessionTextIndex,
         StartedTypingUtc = state.StartedTypingUtc,
         SubmittedResultsUtc = state.SubmittedResultsUtc,
         Events = state.Events
                  .Select((e, index) => KeyPressEvent.ToDbo(e, state.TextTypingResultId, index))
                  .ToList(),
         UserSessionId = userSessionId
     });
 }
Example #31
0
        public void RegisterDesktopKeyboardInput(object window)
        {
            Game game = (Game)window;

            game.Window.TextInput += (s, a) =>
            {
                if (a.Character == '\t')
                {
                    return;
                }

                KeyPressEvent.Invoke(a.Character, EventArgs.Empty);
            };
        }
Example #32
0
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            if (viewport != null)
            {
                KeyPressEvent keyEvent = new KeyPressEvent(e.KeyChar);
                bool          handled  = false;
                viewport.PerformKeyPress(keyEvent, ref handled);
                if (handled)
                {
                    e.Handled = true;
                }
            }
        }
Example #33
0
 protected override bool OnKeyPress( KeyPressEvent e )
 {
     if( EngineConsole.Instance.OnKeyPress( e ) )
         return true;
     if( ScreenControlManager.Instance != null )
         if( ScreenControlManager.Instance.DoKeyPress( e ) )
             return true;
     return base.OnKeyPress( e );
 }
Example #34
0
        protected override bool OnKeyPress( KeyPressEvent e )
        {
            if( Focused && IsEnabledInHierarchy() && browserHost != null )
            {
                browserHost.SendFocusEvent( true );

                try
                {
                    //_logger.Debug(string.Format("KeyDown: system key {0}, key {1}", arg.SystemKey, arg.Key));
                    CefKeyEvent keyEvent = new CefKeyEvent()
                    {
                        EventType = CefKeyEventType.Char,
                        WindowsKeyCode = (int)e.KeyChar
                    };

                    keyEvent.Modifiers = GetCurrentKeyboardModifiers();

                    browserHost.SendKeyEvent( keyEvent );
                }
                catch( Exception ex )
                {
                    Log.Error( "WebBrowserControl: Caught exception in OnKeyDown(): " + ex.Message );
                }

                //arg.Handled = true;

                return true;
            }

            return base.OnKeyPress( e );
        }
 private void createServerPorttext_KeyPress(KeyPressEvent e)
 {
     if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "\\d+"))
     {
         SetInfo("Invalid port, try a numbers value > 0 and less then 65535", true);
     }
 }
        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            base.OnKeyPress(e);

            if (controlManager != null)
            {
                KeyPressEvent keyEvent = new KeyPressEvent(e.KeyChar);
                if (controlManager.DoKeyPress(keyEvent))
                    e.Handled = true;
            }
        }
 protected override bool OnKeyPress(KeyPressEvent e)
 {
     return base.OnKeyPress(e);
 }
        protected override bool OnKeyPress(KeyPressEvent e)
        {
            if (EngineConsole.Instance != null)
                if (EngineConsole.Instance.DoKeyPress(e))
                    return true;
            if (controlManager != null && !IsScreenFadingOut())
                if (controlManager.DoKeyPress(e))
                    return true;

            return base.OnKeyPress(e);
        }
Example #39
0
		protected override bool OnKeyPress(KeyPressEvent e)
		{
			if (!base.Focused || !base.IsEnabledInHierarchy())
			{
				return base.OnKeyPress(e);
			}
			if (this.Text.Length < mMaxCharacters)
			{
				bool validChar = false;
				if (EngineApp.Instance.ScreenGuiRenderer != null)
				{
					validChar = (e.KeyChar >= ' ') && EngineApp.Instance.ScreenGuiRenderer.DefaultFont.IsCharacterInitialized(e.KeyChar);
				}
				else
				{
					// Non-Control character and within the basic ASCII range
					validChar = (e.KeyChar >= ' ') && (e.KeyChar < '\x0080');
				}
				if (validChar)
				{
					if (mSelecting)
					{
						DeleteSelection();
					}
					this.Text = this.Text.Substring(0, mCursorIndex) + e.KeyChar.ToString() + this.Text.Substring(mCursorIndex, this.Text.Length - mCursorIndex);
					mCursorIndex++;
				}
			}
			return true;

		}
        public bool DoKeyPress( KeyPressEvent e )
        {
            if( !active )
                return false;

            if( currentString.Length < 1024 )
            {
                bool allowCharacter = false;

                if( font != null )
                    allowCharacter = e.KeyChar >= 32 && font.IsCharacterInitialized( e.KeyChar );
                else
                    allowCharacter = e.KeyChar >= 32 && e.KeyChar < 128;

                if( allowCharacter )
                    currentString += e.KeyChar.ToString();
            }

            return true;
        }
 private void RegisterKeyUp(KeyPressEvent keyEvent, KeyCode key)
 {
     if (keyUpEvents.ContainsKey(key))
     {
         keyUpEvents[key] += keyEvent;
     }
     else
     {
         AddKeyToCheck(key);
         keyUpEvents.Add(key, keyEvent);
     }
 }
 private void DeregisterKeyUp(KeyCode key, KeyPressEvent keyEvent)
 {
     //print("Deregister key up" + key);
     if (keyUpEvents.ContainsKey(key))
     {
         keyUpEvents[key] -= keyEvent;
         if (keyUpEvents[key] == null)
         {
             keyUpEvents.Remove(key);
         }
         CheckAndRemoveKey(key);
     }
     else
     {
         Debug.LogError(key + " Key is not registered");
     }
 }
		public bool LoadFromLogFile (string filepath)
		{
			XDocument doc = XDocument.Load (filepath);
			foreach (XElement element in doc.Element("xs-event-replay-log").Elements ()) {
				if (element == null) {
					continue;
				}

				string evType = element.Attribute ("type").Value;
				RecordEvent ev = null;
				if (evType == "KeyPressEvent") {
					ev = new KeyPressEvent ();
				} else if (evType == "CommandEvent") {
					ev = new CommandEvent ();
				} else if (evType == "StringEvent") {
					ev = new StringEvent ();
				}

				if (ev == null) {
					return false;
				}

				ev.ParseXML (element);
				events.Add (ev);
			}

			return true;
		}
        protected override bool OnKeyPress( KeyPressEvent e )
        {
            //currentAttachedGuiObject
            if( currentAttachedGuiObject != null )
            {
                currentAttachedGuiObject.ControlManager.DoKeyPress( e );
                return true;
            }

            return base.OnKeyPress( e );
        }
        protected override void OnTextInput( TextCompositionEventArgs e )
        {
            base.OnTextInput( e );

            if( controlManager != null )
            {
                if( e.Text.Length > 0 )
                {
                    char keyChar = e.Text[ 0 ];

                    KeyPressEvent keyEvent = new KeyPressEvent( keyChar );

                    controlManager.DoKeyPress( keyEvent );

                    //if (controlManager.DoKeyPress(keyEvent))
                    //    e.Handled = true;
                }
            }
        }