SoftwareDriven.InteropWebView.Client
1.0.0
See the version list below for details.
dotnet add package SoftwareDriven.InteropWebView.Client --version 1.0.0
NuGet\Install-Package SoftwareDriven.InteropWebView.Client -Version 1.0.0
<PackageReference Include="SoftwareDriven.InteropWebView.Client" Version="1.0.0" />
paket add SoftwareDriven.InteropWebView.Client --version 1.0.0
#r "nuget: SoftwareDriven.InteropWebView.Client, 1.0.0"
// Install SoftwareDriven.InteropWebView.Client as a Cake Addin #addin nuget:?package=SoftwareDriven.InteropWebView.Client&version=1.0.0 // Install SoftwareDriven.InteropWebView.Client as a Cake Tool #tool nuget:?package=SoftwareDriven.InteropWebView.Client&version=1.0.0
SoftwareDriven.InteropWebView is a pub/sub hub solution to communicate strongly typed between a MAUI web view that runs a Blazor frontend hosted somewhere else.
- SoftwareDriven.InteropWebView contains shared classes
- SoftwareDriven.InteropWebView.Host is for the MAUI app
- SoftwareDriven.InteropWebView.Client is for the Blazor frontend.
In the MAUI app, register the web view:
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
})
.ConfigureMauiHandlers(handlers =>
{
handlers.AddHandler(typeof(InteropWebView), typeof(InteropWebViewHandler));
});
And don't forget to use the control in the target page. Bind the 'MessageHub' to it, e.g. from a viewmodel. Two self explanatory methods are provided by the hub:
MessageHub.Subscribe<T>(string topic, Action<T> action);
MessageHub.Publish<T>(string topic, T data);
In the client, register the following services:
services.AddSingleton<InteropMessageHub>();
services.AddSingleton<InteropClient>();
Trigger the initialization early, e.g. by triggering the creation of the service:
// Trigger the creation of the interop client.
services.GetService<InteropClient>();
Again, use the publish and subscribe methods to get or receive typed data.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.3)
- SoftwareDriven.InteropWebView (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.