Hybrid Bridge
|
A class for event driven communicate with Javascript side More...
Classes | |
class | ProxyClass |
The class to be reflected on Javascript side More... | |
Public Member Functions | |
HybridMessagingHandler (string jsVariableName="HybridMessaging") | |
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 void | Send (string messageString) |
Sends a message to the Javascript side More... | |
virtual TResult | Send< TResult > (string messageString) |
Sends a message to the Javascript side and waits for the response More... | |
virtual void | Send< TArgument > (string messageString, TArgument argument) |
Sends a message to the Javascript side More... | |
virtual TResult | Send< TResult, TArgument > (string messageString, TArgument argument) |
Sends a message to the Javascript side and waits for the response More... | |
virtual bool | Subscribe (string messageString, Action callback) |
Registers a callback method for the specified message string More... | |
virtual bool | Subscribe< TArgument > (string messageString, Action< TArgument > callback) |
Registers a callback method for the specified message string More... | |
virtual bool | Subscribe< TResult, TArgument > (string messageString, Func< TArgument, TResult > callback) |
Registers a callback method for the specified message string More... | |
virtual bool | Subscribe< TResult > (string messageString, Func< TResult > callback) |
Registers a callback method for the specified message string More... | |
virtual bool | Unsubscribe (string messageString, Action callback) |
Unregisters a callback method for the specified message string More... | |
virtual bool | Unsubscribe< TArgument > (string messageString, Action< TArgument > callback) |
Unregisters a callback method for the specified message string More... | |
virtual bool | Unsubscribe< TResult, TArgument > (string messageString, Func< TArgument, TResult > callback) |
Unregisters a callback method for the specified message string More... | |
virtual bool | Unsubscribe< TResult > (string messageString, Func< TResult > callback) |
Unregisters a callback method for the specified message string More... | |
Protected Member Functions | |
virtual void | Dispose (bool disposing) |
The method to dispose this class More... | |
virtual object | OnPushJavascript (IBridgeHandler sender, PushJavascriptEventArgs eventArgs) |
Raises the PushJavascript event using provided arguments More... | |
virtual bool | Subscribe (string messageString, Delegate callback) |
Registers an callback method for the specified message string More... | |
virtual bool | Unsubscribe (string messageString, Delegate callback) |
Unregisters a callback method for the specified message string More... | |
virtual object | OnNewMessage (string messageString, object arguments) |
The method to be called when a new message received from the Javascript side More... | |
Protected Attributes | |
readonly object | Lock = new object() |
A static object to be used as thread lock when working with other static fields More... | |
readonly Dictionary< string, List< Delegate > > | Subscriptions = new Dictionary<string, List<Delegate>>() |
A list of all registered delegates More... | |
bool | Disposed |
Indicates if the class already disposed More... | |
ClassBridge< ProxyClass > | HybridMessagingBridge |
An instance of the ClassBridge class for ProxyClass to be used as the communication bridge More... | |
ProxyClass | HybridMessagingProxy |
An instance of the ProxyClass to be used for communication 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 class for event driven communicate with Javascript side
Definition at line 13 of file HybridMessagingHandler.cs.
HybridBridge.HybridMessagingHandler.HybridMessagingHandler | ( | string | jsVariableName = "HybridMessaging" | ) |
Creates a new instance of this class
jsVariableName | The name of the variable to be used from the Javascript side to access the HybridMessaging object |
Definition at line 48 of file HybridMessagingHandler.cs.
|
virtual |
The method to dispose this class
Definition at line 158 of file HybridMessagingHandler.cs.
|
protectedvirtual |
The method to dispose this class
Definition at line 175 of file HybridMessagingHandler.cs.
|
virtual |
Initialize the handler and generates the needed Javascript code
bridge | The BridgeController object requesting initialization |
Implements HybridBridge.IBridgeHandler.
Definition at line 83 of file HybridMessagingHandler.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 63 of file HybridMessagingHandler.cs.
|
protectedvirtual |
The method to be called when a new message received from the Javascript side
messageString | The message identification string, or string.Empty to match all |
arguments | The message arguments, or null |
Definition at line 443 of file HybridMessagingHandler.cs.
|
protectedvirtual |
Raises the PushJavascript event using provided arguments
sender | The IBridgeHandler instance that raised the event |
eventArgs | The arguments to be used to raise PushJavascript event |
Definition at line 202 of file HybridMessagingHandler.cs.
|
virtual |
Sends a message to the Javascript side
messageString | Message identification, or string.Empty to send to all subscribers |
Definition at line 211 of file HybridMessagingHandler.cs.
|
virtual |
Sends a message to the Javascript side
messageString | Message identification, or string.Empty to send to all subscribers |
argument | The argument to be send to the message subscriber |
TArgument | The type of the argument to send |
Definition at line 242 of file HybridMessagingHandler.cs.
|
virtual |
Sends a message to the Javascript side and waits for the response
messageString | Message identification, or string.Empty to send to all subscribers |
TResult | The type of the expected result |
Definition at line 223 of file HybridMessagingHandler.cs.
|
virtual |
Sends a message to the Javascript side and waits for the response
messageString | Message identification, or string.Empty to send to all subscribers |
argument | The argument to be send to the message subscriber |
TResult | The type of the expected result |
TArgument | The type of the argument to send |
Definition at line 255 of file HybridMessagingHandler.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 74 of file HybridMessagingHandler.cs.
|
protectedvirtual |
Registers an callback method for the specified message string
messageString | The message identification string to subscribe to |
callback | The callback function to be called for the message |
Definition at line 274 of file HybridMessagingHandler.cs.
|
virtual |
Registers a callback method for the specified message string
messageString | The message identification string to subscribe to |
callback | The callback function to be called for the message |
Definition at line 339 of file HybridMessagingHandler.cs.
|
virtual |
Registers a callback method for the specified message string
messageString | The message identification string to subscribe to |
callback | The callback function to be called for the message |
TArgument | The type of the message argument |
Definition at line 351 of file HybridMessagingHandler.cs.
|
virtual |
Registers a callback method for the specified message string
messageString | The message identification string to subscribe to |
callback | The callback function to be called for the message |
TResult | The type of the callback result |
Definition at line 376 of file HybridMessagingHandler.cs.
|
virtual |
Registers a callback method for the specified message string
messageString | The message identification string to subscribe to |
callback | The callback function to be called for the message |
TResult | The type of the callback result |
TArgument | The type of the message argument |
Definition at line 364 of file HybridMessagingHandler.cs.
|
protectedvirtual |
Unregisters a callback method for the specified message string
messageString | The message identification string to unsubscribe from |
callback | The callback function registered for the message |
Definition at line 304 of file HybridMessagingHandler.cs.
|
virtual |
Unregisters a callback method for the specified message string
messageString | The message identification string to unsubscribe from |
callback | The callback function registered for the message |
Definition at line 389 of file HybridMessagingHandler.cs.
|
virtual |
Unregisters a callback method for the specified message string
messageString | The message identification string to unsubscribe from |
callback | The callback function registered for the message |
TArgument | The type of the message argument |
Definition at line 403 of file HybridMessagingHandler.cs.
|
virtual |
Unregisters a callback method for the specified message string
messageString | The message identification string to unsubscribe from |
callback | The callback function registered for the message |
TResult | The type of the callback result |
Definition at line 432 of file HybridMessagingHandler.cs.
|
virtual |
Unregisters a callback method for the specified message string
messageString | The message identification string to unsubscribe from |
callback | The callback function registered for the message |
TResult | The type of the callback result |
TArgument | The type of the message argument |
Definition at line 418 of file HybridMessagingHandler.cs.
|
protected |
Indicates if the class already disposed
Definition at line 28 of file HybridMessagingHandler.cs.
|
protected |
An instance of the ClassBridge class for ProxyClass to be used as the communication bridge
Definition at line 34 of file HybridMessagingHandler.cs.
|
protected |
An instance of the ProxyClass to be used for communication
Definition at line 39 of file HybridMessagingHandler.cs.
|
protected |
A static object to be used as thread lock when working with other static fields
Definition at line 18 of file HybridMessagingHandler.cs.
|
protected |
A list of all registered delegates
Definition at line 23 of file HybridMessagingHandler.cs.
PushJavascriptEvent HybridBridge.HybridMessagingHandler.PushJavascript |
Event that gets raised when handler needs to push some Javascript code
Definition at line 153 of file HybridMessagingHandler.cs.