Class WindowsElementWrapperExtensions
Defines a collection of extensions for WindowsElementWrapper objects.
Inheritance
Namespace: Legerity.Windows.Extensions
Assembly: Legerity.Windows.dll
Syntax
public static class WindowsElementWrapperExtensions : object
Methods
| Improve this Doc View SourceTryWaitUntil<TElementWrapper, TResult>(TElementWrapper, Func<TElementWrapper, TResult>, Nullable<TimeSpan>, Int32, Action<Exception>)
Attempts to wait until a specified element condition is met, with an optional timeout.
Declaration
public static bool TryWaitUntil<TElementWrapper, TResult>(this TElementWrapper element, Func<TElementWrapper, TResult> condition, TimeSpan? timeout = null, int retries = 0, Action<Exception> exceptionHandler = null)
where TElementWrapper : WindowsElementWrapper
Parameters
| Type | Name | Description |
|---|---|---|
| TElementWrapper | element | The element to wait on. |
| Func<TElementWrapper, TResult> | condition | The condition of the element to wait on. |
| System.Nullable<TimeSpan> | timeout | The optional timeout wait on the condition being true. |
| System.Int32 | retries | An optional count of retries after a timeout before accepting the failure. |
| Action<Exception> | exceptionHandler | The optional exception handler thrown if an error occurs as a result of timeout. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Whether the wait was a success. |
Type Parameters
| Name | Description |
|---|---|
| TElementWrapper | The type of WindowsElementWrapper. |
| TResult | The type of expected result from the wait condition. |
WaitUntil<TElementWrapper, TResult>(TElementWrapper, Func<TElementWrapper, TResult>, Nullable<TimeSpan>, Int32)
Waits until a specified element condition is met, with an optional timeout.
Declaration
public static TResult WaitUntil<TElementWrapper, TResult>(this TElementWrapper element, Func<TElementWrapper, TResult> condition, TimeSpan? timeout = null, int retries = 0)
where TElementWrapper : WindowsElementWrapper
Parameters
| Type | Name | Description |
|---|---|---|
| TElementWrapper | element | The element to wait on. |
| Func<TElementWrapper, TResult> | condition | The condition of the element to wait on. |
| System.Nullable<TimeSpan> | timeout | The optional timeout wait on the condition being true. |
| System.Int32 | retries | An optional count of retries after a timeout before accepting the failure. |
Returns
| Type | Description |
|---|---|
| TResult | The |
Type Parameters
| Name | Description |
|---|---|
| TElementWrapper | The type of WindowsElementWrapper. |
| TResult | The type of expected result from the wait condition. |