OpenCodeDev.Blazor.Foundation.Extensions
3.0.6
See the version list below for details.
dotnet add package OpenCodeDev.Blazor.Foundation.Extensions --version 3.0.6
NuGet\Install-Package OpenCodeDev.Blazor.Foundation.Extensions -Version 3.0.6
<PackageReference Include="OpenCodeDev.Blazor.Foundation.Extensions" Version="3.0.6" />
paket add OpenCodeDev.Blazor.Foundation.Extensions --version 3.0.6
#r "nuget: OpenCodeDev.Blazor.Foundation.Extensions, 3.0.6"
// Install OpenCodeDev.Blazor.Foundation.Extensions as a Cake Addin #addin nuget:?package=OpenCodeDev.Blazor.Foundation.Extensions&version=3.0.6 // Install OpenCodeDev.Blazor.Foundation.Extensions as a Cake Tool #tool nuget:?package=OpenCodeDev.Blazor.Foundation.Extensions&version=3.0.6
OpenCodeDev.Blazor.Foundation.Extensions
This is a extension package for Blazor Foundation and some services requires BF's JS.
It can be used on its own if you are not using services requiring BF.
What's inside?
Services
Localizasion Helper
Helps to use localization to easily switch language.
using OpenCodeDev.Blazor.Foundation.Extensions;
WebAssemblyHost host = builder.Build();
await host.LoadCulture(); // Load Default 'en' or saved in localStorage as 'culture'
await host.RunAsync();
Change language like so...
@inject NavigationManager Navigate;
await LocalStorage.Set("culture", 'en'); // Set new language in localstorage.
Navigate.NavigateTo(Navigate.Uri, forceLoad: true);
LocalStorage
Quick helper tool to access and set localstorage objects.
builder.Services.AddBFLocalStorage(); // Add LocalStorage Service
_Imports.razor
@using OpenCodeDev.Blazor.Foundation.Extensions.LocalStorage;
@inject ILocalStorage LocalStorage;
CRUD functions
await LocalStorage.Set("culture", code); // Set a value
await LocalStorage.Get("culture"); // Get value for given key
await LocalStorage.Remove("culture"); // Remove Specific Item
await LocalStorage.Clear(); // Clear All Storage
Clipboard Service (Requires Blazor Foundation's JS)
Copy and Paste text easily across your app
using OpenCodeDev.Blazor.Foundation.Extensions;
builder.Services.AddBFClipboard();
@using Microsoft.JSInterop;
@using OpenCodeDev.Blazor.Foundation.Extensions.Clipboard;
@inject IJSRuntime JS;
@inject IClipboard clip;
await clip.SetText(JS,"My Copied Text");
string textPaste = await clip.ReadText(JS); // Requires Permission from user.
Extension Methods
@using OpenCodeDev.Blazor.Foundation.Extensions;
HTMLCompliant()
Makes guid html compliant for id (for vanilla JS). It simply makes sure the guid starts with a letter and not a number.
Guid id = Guid.NewGuid().HTMLCompliant();
ToJSObjectString()
Convert a <code>Dictionary<string, object></code> to Javascript Object structure.
Note: it can only support cimple object not nested Key:Value (String, Bool, Number).
Dictionary<string, object> tt = new Dictionary<string, object>() { { "MyString", "Test" }, { "MyNum", 6.0 }, { "MyBool", false } };
string jsobj = tt.ToJSObjectString(); //Produce a JS object.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Microsoft.AspNetCore.Components (>= 6.0.1)
- Microsoft.AspNetCore.Components.Web (>= 6.0.1)
- Microsoft.AspNetCore.Components.WebAssembly (>= 6.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
3.0.8 | 1,073 | 5/29/2022 | |
3.0.6 | 435 | 1/24/2022 | |
3.0.5 | 642 | 1/24/2022 | |
3.0.3 | 739 | 1/24/2022 | |
3.0.0 | 418 | 11/19/2021 | |
1.1.0-rc.1.5 | 161 | 11/16/2021 | |
1.1.0-rc.1.4 | 142 | 11/3/2021 |