Show / Hide Table of Contents

Class ScriptObject

Defines the core behavior for the HtmlObject class, and provides a base class for browser Document Object Model (DOM) access types.

Inheritance
System.Object
ScriptObject
HtmlObject
ScriptObjectCollection
Implements
System.Dynamic.IDynamicMetaObjectProvider
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Browser
Assembly: OpenSilver.Browser.dll
Syntax
public class ScriptObject : IDynamicMetaObjectProvider

Properties

| Improve this Doc View Source

Dispatcher

Gets an instance of the dispatcher.

Declaration
public Dispatcher Dispatcher { get; }
Property Value
Type Description
Dispatcher

The dispatcher associated with the user interface (UI) thread.

| Improve this Doc View Source

ManagedObject

Gets the underlying managed object reference of the ScriptObject.

Declaration
public object ManagedObject { get; }
Property Value
Type Description
System.Object

A managed object reference if the current ScriptObject wraps a managed type; otherwise, null.

Methods

| Improve this Doc View Source

ConvertTo(Type, Boolean)

Converts the current scriptable object to a specified type, with serialization support.

Declaration
[NotImplemented]
protected virtual object ConvertTo(Type targetType, bool allowSerialization)
Parameters
Type Name Description
System.Type targetType

The type to convert the current scriptable object to.

System.Boolean allowSerialization

A flag which enables the current scriptable object to be serialized.

Returns
Type Description
System.Object

An object of type targetType.

Exceptions
Type Condition
System.ArgumentException

The conversion failed or is not supported.

| Improve this Doc View Source

ConvertTo<T>()

Converts the current scriptable object to a specified type.

Declaration
[NotImplemented]
public T ConvertTo<T>()
Returns
Type Description
T

An object of type T.

Type Parameters
Name Description
T

The type to convert the current scriptable object to.

Exceptions
Type Condition
System.ArgumentException

The conversion failed or is not supported.

| Improve this Doc View Source

Finalize()

Frees resources and performs other cleanup operations before the scriptable object is reclaimed by garbage collection.

Declaration
protected void Finalize()
| Improve this Doc View Source

GetProperty(Int32)

Gets the value of a property that is identified by ordinal number on the current scriptable object.

Declaration
public object GetProperty(int index)
Parameters
Type Name Description
System.Int32 index

The ordinal number of the property.

Returns
Type Description
System.Object

A null reference if the property does not exist or if the underlying ScriptObject is a managed type.

| Improve this Doc View Source

GetProperty(String)

Gets the value of a property that is identified by name on the current scriptable object.

Declaration
public virtual object GetProperty(string name)
Parameters
Type Name Description
System.String name

The name of the property.

Returns
Type Description
System.Object

A null reference if the property does not exist or if the underlying ScriptObject is a managed type.

Exceptions
Type Condition
System.ArgumentNullException

name is null.

System.ArgumentException

name is an empty string.-or-name contains an embedded null character (System.Char.MinValue).

| Improve this Doc View Source

Invoke(String, Object[])

Invokes a method on the current scriptable object, and optionally passes in one or more method parameters.

Declaration
public virtual object Invoke(string name, params object[] args)
Parameters
Type Name Description
System.String name

The method to invoke.

System.Object[] args

Parameters to be passed to the method.

Returns
Type Description
System.Object

An object that represents the return value from the underlying JavaScript method.

Exceptions
Type Condition
System.ArgumentNullException

name is null.

System.ArgumentException

name is an empty string.-or-name contains an embedded null character (System.Char.MinValue). -or-The method does not exist or is not scriptable.

System.InvalidOperationException

The underlying method invocation results in an error. The .NET Framework attempts to return the error text that is associated with the error.

| Improve this Doc View Source

InvokeSelf(Object[])

Invokes the current ScriptObject and assumes that it represents a JavaScript method.

Declaration
public virtual object InvokeSelf(params object[] args)
Parameters
Type Name Description
System.Object[] args

Parameters to be passed to the underlying JavaScript method.

Returns
Type Description
System.Object

An object that represents the return value from the underlying JavaScript method.

Exceptions
Type Condition
System.InvalidOperationException

The current ScriptObject is not a method.-or-The underlying method invocation results in an error.

| Improve this Doc View Source

SetProperty(Int32, Object)

Sets the value of a property that is identified by ordinal number on the current scriptable object.

Declaration
public void SetProperty(int index, object value)
Parameters
Type Name Description
System.Int32 index

The ordinal number of the property.

System.Object value

The value to set the property to.

Exceptions
Type Condition
System.ArgumentNullException

index is null.

System.ArgumentException

index identifies an empty string.

System.InvalidOperationException

A type mismatch exists between the supplied type and the target property.-or-The property is not settable.-or-All other failures.

| Improve this Doc View Source

SetProperty(String, Object)

Sets a property that is identified by name on the current scriptable object.

Declaration
public virtual void SetProperty(string name, object value)
Parameters
Type Name Description
System.String name

The name of the property.

System.Object value

The value to set the property to.

Exceptions
Type Condition
System.ArgumentNullException

name is null.

System.ArgumentException

name is an empty string.-or-name contains an embedded null character (System.Char.MinValue).

System.InvalidOperationException

A type mismatch exists between the supplied type and the target property.-or-The property is not settable.-or-All other failures.

Explicit Interface Implementations

| Improve this Doc View Source

IDynamicMetaObjectProvider.GetMetaObject(Expression)

Returns the System.Dynamic.DynamicMetaObject responsible for binding operations performed on this object.

Declaration
DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject(Expression parameter)
Parameters
Type Name Description
System.Linq.Expressions.Expression parameter

The expression tree representation of the runtime value.

Returns
Type Description
System.Dynamic.DynamicMetaObject

The System.Dynamic.DynamicMetaObject to bind this object.

Implements

System.Dynamic.IDynamicMetaObjectProvider
  • Improve this Doc
  • View Source