예제 #1
0
        private void keyTextBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            var msKey = MsKeyToTestKey(e.KeyCode);

            if (msKey == Microsoft.Test.Input.Key.None)
            {
                return;
            }
            var keyStroke = new KeyStroke {
                MsTestKeys = new List <Microsoft.Test.Input.Key>()
            };

            if (e.Alt)
            {
                keyStroke.MsTestKeys.Add(Microsoft.Test.Input.Key.LeftAlt);
            }
            if (e.Control)
            {
                keyStroke.MsTestKeys.Add(Microsoft.Test.Input.Key.LeftCtrl);
            }
            if (e.Shift)
            {
                keyStroke.MsTestKeys.Add(Microsoft.Test.Input.Key.LeftShift);
            }
            keyStroke.MsTestKeys.Add(msKey);
            keyTextBox.Text  = keyStroke.ToString();
            currentkeyStroke = keyStroke;
        }
예제 #2
0
 public static List <KeyStroke> Load(string file)
 {
     return(File.ReadAllLines(file)
            .Select(l => KeyStroke.FromString(l))
            .ToList());
 }