Fukicycle.Tool.AppBase
1.0.2
See the version list below for details.
dotnet add package Fukicycle.Tool.AppBase --version 1.0.2
NuGet\Install-Package Fukicycle.Tool.AppBase -Version 1.0.2
<PackageReference Include="Fukicycle.Tool.AppBase" Version="1.0.2" />
paket add Fukicycle.Tool.AppBase --version 1.0.2
#r "nuget: Fukicycle.Tool.AppBase, 1.0.2"
// Install Fukicycle.Tool.AppBase as a Cake Addin #addin nuget:?package=Fukicycle.Tool.AppBase&version=1.0.2 // Install Fukicycle.Tool.AppBase as a Cake Tool #tool nuget:?package=Fukicycle.Tool.AppBase&version=1.0.2
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)
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 | 88 | 5/10/2024 | |
8.0.4 | 165 | 4/16/2024 | |
8.0.3 | 126 | 4/15/2024 | |
8.0.2 | 110 | 4/11/2024 | |
8.0.1 | 98 | 4/11/2024 | |
8.0.0 | 96 | 4/10/2024 | |
7.0.5 | 73 | 5/10/2024 | |
7.0.4 | 103 | 4/16/2024 | |
7.0.3 | 96 | 4/15/2024 | |
7.0.2 | 94 | 4/11/2024 | |
7.0.1 | 95 | 4/11/2024 | |
7.0.0 | 86 | 4/10/2024 | |
6.0.5 | 73 | 5/10/2024 | |
6.0.4 | 114 | 4/16/2024 | |
6.0.3 | 109 | 4/15/2024 | |
6.0.2 | 94 | 4/11/2024 | |
6.0.1 | 105 | 4/11/2024 | |
6.0.0 | 97 | 4/10/2024 | |
1.0.3 | 98 | 4/10/2024 | |
1.0.2 | 88 | 4/9/2024 | |
1.0.1 | 116 | 4/9/2024 | |
1.0.0 | 124 | 4/9/2024 |