Class WinformsCoreControl
- Namespace
- Ranorex
- Assembly
- Ranorex.Plugin.WinForms.Core.dll
Capability of a .NET Core Windows Forms control.
public class WinformsCoreControl : Adapter, IAdapter
- Inheritance
-
WinformsCoreControl
- Implements
- Inherited Members
Constructors
WinformsCoreControl()
Creates a new WinformsCoreControl adapter instance. This constructor is used internally by the Ranorex Core Framework for performance issues!
protected WinformsCoreControl()
WinformsCoreControl(Element)
Creates a new WinformsCoreControl adapter instance.
public WinformsCoreControl(Element element)
Parameters
elementElementThe element to create the adapter for.
Exceptions
- NullReferenceException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
Properties
ControlName
The name of the Windows Forms control.
public virtual string ControlName { get; }
Property Value
ControlText
The text of the Windows Forms control.
public virtual string ControlText { get; set; }
Property Value
Exceptions
- SetAttributeFailedException
Thrown if setting the attribute value failed.
ControlType
The full type name of the Windows Forms control.
public virtual string ControlType { get; }
Property Value
ControlTypeName
The (short) type name of the Windows Forms control.
public virtual string ControlTypeName { get; }
Property Value
FullTypeLineage
The full type name lineage of the Windows Forms control.
public virtual string[] FullTypeLineage { get; }
Property Value
- string[]
this[string]
Gets or sets the (serializable) value of the specified control property.
public object this[string name] { get; set; }
Parameters
namestringThe name of the property.
Property Value
- object
The value of the property.
Remarks
The getter of this property calls the GetPropertyValue(string) method, the setter calls the SetPropertyValue(string, object) method.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
RequiredCapabilities
Capabilities required by the adapter implementation.
protected override string[] RequiredCapabilities { get; }
Property Value
- string[]
Methods
FromElement(Element)
Converts an Element to an instance of this class.
public static WinformsCoreControl FromElement(Element element)
Parameters
elementElementThe element to convert.
Returns
- WinformsCoreControl
The WinformsCoreControl.
Exceptions
- ArgumentNullException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
FromPath(string)
Converts a string to an instance of this class by searching the root.
public static WinformsCoreControl FromPath(string path)
Parameters
pathstringThe search path.
Returns
- WinformsCoreControl
The WinformsCoreControl.
Remarks
The DefaultSearchTimeout is used to search for the specified path.
Exceptions
- ArgumentNullException
If
pathisnull.- RxPathException
If the specified
pathis not valid.- ElementNotFoundException
If no element is found.
- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
GetPropertyValue(BindingFlags, string)
Gets the (serializable) value of the specified control property.
public virtual object GetPropertyValue(BindingFlags flags, string name)
Parameters
flagsBindingFlagsA combination of flags that further specify which property to get.
namestringThe name of the property.
Returns
- object
The value of the property.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
GetPropertyValue(string)
Gets the (serializable) value of the specified control property.
public virtual object GetPropertyValue(string name)
Parameters
namestringThe name of the property.
Returns
- object
The value of the property.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
GetPropertyValue<T>(BindingFlags, string)
Gets the (serializable) value of the specified control property.
public T GetPropertyValue<T>(BindingFlags flags, string name)
Parameters
flagsBindingFlagsA combination of flags that further specify which property to get.
namestringThe name of the property.
Returns
- T
The value of the named property or the default value of the specified type if the returned value is
nulland the specified type is a value type.
Type Parameters
TThe type of the property to get the value from.
Exceptions
- InvalidCastException
If the returned value cannot be casted to the specified type.
- ActionFailedException
Thrown if invoking the action failed.
GetPropertyValue<T>(string)
Gets the (serializable) value of the specified control property.
public T GetPropertyValue<T>(string name)
Parameters
namestringThe name of the property.
Returns
- T
The value of the named property or the default value of the specified type if the returned value is
nulland the specified type is a value type.
Type Parameters
TThe type of the property to get the value from.
Exceptions
- InvalidCastException
If the returned value cannot be casted to the specified type.
- ActionFailedException
Thrown if invoking the action failed.
InvokeMethod(BindingFlags, string, object[])
Invokes the specified method on the control. All parameters and the return value need to be serializable.
public object InvokeMethod(BindingFlags flags, string name, object[] args)
Parameters
flagsBindingFlagsA combination of flags that further specify which method to invoke.
namestringThe name of the method to invoke.
argsobject[]The (serializable) values passed as parameters to the method.
Returns
- object
The (serializable) return value of the invoked method.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
InvokeMethod(BindingFlags, string, object[], Duration)
Invokes the specified method on the control. All parameters and the return value need to be serializable.
public virtual object InvokeMethod(BindingFlags flags, string name, object[] args, Duration timeout)
Parameters
flagsBindingFlagsA combination of flags that further specify which method to invoke.
namestringThe name of the method to invoke.
argsobject[]The (serializable) values passed as parameters to the method.
timeoutDurationThe timeout for this action. The action will return after the timeout even if the method has not yet finished executing.
Returns
- object
The (serializable) return value of the invoked method.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
InvokeMethod(string)
Invokes the specified method on the control.
public object InvokeMethod(string name)
Parameters
namestringThe name of the method to invoke.
Returns
- object
The (serializable) return value of the invoked method.
Remarks
Use this method to invoke public instance methods without arguments on a control.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
InvokeMethod(string, object[])
Invokes the specified method on the control. All parameters need to be serializable.
public object InvokeMethod(string name, object[] args)
Parameters
namestringThe name of the method to invoke.
argsobject[]The (serializable) values passed as parameters to the method.
Returns
- object
The (serializable) return value of the invoked method.
Remarks
Use this method to invoke public instance methods on a control.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
InvokeRemotely(string, string, string, object)
Invokes the delegate remotely at the control. All parameters and the return value need to be serializable.
public object InvokeRemotely(string assemblyPath, string fullTypeName, string methodName, object inputData)
Parameters
assemblyPathstringThe full path to the assembly which contains the remote method to be called at the remote control.
fullTypeNamestringThe full name of the type which contains the remote method to be called at the remote control.
methodNamestringThe name of the method which should be called at the remote control.
inputDataobjectThe (serializable) input data passed to the remote method at the remote control.
Returns
- object
The (serializable) return value of the remotely invoked delegate.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
InvokeRemotely(string, string, string, object, Duration)
Invokes the delegate remotely at the control. All parameters and the return value need to be serializable.
public virtual object InvokeRemotely(string assemblyPath, string fullTypeName, string methodName, object inputData, Duration timeout)
Parameters
assemblyPathstringThe full path to the assembly which contains the remote method to be called at the remote control.
fullTypeNamestringThe full name of the type which contains the remote method to be called at the remote control.
methodNamestringThe name of the method which should be called at the remote control.
inputDataobjectThe (serializable) input data passed to the remote method at the remote control.
timeoutDurationThe timeout for this action. The action will return after the timeout even if the delegate has not yet finished executing.
Returns
- object
The (serializable) return value of the remotely invoked delegate.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
SetPropertyValue(BindingFlags, string, object)
Sets the (serializable) value of the specified control property.
public virtual void SetPropertyValue(BindingFlags flags, string name, object value)
Parameters
flagsBindingFlagsA combination of flags that further specify which property to set.
namestringThe name of the property.
valueobjectThe value (must be serializable) to set the property to.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
SetPropertyValue(string, object)
Sets the (serializable) value of the specified control property.
public virtual void SetPropertyValue(string name, object value)
Parameters
namestringThe name of the property.
valueobjectThe value (must be serializable) to set the property to.
Exceptions
- ActionFailedException
Thrown if invoking the action failed.
Operators
implicit operator WinformsCoreControl(Element)
Implicitly converts an Element to an instance of this class.
public static implicit operator WinformsCoreControl(Element element)
Parameters
elementElementThe element to convert.
Returns
- WinformsCoreControl
The WinformsCoreControl.
Exceptions
- ArgumentNullException
If
elementisnull.- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.
implicit operator WinformsCoreControl(string)
Implicitly converts a string to an instance of this class by searching the root.
public static implicit operator WinformsCoreControl(string path)
Parameters
pathstringThe search path.
Returns
- WinformsCoreControl
The WinformsCoreControl.
Remarks
The DefaultSearchTimeout is used to search for the specified path.
Exceptions
- ArgumentNullException
If
pathisnull.- RxPathException
If the specified
pathis not valid.- ElementNotFoundException
If no element is found.
- CapabilityNotSupportedException
If the element does not support the capabilities required by this adapter.