Example #1
0
        private void OnKeyActivity(object sender, KeyActivityEventArgs e)
        {
            String pressedKeys = "";

             // Only react to new keys
             if (e.IsKeyDown)
             {
            // Process the history from newest to oldest.
            foreach (Keys key in Ki.History.Backwards())
            {
               // Once we run out of display room, ignore any remaining history
               // (we have no space to display those).
               if (pressedKeys.Length + key.ToSymbol().Length > LIMIT * 2)
               {
                  break;
               }
               pressedKeys += key.ToSymbol() + " ";
            }

            // Reverse the symbols so that the newest are on the right and the
            // oldest are on the left.
            string[] symbols = pressedKeys.Split(' ');
            Array.Reverse(symbols);
            pressedKeys = string.Join(" ", symbols);

            TextDisplay.Text = pressedKeys;
             }
        }
Example #2
0
        private void OnKeyActivity(object sender, KeyActivityEventArgs e)
        {
            int trailingSpace = 0;
             StringBuilder pressedKeys = new StringBuilder();
             foreach (Keys key in e.Keys)
             {
            ////// TEST toggle clickablity
            if (key.Equals(Keys.LControlKey))
            {
               Clickable = !Clickable;
            }
            pressedKeys.AppendFormat("{0} ", key.ToSymbol());

             }

             trailingSpace = pressedKeys.Length - 1;
             if (trailingSpace > 0)
             {
            pressedKeys.Remove(trailingSpace, 1);
             }

             //Console.WriteLine(pressedKeys.ToString());
             TextDisplay.Text = pressedKeys.ToString();
        }