Custom Handler
If functionality is needed that isn't included in the built-in modules or extensions, the hybrid integration can be extended to provide custom modules with properties, methods, and events.
Handlers
Handlers are used to link the server-side and client-side (MAUI) integrations. Handlers implement the IClientHandler interface and provide several methods for processing requests from a Wisej.NET application which can be used to wire custom properties, methods, and events.
Example Client-Side Handler Integration
/// <summary>
/// Client-side integration for mathematical operations.
/// </summary>
internal class MathHandler : IClientHandler
{
string IClientHandler.Identifier => "math";
bool IClientHandler.ProcessRequest(DeviceRequest request)
{
var num1 = request.Arguments[0];
var num2 = request.Arguments[1];
switch (request.Action)
{
case "add":
App.FireModalResponse(Add(num1, num2));
return true;
case "subtract":
App.FireModalResponse(Subtract(num1, num2));
return true;
default:
return false;
}
}
void IClientHandler.Reset()
{
// reset the UI changes.
}
private DeviceResponse Add(int num1, int num2)
{
return new DeviceResponse(num1 + num2);
}
private DeviceResponse Subtract(int num1, int num2)
{
return new DeviceResponse(num1 - num2);
}
}Registering Client-Side Handler
Example Usage on Server
Information Providers
Information providers are used to extend the Device.Info member. They provide information on startup about the client hybrid device and its capabilities. New information providers can be registered by adding a new IClientInfoProvider.
Example Client-Side Information Provider
Example Implementation on Server
Example Usage on Server
Last updated