dimanche 31 juillet 2016

How to get pressed key value in InputSimulator?

Hello i learn how to use unit testes.And try to simulate keypressing,for this reason i try to use InputSimulator Input Simulator CodePlex. I try to do something like this.

  Key key=inputSimulator.Keyboard.KeyPress(VirtualKeyCode.ESCAPE);
            switch (key)
            {
                case key.D1:
                   //Do something
                case key.D2:
                   //Do something
                case key.D3:
                   //Do something                 
                default:
                   //Do something    
            }
        }
        while (userChoice.Key != ConsoleKey.Escape);

So how to get pressed key value from inputSimulator.Keyboard.KeyPress(VirtualKeyCode.ESCAPE); method for using it in switch-case construct?

Aucun commentaire:

Enregistrer un commentaire