Hybrid Bridge
|
A generic handler to be used to make C# classes accessible from the Javascript side More...
Classes | |
class | InternalParameterInfo |
Public Member Functions | |
ClassBridge () | |
Creates a new instance of this class More... | |
virtual object | InterceptRequest (string method, Dictionary< string, object > parameters, out bool hasResult) |
Handles the passed request and returns the result More... | |
virtual bool | ShouldInterceptRequest (string handler, string method) |
Checks the request and returns true if this request can be handled by this handler More... | |
virtual void | Initialize (BridgeController bridge) |
Initialize the handler and generates the needed Javascript code More... | |
virtual void | Dispose () |
The method to dispose this class More... | |
virtual ClassBridge< T > | AddInstance (T instance) |
Registers an instance of the generic type and adds it to the list of registered instances More... | |
virtual ClassBridge< T > | AddInstance (T instance, string variableName) |
Registers an instance of the generic type and adds it to the list of registered instances More... | |
virtual ClassBridge< T > | RemoveInstance (params string[] variableNames) |
Removes the requested instances by variable name More... | |
virtual ClassBridge< T > | RemoveInstance (params T[] instances) |
Removes the requested instances More... | |
virtual ClassBridge< T > | RemoveInstance (string variableName, T instance) |
Removed the requested instance and its variable More... | |
Static Public Member Functions | |
static T | GetInstance (string instanceId) |
Returns an instance of the generic type from global pool using instance id More... | |
static T | NormalizeVariable< T > (object variable) |
Tries to normalize variable by searching InstancePool and converting of variable to the desired Type More... | |
static object | NormalizeVariable (object variable, Type normalizeType, bool throwOnException) |
Tries to normalize variable by searching InstancePool and converting of variable to the desired Type More... | |
static IBridgeHandler | FromType (Type genericType) |
Creates a new instance of ClassBridge class with the specified Type as the class's generic type More... | |
Public Attributes | |
virtual T[] | RegisteredInstances => Instances.Keys.Select(o => o as T).Where(t => t != null).ToArray() |
Returns an array containing all registered instances More... | |
Protected Member Functions | |
virtual void | Dispose (bool disposing) |
The method to dispose this class More... | |
virtual object | RaiseEvent (object instance, string eventName, bool isVoid, object[] eventArgs) |
Handles the events raised by public events of the generic class and its instances More... | |
virtual object | OnPushJavascript (PushJavascriptEventArgs eventArgs) |
Raises the PushJavascript event using provided arguments More... | |
Protected Attributes | |
readonly InstanceDictionary< List< string > > | Instances = new InstanceDictionary<List<string>>() |
A list containing all registered instances of the generic type to be accessible from the other side More... | |
readonly Dictionary< T, Dictionary< EventInfo, Delegate > > | InstancesEventsDelegates |
A list containing all generated delegates for each instance's events More... | |
readonly Dictionary< EventInfo, Delegate > | StaticEventsDelegates = new Dictionary<EventInfo, Delegate>() |
A list containing all generated delegates for each static events More... | |
bool | Disposed |
Indicates if the class already disposed More... | |
Static Protected Attributes | |
static Dictionary< ConstructorInfo, ParameterInfo[]> | Constructors |
A cached list of public constructors for this type More... | |
static List< EventInfo > | Events |
A cached list of public events for this type More... | |
static List< FieldInfo > | Fields |
A cached list of fields for this type More... | |
static readonly object | Lock = new object() |
A static object to be used as thread lock when working with other static fields More... | |
static Dictionary< MethodInfo, ParameterInfo[]> | Methods |
A cached list of public and non generic methods for this type More... | |
static List< PropertyInfo > | Properties |
A cached list of public properties for this type More... | |
static List< IBridgeHandler > | SubClasses |
A list of public and not generic sub classes More... | |
static List< IBridgeHandler > | SubEnumerations |
A cached list of public sub enumerations types for this type More... | |
Properties | |
static string | Identification [get] |
Returns a string containing the name of the proxy class accessible from the Javascript side More... | |
static Type | GenericType = typeof(T).FullName.Replace('+', '.') [get] |
Returns the generic type used to create this class More... | |
Events | |
PushJavascriptEvent | PushJavascript |
Event that gets raised when handler needs to push some Javascript code More... | |
Events inherited from HybridBridge.IBridgeHandler | |
PushJavascriptEvent | PushJavascript |
Event that gets raised when handler needs to push some Javascript code More... | |
A generic handler to be used to make C# classes accessible from the Javascript side
Contains static, reusable and non generic methods for the ClassBridge class
T | The generic class to be reflected on the Javascript side |
T | : | class |
Definition at line 21 of file ClassBridge'1.cs.
HybridBridge.ClassBridge< T >.ClassBridge | ( | ) |
Creates a new instance of this class
InvalidGenericTypeException | Indicates that the passed generic type is not a valid class |
Definition at line 96 of file ClassBridge'1.cs.
|
virtual |
Registers an instance of the generic type and adds it to the list of registered instances
instance | The instance of the generic type to ad |
Definition at line 607 of file ClassBridge'1.cs.
|
virtual |
Registers an instance of the generic type and adds it to the list of registered instances
instance | The instance of the generic type to ad |
variableName | The name of the variable that is accessible from the Javascript side |
Definition at line 618 of file ClassBridge'1.cs.
|
virtual |
The method to dispose this class
Definition at line 503 of file ClassBridge'1.cs.
|
protectedvirtual |
The method to dispose this class
Definition at line 520 of file ClassBridge'1.cs.
|
static |
Creates a new instance of ClassBridge class with the specified Type as the class's generic type
genericType | The type to create a ClassBridge instance for |
Definition at line 432 of file ClassBridge.cs.
|
static |
Returns an instance of the generic type from global pool using instance id
instanceId | The identification string of the instance |
Definition at line 549 of file ClassBridge'1.cs.
|
virtual |
Initialize the handler and generates the needed Javascript code
bridge | The BridgeController object requesting initialization |
Implements HybridBridge.IBridgeHandler.
Definition at line 412 of file ClassBridge'1.cs.
|
virtual |
Handles the passed request and returns the result
method | The method name to handle |
parameters | The method parameters |
hasResult | A boolean value indicting if the handling process resulted in a value |
Implements HybridBridge.IBridgeHandler.
Definition at line 215 of file ClassBridge'1.cs.
|
static |
Tries to normalize variable by searching InstancePool and converting of variable to the desired Type
variable | The variable to normalize |
normalizeType | The Type to convert variable to |
throwOnException | A boolean value indicating if the method should throw an exception or just returns in case of errors |
InvalidCastException | The passed variable can not be converted to the desired Type |
Definition at line 381 of file ClassBridge.cs.
|
static |
Tries to normalize variable by searching InstancePool and converting of variable to the desired Type
variable | The variable to normalize |
Definition at line 360 of file ClassBridge.cs.
|
protectedvirtual |
Raises the PushJavascript event using provided arguments
eventArgs | The arguments to be used to raise PushJavascript event |
Definition at line 597 of file ClassBridge'1.cs.
|
protectedvirtual |
Handles the events raised by public events of the generic class and its instances
instance | The instance that raised the event |
eventName | The name of the raised event |
isVoid | Indicates if the raised event has a return value |
eventArgs | An array containing the parameters of the raised event |
Definition at line 562 of file ClassBridge'1.cs.
|
virtual |
Removes the requested instances by variable name
variableNames | The variable name of the instances to be removed from Javascript side |
Definition at line 693 of file ClassBridge'1.cs.
|
virtual |
Removes the requested instances
instances | The instances to be removed from the Javascript side |
Definition at line 713 of file ClassBridge'1.cs.
|
virtual |
Removed the requested instance and its variable
variableName | The variable name of the instance to be removed from Javascript side |
instance | The instance to be removed from the Javascript side |
Definition at line 743 of file ClassBridge'1.cs.
|
virtual |
Checks the request and returns true if this request can be handled by this handler
handler | The name of requested handler |
method | The method name to handle |
Implements HybridBridge.IBridgeHandler.
Definition at line 398 of file ClassBridge'1.cs.
|
staticprotected |
A cached list of public constructors for this type
Definition at line 27 of file ClassBridge'1.cs.
|
protected |
Indicates if the class already disposed
Definition at line 90 of file ClassBridge'1.cs.
|
staticprotected |
A cached list of public events for this type
Definition at line 33 of file ClassBridge'1.cs.
|
staticprotected |
A cached list of fields for this type
Definition at line 39 of file ClassBridge'1.cs.
|
protected |
A list containing all registered instances of the generic type to be accessible from the other side
Definition at line 74 of file ClassBridge'1.cs.
|
protected |
A list containing all generated delegates for each instance's events
Definition at line 79 of file ClassBridge'1.cs.
|
staticprotected |
A static object to be used as thread lock when working with other static fields
Definition at line 45 of file ClassBridge'1.cs.
|
staticprotected |
A cached list of public and non generic methods for this type
Definition at line 51 of file ClassBridge'1.cs.
|
staticprotected |
A cached list of public properties for this type
Definition at line 57 of file ClassBridge'1.cs.
virtual T [] HybridBridge.ClassBridge< T >.RegisteredInstances => Instances.Keys.Select(o => o as T).Where(t => t != null).ToArray() |
Returns an array containing all registered instances
Definition at line 195 of file ClassBridge'1.cs.
|
protected |
A list containing all generated delegates for each static events
Definition at line 85 of file ClassBridge'1.cs.
|
staticprotected |
A list of public and not generic sub classes
Definition at line 63 of file ClassBridge'1.cs.
|
staticprotected |
A cached list of public sub enumerations types for this type
Definition at line 69 of file ClassBridge'1.cs.
|
staticget |
Returns the generic type used to create this class
Definition at line 205 of file ClassBridge'1.cs.
|
staticget |
Returns a string containing the name of the proxy class accessible from the Javascript side
Definition at line 200 of file ClassBridge'1.cs.
PushJavascriptEvent HybridBridge.ClassBridge< T >.PushJavascript |
Event that gets raised when handler needs to push some Javascript code
Definition at line 406 of file ClassBridge'1.cs.