SpawnDev.BlazorJS.Photino
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SpawnDev.BlazorJS.Photino --version 1.0.0
NuGet\Install-Package SpawnDev.BlazorJS.Photino -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpawnDev.BlazorJS.Photino" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SpawnDev.BlazorJS.Photino" Version="1.0.0" />
<PackageReference Include="SpawnDev.BlazorJS.Photino" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SpawnDev.BlazorJS.Photino --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SpawnDev.BlazorJS.Photino, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SpawnDev.BlazorJS.Photino@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SpawnDev.BlazorJS.Photino&version=1.0.0
#tool nuget:?package=SpawnDev.BlazorJS.Photino&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SpawnDev.BlazorJS.Photino
SpawnDev.BlazorJS.Photino provides tools for 2 way interop, similar to SignalR, between the native Photino app and Blazor WebAssembly apps running in PhotinoWindow instances.
Photino.Net app Program.cs
// create RemoteServiceProviderBuilder
var appBuilder = PhotinoBlazorWASMAppBuilder.CreateDefault(args);
// add services that Blazor WebAssembly instances can call using the WebAssembly service PhotinoAppDispatcher
// Singleton services are shared with all windows
// Scoped services are per-window
// Transient are per call
appBuilder.Services.AddSingleton<IConsoleLogger, ConsoleLogger>();
// build
var app = appBuilder.Build();
/// <summary>
/// If true, closing the main window will hide it instead of closing it.<br/>
/// This allows the app to stay alive until all windows are closed.<br/>
/// NOTE: Only supported when PhotinoWindow.IsWindowsPlatform == true<br/>
/// Default: false
/// </summary>
app.IndependentWindows = false;
/// <summary>
/// If true the app will not exit when there are no windows except invisible MainWindow.<br/>
/// Setting this to true is useful for a system tray icon that can be used to create a new window or show the main one.<br/>
/// NOTE: Only supported when PhotinoWindow.IsWindowsPlatform == true<br/>
/// Default: false
/// </summary>
app.InvisibleKeepAlive = false;
#if DEBUG
// url where the Blazor WebAssembly dev server is hosting when DEBUG
// if not set, the app's "wwwroot/index.html" path will be used.
// In production a release build of your Blazor WASM app could be served from there.
app.SetAppBaseUri("https://localhost:7174/");
#endif
// Start app. Show main window
app.Run();
Blazor WebAssembly app Program.cs
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
// BlazorJSRuntime (PhotinoAppDispatcher dependency)
builder.Services.AddBlazorJSRuntime(out var JS);
// PhotinoAppDispatcher lets us call into the Photino hosting app (if available)
builder.Services.AddSingleton<PhotinoAppDispatcher>();
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// Start
await builder.Build().BlazorJSRunAsync();
Example usage:
@page "/"
@using SpawnDev.BlazorJS.JSObjects
<PageTitle>Home</PageTitle>
<h1>Home</h1>
Connected to Photino app services: @PhotinoAppDispatcher.IsReady
<br />
<button disabled="@(!PhotinoAppDispatcher.IsReady)" class="btn btn-primary" @onclick="OpenWindow">Open Window</button>
<button disabled="@(!PhotinoAppDispatcher.IsReady)" class="btn btn-primary" @onclick="CloseThisWindow">Close this window</button>
@code {
[Inject]
PhotinoAppDispatcher PhotinoAppDispatcher { get; set; } = default!;
private async Task OpenWindow()
{
// call PhotinoBlazorWASMApp.OpenWindow() in the Photino host app on the PhotinoBlazorWASMApp service
await PhotinoAppDispatcher.Run<PhotinoBlazorWASMApp>(s => s.OpenWindow());
}
private async Task CloseThisWindow()
{
// call PhotinoBlazorWASMWindow.Close() in the Photino host app on this window's PhotinoBlazorWASMWindow instance
await PhotinoAppDispatcher.Run<PhotinoBlazorWASMWindow>(s => s.Close());
}
}
| 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.AspNetCore.Components.WebAssembly (>= 8.0.19)
- Photino.NET (>= 3.2.3)
- SpawnDev.BlazorJS.WebWorkers (>= 2.23.0)
- System.Text.Json (>= 8.0.6)
-
net9.0
- Microsoft.AspNetCore.Components.WebAssembly (>= 9.0.8)
- Photino.NET (>= 3.2.3)
- SpawnDev.BlazorJS.WebWorkers (>= 2.23.0)
- System.Text.Json (>= 9.0.8)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SpawnDev.BlazorJS.Photino:
| Package | Downloads |
|---|---|
|
SpawnDev.BlazorJS.Photino.App
Blazor WebAssembly in Photino. Use this package in the Photino.Net app project. |
GitHub repositories
This package is not used by any popular GitHub repositories.