コード例 #1
0
ファイル: KeySequenceParser.cs プロジェクト: candera/tpanl
        private static void AddNode(KeyEventSequence keyEventSequence, ParseNode node)
        {
            if (node.HasContent)
            {
                if (node.Direction != KeyDirection.Up)
                {
                    keyEventSequence.Add(node.ToKeyEvent(KeyDirection.Down));
                }
            }

            foreach (ParseNode child in node.Children)
            {
                AddNode(keyEventSequence, child);
            }

            if (node.HasContent)
            {
                if (node.Direction != KeyDirection.Down)
                {
                    keyEventSequence.Add(node.ToKeyEvent(KeyDirection.Up));
                }
            }
        }
コード例 #2
0
        private KeyEventSequence MakeExpectedKeySequence(params Keys[] keys)
        {
            KeyEventSequence sequence = new KeyEventSequence();
            for (int i = 0; i < keys.Length; i++)
            {
                sequence.Add(new KeyEvent { Direction = KeyDirection.Down, Key = keys[i] });
            }

            for (int i = keys.Length - 1; i >= 0; i--)
            {
                sequence.Add(new KeyEvent { Direction = KeyDirection.Up, Key = keys[i] });
            }

            return sequence;
        }