C# Класс ATGTestInput.Input

Provides methods for sending mouse and keyboard input
Показать файл Открыть проект

Открытые методы

Метод Описание
GetAsyncKeyState ( Key key ) : bool

Checks whether the specified key is currently up or down

MoveTo ( AutomationElement el ) : void

Move the mouse to an element.

MoveTo ( Point pt ) : void

Move the mouse to a point.

pt are in pixels that are relative to desktop origin.

MoveToAndClick ( AutomationElement el ) : void

Move the mouse to an element and click on it. The primary mouse button will be used this is usually the left button except if the mouse buttons are swaped.

MoveToAndClick ( Point pt ) : void

Move the mouse to a point and click. The primary mouse button will be used this is usually the left button except if the mouse buttons are swaped.

pt are in pixels that are relative to desktop origin.

SendKeyboardInput ( Key key, bool press ) : void

Inject keyboard input into the system

SendMouseInput ( double x, double y, int data, SendMouseInputFlags flags ) : void

Inject pointer input into the system

x, y are in pixels. If Absolute flag used, are relative to desktop origin.

SendUnicodeKeyboardInput ( char key, bool press ) : void

Injects a unicode character as keyboard input into the system

SendUnicodeString ( string data ) : void

Injects a string of Unicode characters using simulated keyboard input It should be noted that this overload just sends the whole string with no pauses, depending on the recieving applications input processing it may not be able to keep up with the speed, resulting in corruption or loss of the input data.

SendUnicodeString ( string data, int sleepFrequency, int sleepLength ) : void

Injects a string of Unicode characters using simulated keyboard input with user defined timing.

SetValue ( AutomationElement element, string value ) : void

This is a hyrbird of the ValuePattern.SetValue code extracted from the UI Automation sources NOTE: Requires the ability to set focus to the current automation element

Приватные методы

Метод Описание
GetWindowHandleFromAutomationElement ( AutomationElement element ) : IntPtr

Gets WindowHandle from an AutomationElement

Input ( ) : System.Globalization
InternalSendUnicodeString ( string data, int sleepFrequency, int sleepLength ) : void
IsBitSet ( int flags, int bit ) : bool

Is bit set?

IsExtendedKey ( Key key ) : bool
SendKeyboardInput ( Key key ) : void

Helper: Sends the up and down keyboard input

SendKeyboardInput ( Key key, int millisecondDelay ) : void

Helper: Sends the up and down keyboard input

SendKeyboardInput ( string keyCombination ) : void

Does a look up of the string in keyCombination, converts the string to a Keys enum, and then sends the results to SendKeyboardInput().

SendKeyboardInput ( string keyCombination, int millisecondDelay ) : void

Does a look up of the string in keyCombination, converts the string to a Keys enum, and then sends the results to SendKeyboardInput().

SendKeyboardInputVK ( byte vk, bool press ) : void

Описание методов

GetAsyncKeyState() публичный статический Метод

Checks whether the specified key is currently up or down
public static GetAsyncKeyState ( Key key ) : bool
key Key The Key to check
Результат bool

MoveTo() публичный статический Метод

Move the mouse to an element.
If there is not clickable point for the element
public static MoveTo ( AutomationElement el ) : void
el System.Windows.Automation.AutomationElement The element that the mouse will move to
Результат void

MoveTo() публичный статический Метод

Move the mouse to a point.
pt are in pixels that are relative to desktop origin.
public static MoveTo ( Point pt ) : void
pt Point The point that the mouse will move to.
Результат void

MoveToAndClick() публичный статический Метод

Move the mouse to an element and click on it. The primary mouse button will be used this is usually the left button except if the mouse buttons are swaped.
If there is not clickable point for the element
public static MoveToAndClick ( AutomationElement el ) : void
el System.Windows.Automation.AutomationElement The element to click on
Результат void

MoveToAndClick() публичный статический Метод

Move the mouse to a point and click. The primary mouse button will be used this is usually the left button except if the mouse buttons are swaped.
pt are in pixels that are relative to desktop origin.
public static MoveToAndClick ( Point pt ) : void
pt Point The point to click at
Результат void

SendKeyboardInput() публичный статический Метод

Inject keyboard input into the system
public static SendKeyboardInput ( Key key, bool press ) : void
key Key indicates the key pressed or released. Can be one of the constants defined in the Key enum
press bool true to inject a key press, false to inject a key release
Результат void

SendMouseInput() публичный статический Метод

Inject pointer input into the system
x, y are in pixels. If Absolute flag used, are relative to desktop origin.
public static SendMouseInput ( double x, double y, int data, SendMouseInputFlags flags ) : void
x double x coordinate of pointer, if Move flag specified
y double y coordinate of pointer, if Move flag specified
data int wheel movement, or mouse X button, depending on flags
flags SendMouseInputFlags flags to indicate which type of input occurred - move, button press/release, wheel move, etc.
Результат void

SendUnicodeKeyboardInput() публичный статический Метод

Injects a unicode character as keyboard input into the system
public static SendUnicodeKeyboardInput ( char key, bool press ) : void
key char indicates the key to be pressed or released. Can be any unicode character
press bool true to inject a key press, false to inject a key release
Результат void

SendUnicodeString() публичный статический Метод

Injects a string of Unicode characters using simulated keyboard input It should be noted that this overload just sends the whole string with no pauses, depending on the recieving applications input processing it may not be able to keep up with the speed, resulting in corruption or loss of the input data.
public static SendUnicodeString ( string data ) : void
data string The unicode string to be sent
Результат void

SendUnicodeString() публичный статический Метод

Injects a string of Unicode characters using simulated keyboard input with user defined timing.
public static SendUnicodeString ( string data, int sleepFrequency, int sleepLength ) : void
data string The unicode string to be sent
sleepFrequency int How many characters to send between sleep calls
sleepLength int How long, in milliseconds, to sleep for at each sleep call
Результат void

SetValue() публичный статический Метод

This is a hyrbird of the ValuePattern.SetValue code extracted from the UI Automation sources NOTE: Requires the ability to set focus to the current automation element
public static SetValue ( AutomationElement element, string value ) : void
element System.Windows.Automation.AutomationElement
value string
Результат void