Class WindowExtensions
- Namespace
- NetAutoGUI
- Assembly
- NetAutoGUI.dll
public static class WindowExtensions
- Inheritance
-
WindowExtensions
- Inherited Members
Methods
Click(Window, int?, int?, MouseButtonType, int, double)
Simulate a single mouse click at the given position relative to the given windowwindow.
public static void Click(this Window window, int? winX = null, int? winY = null, MouseButtonType button = MouseButtonType.Left, int clicks = 1, double intervalInSeconds = 0)
Parameters
windowWindowwindow
winXint?mouse x to window origin. The default value is current mouse x.
winYint?mouse y to window origin. The default value is current mouse y.
buttonMouseButtonTypewhich mouse button
clicksintclick times
intervalInSecondsdoubleinterval in seconds between clicks
DoubleClick(Window, int?, int?, MouseButtonType, double)
Simulate a double mouse click at the given position relative to the given windowwindow.
public static void DoubleClick(this Window window, int? winX = null, int? winY = null, MouseButtonType button = MouseButtonType.Left, double intervalInSeconds = 0)
Parameters
windowWindowwindow
winXint?mouse x to window origin. The default value is current mouse x.
winYint?mouse y to window origin. The default value is current mouse y.
buttonMouseButtonTypewhich mouse button
intervalInSecondsdoubleinterval in seconds between clicks
Highlight(Window, params Rectangle[])
Highlight several areas
public static void Highlight(this Window window, params Rectangle[] relativeRects)
Parameters
LocateAll(Window, BitmapData, double)
Locates all occurrences of a given bitmap within the window with a specified confidence level.
public static Rectangle[] LocateAll(this Window window, BitmapData imgFileToBeFound, double confidence = 0.99)
Parameters
windowWindowThe window where the search is performed
imgFileToBeFoundBitmapDataThe image to locate within the window
confidencedoubleThe confidence level required for a match, ranging from 0.0 to 1.0. A value closer to 1.0 ensures higher accuracy but may result in fewer matches.
Returns
- Rectangle[]
An array of Rectangle objects, each representing a located instance of
imgFileToBeFoundwithinwindow.
MouseDown(Window, int?, int?, MouseButtonType)
Press down a mouse key down on a window
public static void MouseDown(this Window window, int? winX = null, int? winY = null, MouseButtonType button = MouseButtonType.Left)
Parameters
windowWindowwindow
winXint?x to the window. Default value is the current mouse position.
winYint?y to the window. Default value is the current mouse position.
buttonMouseButtonTypewhich button
MouseUp(Window, int?, int?, MouseButtonType)
Release a mouse key down on a window
public static void MouseUp(this Window window, int? winX = null, int? winY = null, MouseButtonType button = MouseButtonType.Left)
Parameters
windowWindowwindow
winXint?x to the window. Default value is the current mouse position.
winYint?y to the window. Default value is the current mouse position.
buttonMouseButtonTypewhich button
MoveMouseTo(Window, int, int)
Move the mouse cursor to the specific location
public static void MoveMouseTo(this Window window, int winX, int winY)
Parameters
Wait(Window, BitmapData, double, double)
Wait for the first matched area(matched withimgFileToBeFound)
public static Rectangle Wait(this Window window, BitmapData imgFileToBeFound, double confidence = 0.99, double timeoutSeconds = 5)
Parameters
windowWindowwindow
imgFileToBeFoundBitmapDataThe image to locate within the window
confidencedoubleThe confidence level required for a match, ranging from 0.0 to 1.0. A value closer to 1.0 ensures higher accuracy but may result in fewer matches.
timeoutSecondsdoubletimeout in seconds
Returns
- Rectangle
Rectangle of the first found area relative to
window
Exceptions
- TimeoutException
not found after timeout
WaitAndClick(Window, BitmapData, double, double)
Wait for the first matched area(matched withimgFileToBeFound) and click the centre of the area
public static void WaitAndClick(this Window window, BitmapData imgFileToBeFound, double confidence = 0.99, double timeoutSeconds = 5)
Parameters
windowWindowwindow
imgFileToBeFoundBitmapDataThe image to locate within the window
confidencedoubleThe confidence level required for a match, ranging from 0.0 to 1.0. A value closer to 1.0 ensures higher accuracy but may result in fewer matches.
timeoutSecondsdoubletimeout in seconds
Exceptions
- TimeoutException
not found after timeout
WaitAndClickAsync(Window, BitmapData, double, double, CancellationToken)
Wait for the first matched area(matched withimgFileToBeFound) and click the centre of the area
public static Task WaitAndClickAsync(this Window window, BitmapData imgFileToBeFound, double confidence = 0.99, double timeoutSeconds = 5, CancellationToken cancellationToken = default)
Parameters
windowWindowwindow
imgFileToBeFoundBitmapDataThe image to locate within the window
confidencedoubleThe confidence level required for a match, ranging from 0.0 to 1.0. A value closer to 1.0 ensures higher accuracy but may result in fewer matches.
timeoutSecondsdoubletimeout in seconds
cancellationTokenCancellationTokencancellationToken
Returns
Exceptions
- TimeoutException
not found after timeout
WaitAsync(Window, BitmapData, double, double, CancellationToken)
Wait for the first matched area(matched withimgFileToBeFound)
public static Task<Rectangle> WaitAsync(this Window window, BitmapData imgFileToBeFound, double confidence = 0.99, double timeoutSeconds = 5, CancellationToken cancellationToken = default)
Parameters
windowWindowwindow
imgFileToBeFoundBitmapDataThe image to locate within the window
confidencedoubleThe confidence level required for a match, ranging from 0.0 to 1.0. A value closer to 1.0 ensures higher accuracy but may result in fewer matches.
timeoutSecondsdoubletimeout in seconds
cancellationTokenCancellationTokencancellationToken
Returns
Exceptions
- TimeoutException
not found after timeout