Fukicycle.Tool.AppBase
8.0.5
dotnet add package Fukicycle.Tool.AppBase --version 8.0.5
NuGet\Install-Package Fukicycle.Tool.AppBase -Version 8.0.5
<PackageReference Include="Fukicycle.Tool.AppBase" Version="8.0.5" />
paket add Fukicycle.Tool.AppBase --version 8.0.5
#r "nuget: Fukicycle.Tool.AppBase, 8.0.5"
// Install Fukicycle.Tool.AppBase as a Cake Addin #addin nuget:?package=Fukicycle.Tool.AppBase&version=8.0.5 // Install Fukicycle.Tool.AppBase as a Cake Tool #tool nuget:?package=Fukicycle.Tool.AppBase&version=8.0.5
Fukicycle.Tool.AppBase
This library provides blazor app base function. For example, error handling, display loading and display dialog.
Happy coding 😃
Features
- Provides application base function.
Installing and Getting started
1. install package.
Fukicycle.Tool.AppBase
is available for download and installation as NuGet packages.
dotnet add package Fukicycle.Tool.AppBase --version <version>
2. Create your app.
Add using
Fukicycle.Tool.AppBase
(_Imports.razor_
)If you use other components, you have to add bellow namespace.
Fukicycle.Tool.AppBase.Components
Fukicycle.Tool.AppBase.Components.Dialog
Fukicycle.Tool.AppBase.Store
Register service. (
Program.cs
)builder.Services.AddAppBase();
Change
LayoutComponentBase
toAppBaseLayoutComponentBase
(MainLayout.razor
)- @inherits LayoutComponentBase + @inherits AppBaseLayoutComponentBase @Body
If you want to use default loader and dialog, you have to add bellow. (
MainLayout.razor
)@inherits AppBaseLayoutComponentBase @Body @if (StateContainer.IsLoading) { <Loader /> @/* 👈 You can change your loader component */ } @if (StateContainer.DialogContent != null) { <Dialog /> @/* 👈 You can change your dialog component */ }
Finally, let each page inherit
ViewBase
and you're done! 😃@page "/" @inherits ViewBase <h1>Hello, world!</h1>
Use
Execute
orExecuteAsync
to execute code while handling errors.@page "/" @inherits ViewBase <h1>Hello, world!</h1> <div>Members</div> @if(_members != null) { @foreach (string member in _members) { <div>@member</div> } } @if(_skills != null) { @foreach (string skill in _skills) { <div>@skill</div> } } @code { private List<string>? _members = null; private List<string>? _skills = null; protected override async Task OnInitializedAsync() { //loader _skills = await ExecuteAsync(GetSkillsAsync, true); //no loader _members = Execute(GetMembers); } private List<string> GetMembers() { if (Random.Shared.Next() % 2 == 0) throw new Exception("Something broke!!!"); return new List<string> { "fukicycle", "you", "other" }; } private async Task<List<string>> GetSkillsAsync() { await Task.Delay(3000); return new List<string> { "C#", "Kotlin", "Java", "Blazor" }; } }
Contributing
Pull requests and stars are always welcome.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create.
Any contributions you make are greatly appreciated.
- Fork the Project.
- Create your Feature Branch(
git checkout -b feature/amazing_feature
). - Commit your Changes(
git commit -m 'Add some changes'
). - Push to the Branch(
git push origin feature/amazing_feature
). - Open a Pull Request.
Author
License
MIT. Click here for details.
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)
- Newtonsoft.Json (>= 13.0.3)
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 | |
---|---|---|---|
8.0.5 | 89 | 5/10/2024 | |
8.0.4 | 166 | 4/16/2024 | |
8.0.3 | 127 | 4/15/2024 | |
8.0.2 | 111 | 4/11/2024 | |
8.0.1 | 99 | 4/11/2024 | |
8.0.0 | 97 | 4/10/2024 | |
7.0.5 | 74 | 5/10/2024 | |
7.0.4 | 108 | 4/16/2024 | |
7.0.3 | 97 | 4/15/2024 | |
7.0.2 | 95 | 4/11/2024 | |
7.0.1 | 98 | 4/11/2024 | |
7.0.0 | 87 | 4/10/2024 | |
6.0.5 | 74 | 5/10/2024 | |
6.0.4 | 117 | 4/16/2024 | |
6.0.3 | 110 | 4/15/2024 | |
6.0.2 | 97 | 4/11/2024 | |
6.0.1 | 106 | 4/11/2024 | |
6.0.0 | 98 | 4/10/2024 | |
1.0.3 | 99 | 4/10/2024 | |
1.0.2 | 89 | 4/9/2024 | |
1.0.1 | 117 | 4/9/2024 | |
1.0.0 | 125 | 4/9/2024 |