Class
AutomationObject<T>

Represents an object that can be automated inside a Silverlight/WPF App.

Definition

Namespace:ArtOfTest.WebAii.Silverlight

Assembly:ArtOfTest.WebAii.dll

Type Parameters:

T

The AutomationPeer type of the object.

Syntax:

cs-api-definition
[DataContract]
public abstract class AutomationObject<T> : IAutomationPeer, IPeerConverter

Inheritance: objectAutomationObject<T>

Derived Classes: InlineCollectionBindingGroupBitmapPaletteBrushCameraColorColorContextCornerRadiusDataGridCellInfoDataGridColumnDataGridLengthDrawingFlowDocumentGeometryGlyphRunGradientStopGridViewColumnImageSourceInlineCollectionInt32RectMatrixMatrix3DMediaPlayerPathFigurePathSegmentPenPixelFormatPointPoint3DQuaternionRectRotation3DSizeThicknessTimeSpanTransformTransform3DVector3DViewBaseVisualFrameworkElementItemCollectionSelectedDatesCollectionBrushColorCornerRadiusDataGridColumnDataGridLengthDurationGeometryGradientStopImageSourceInputScopeMatrixMultiScaleSubImageMultiScaleTileSourcePathFigurePathSegmentPointRectSizeThicknessTimeSpanTransformDocumentStatisticsInfoDocumentStatisticsInfoRadRunRadRunCollection

Implements: IAutomationPeerIPeerConverter

Constructors

AutomationObject()

Initializes a new instance of the AutomationObject<T> class.

Declaration

cs-api-definition
public AutomationObject()

AutomationObject(AutomationReference)

Create a new AutomationObject.

Declaration

cs-api-definition
public AutomationObject(AutomationReference reference)

Parameters

reference

AutomationReference

The object reference.

Properties

PropertyBag

The automation object property bag.

Declaration

cs-api-definition
public Dictionary<string, object> PropertyBag { get; set; }

Property Value

Dictionary<string, object>

The entire property bag.

Implements IAutomationPeer.PropertyBag

Reference

Get or set the object reference.

Declaration

cs-api-definition
public AutomationReference Reference { get; set; }

Property Value

AutomationReference

Implements IAutomationPeer.Reference

Methods

AssignReference(AutomationReference)

Assign a reference to this AutomationObject.

Declaration

cs-api-definition
public virtual void AssignReference(AutomationReference reference)

Parameters

reference

AutomationReference

The automation reference.

Implements IAutomationPeer.AssignReference(AutomationReference)

Deserialize(string)

Deserialize this AutomationObject to a jsonString TODO: Should this be a static method?

Declaration

cs-api-definition
public virtual object Deserialize(string jsonString)

Parameters

jsonString

string

The Json string to deserialize

Returns

object

The deserialize object

Implements IAutomationPeer.Deserialize(string)

FromRealObject(object)

Converts a Silverlight object to an AutomationObject

Declaration

cs-api-definition
public virtual void FromRealObject(object o)

Parameters

o

object

The Silverlight object to convert.

Implements IPeerConverter.FromRealObject(object)

GetProperty(AutomationProperty)

Get a property on this automation object.

Declaration

cs-api-definition
public virtual object GetProperty(AutomationProperty property)

Parameters

property

AutomationProperty

The name of the property to retrieve

Returns

object

The value of the property

GetProperty(AutomationProperty, object)

Gets a property on this automation object, or returns a default value if the property cannot be retrieved

Declaration

cs-api-definition
public virtual object GetProperty(AutomationProperty property, object defaultValue)

Parameters

property

AutomationProperty

The name of the property to retrieve

defaultValue

object

The value to be returned if the property cannot be retrieved

Returns

object

The value of the property, or defaultValue if an error occurs while retrieving the property

GetRealType()

Gets the real peer type

Declaration

cs-api-definition
public abstract string GetRealType()

Returns

string

Implements IAutomationPeer.GetRealType()

InvokeMethod(AutomationMethod, params object[])

Invokes a method on the AutomationObject's client-side peer

Declaration

cs-api-definition
public virtual object InvokeMethod(AutomationMethod method, params object[] parameters)

Parameters

method

AutomationMethod

An AutomationMethod specifying the method to invoke on the peer

parameters

object[]

The parameters for the method call

Returns

object

null

Remarks

Only simple parameters (numbers, booleans, and strings) are supported, and return values are not yet passed back from the automation peer

InvokeMethod(string, params object[])

Invokes a method on the AutomationObject's client-side peer

Declaration

cs-api-definition
public virtual object InvokeMethod(string methodName, params object[] parameters)

Parameters

methodName

string

The name of the method to invoke

parameters

object[]

The parameters for the method call

Returns

object

null

Remarks

Only simple parameters (numbers, booleans, and string) are supported, and return values are not yet passed back from the automation peer

Serialize()

Serialize this automation object to a Json String

Declaration

cs-api-definition
public virtual string Serialize()

Returns

string

The Json string representation of this object.

Implements IAutomationPeer.Serialize()

SetProperty(AutomationProperty, object)

Set a property on this automation object.

Declaration

cs-api-definition
public virtual void SetProperty(AutomationProperty property, object value)

Parameters

property

AutomationProperty

The property.

value

object

The value.

ToRealObject()

Converts an automation object to the real object.

Declaration

cs-api-definition
public virtual object ToRealObject()

Returns

object

The Silverlight object.

Implements IPeerConverter.ToRealObject()