Class ScriptObject
Defines the core behavior for the HtmlObject class, and provides a base class for browser Document Object Model (DOM) access types.
Implements
Inherited Members
Namespace: System.Windows.Browser
Assembly: OpenSilver.Browser.dll
Syntax
public class ScriptObject : IDynamicMetaObjectProvider
Properties
| Improve this Doc View SourceDispatcher
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. |
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 SourceConvertTo(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. |
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. |
Finalize()
Frees resources and performs other cleanup operations before the scriptable object is reclaimed by garbage collection.
Declaration
protected void Finalize()
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. |
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). |
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. |
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. |
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. |
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 SourceIDynamicMetaObjectProvider.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. |