Skip to content

Commit

Permalink
Merge pull request #5 from egvijayanand/working
Browse files Browse the repository at this point in the history
Initial release of VijayAnand.MauiToolkit.* NuGet packages
  • Loading branch information
egvijayanand authored Mar 7, 2022
2 parents 6be8feb + 2d16f00 commit feb4a4d
Show file tree
Hide file tree
Showing 26 changed files with 700 additions and 1 deletion.
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,54 @@
### .NET MAUI Blazor Toolkit
### VijayAnand.MauiToolkit.Core

This is a toolkit with a set of abstractions to simplify working with .NET MAUI and Blazor.

It's built on top of .NET 6 and published as a NuGet package - [![VijayAnand.MauiToolkit.Core - NuGet Package](https://badgen.net/nuget/v/VijayAnand.MauiToolkit.Core/)](https://www.nuget.org/packages/VijayAnand.MauiToolkit.Core/)

The objective is to ease the development of the `Razor Class Library` (RCL) so that it can be shared with all Blazor targets (.NET MAUI, Server, WebAssembly, Windows Forms, and WPF).

And .NET MAUI targets Android, iOS, macOS (via Mac Catalyst), and Windows (via WinUI 3).

To start with defines the following abstractions:

* Dialogs - `IDialogService`
* Navigation - `INavigationService`
* Share - `IShareService`

### VijayAnand.MauiToolkit

This is a toolkit with a set of helper methods and classes to simplify working with .NET MAUI and Blazor.

Published as a NuGet package - [![VijayAnand.MauiToolkit - NuGet Package](https://badgen.net/nuget/v/VijayAnand.MauiToolkit/)](https://www.nuget.org/packages/VijayAnand.MauiToolkit/)

It depends on [VijayAnand.MauiToolkit.Core](https://www.nuget.org/packages/VijayAnand.MauiToolkit.Core/) NuGet package.

To start with, implements the concrete definition of the abstractions defined in Core package:

* Dialogs - `DialogService` (works with MainPage or Shell definition)
- Additional abstraction specific to .NET MAUI with `FlowDirection`
* Navigation - `NavigationService` (based on Shell Navigation pattern)
* Share - `ShareService` (based on Maui Essentials)

Most importantly, provides an extension method to register these services in .NET MAUI host builder startup:

`UseVijayAnandMauiToolkit()`

Usage:

```cs
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.UseMauiApp<App>()
.UseVijayAnandMauiToolkit();
return builder.Build();
}
}
```

### VijayAnand.MauiBlazor.Markup

This toolkit a set of fluent helper methods and classes to simplify working with .NET MAUI Blazor in C#.

Expand Down
8 changes: 8 additions & 0 deletions dotnet-maui-toolkit.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
1 change: 1 addition & 0 deletions src/VijayAnand.MauiToolkit/CorePackageName.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VijayAnand.MauiToolkit.Core
5 changes: 5 additions & 0 deletions src/VijayAnand.MauiToolkit/Create-Debug-Package.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:: Creates a new NuGet package from the project file in Debug configuration
@echo off

call Create-Package.bat Debug
pause
60 changes: 60 additions & 0 deletions src/VijayAnand.MauiToolkit/Create-Package.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
:: Creates a new NuGet package from the project file
@echo off

if [%1]==[] (call Error "Build configuration input is not provided." & goto end)

set config=%1

:: Package Name

if not exist CorePackageName.txt (call Error "Core package name file not available." & goto end)

set /P corePkgName=<CorePackageName.txt

if [%corePkgName%]==[] (call Error "Core package name not configured." & goto end)

if not exist ToolkitPackageName.txt (call Error "Toolkit package name file not available." & goto end)

set /P toolkitPkgName=<ToolkitPackageName.txt

if [%toolkitPkgName%]==[] (call Error "Toolkit package name not configured." & goto end)

:: Package Version

if not exist PackageVersion.txt (call Error "Version file not available." & goto end)

set /P pkgVersion=<PackageVersion.txt

if [%pkgVersion%]==[] (call Error "Version # not configured." & goto end)

:: .NET SDK Version

dotnet --version

:: Package Configuration

call Info "Core Package: %corePkgName% ver. %pkgVersion%"
call Info "Toolkit Package: %toolkitPkgName% ver. %pkgVersion%"

call Info "Delete existing package ..."

if exist .\VijayAnand.MauiToolkit.Core\bin\%config%\%corePkgName%.%pkgVersion%.nupkg del .\VijayAnand.MauiToolkit.Core\bin\%config%\%corePkgName%.%pkgVersion%.nupkg

if exist .\VijayAnand.MauiToolkit\bin\%config%\%toolkitPkgName%.%pkgVersion%.nupkg del .\VijayAnand.MauiToolkit\bin\%config%\%toolkitPkgName%.%pkgVersion%.nupkg

call Info "Creating NuGet package ..."

dotnet build .\VijayAnand.MauiToolkit.Core\VijayAnand.MauiToolkit.Core.csproj -c %config% -p:PackageVersion=%pkgVersion% -p:ContinuousIntegrationBuild=true

if not %errorlevel% == 0 (call Error "Core package creation failed." & goto end)

echo.
:: Adding NuGet reference
::dotnet add .\VijayAnand.MauiToolkit\VijayAnand.MauiToolkit.csproj package %corePkgName% --version %pkgVersion%

dotnet build .\VijayAnand.MauiToolkit\VijayAnand.MauiToolkit.csproj -c %config% -p:PackageVersion=%pkgVersion% -p:ContinuousIntegrationBuild=true

echo.
if %errorlevel% == 0 (call Success "Process completed.") else (call Error "Toolkit package creation failed.")

:end
5 changes: 5 additions & 0 deletions src/VijayAnand.MauiToolkit/Create-Release-Package.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:: Creates a new NuGet package from the project file in Release configuration
@echo off

call Create-Package.bat Release
pause
1 change: 1 addition & 0 deletions src/VijayAnand.MauiToolkit/PackageVersion.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0-pre1
67 changes: 67 additions & 0 deletions src/VijayAnand.MauiToolkit/Push-Release-Package.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
:: Installs the NuGet package
@echo off

if defined MyGetSource (set "nugetSource=%MyGetSource%") else (set nugetSource=E:\Tasks\Projects\Templates\Release\NuGet\Packages)

:: Package Name

if not exist CorePackageName.txt (call Error "Core package name file not available." & goto end)

set /P corePkgName=<CorePackageName.txt

if [%corePkgName%]==[] (call Error "Core package name not configured." & goto end)

if not exist ToolkitPackageName.txt (call Error "Maui package name file not available." & goto end)

set /P toolkitPkgName=<ToolkitPackageName.txt

if [%toolkitPkgName%]==[] (call Error "Maui package name not configured." & goto end)

:: Package Version

if not exist PackageVersion.txt (call Error "Package version file not available." & goto end)

set /P pkgVersion=<PackageVersion.txt

if [%pkgVersion%]==[] (call Error "Package version # not configured." & goto end)

:: Existence Check

if not exist .\VijayAnand.MauiToolkit.Core\bin\Release\%corePkgName%.%pkgVersion%.nupkg call Error "Core NuGet package not avilable ..." & goto end

if not exist .\VijayAnand.MauiToolkit\bin\Release\%toolkitPkgName%.%pkgVersion%.nupkg call Error "Toolkit NuGet package not avilable ..." & goto end

:: Validate the Package

call Info "Validating %corePkgName% ver. %pkgVersion% ..."

dotnet-validate package local .\VijayAnand.MauiToolkit.Core\bin\Release\%corePkgName%.%pkgVersion%.nupkg

call Info "Validating %toolkitPkgName% ver. %pkgVersion% ..."

dotnet-validate package local .\VijayAnand.MauiToolkit\bin\Release\%toolkitPkgName%.%pkgVersion%.nupkg

:: Directory Check

if not exist "%nugetSource%\%corePkgName%\" mkdir "%nugetSource%\%corePkgName%"

if not exist "%nugetSource%\%toolkitPkgName%\" mkdir "%nugetSource%\%toolkitPkgName%"

:: Push the Package

call Info "Pushing %corePkgName% ver. %pkgVersion% to My NuGet ..."

dotnet nuget push .\VijayAnand.MauiToolkit.Core\bin\Release\%corePkgName%.%pkgVersion%.nupkg --source %nugetSource%\%corePkgName%

if not %errorlevel% == 0 (call Error "Core package push failed." & goto end)

echo.
call Info "Pushing %toolkitPkgName% ver. %pkgVersion% to My NuGet ..."

dotnet nuget push .\VijayAnand.MauiToolkit\bin\Release\%toolkitPkgName%.%pkgVersion%.nupkg --source %nugetSource%\%toolkitPkgName%

echo.
if %errorlevel% == 0 (call Success "Process completed.") else (call Error "Toolkit package push failed.")

:end
pause
1 change: 1 addition & 0 deletions src/VijayAnand.MauiToolkit/ToolkitPackageName.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VijayAnand.MauiToolkit
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace VijayAnand.MauiToolkit.Core
{
public interface IDialogService
{
Task<string> DisplayActionSheet(string title, string cancel, string destruction, params string[] buttons);

Task DisplayAlert(string title, string message, string cancel);

Task<bool> DisplayAlert(string title, string message, string accept, string cancel);

Task<string> DisplayPromptAsync(string title, string message, string accept = "OK", string cancel = "Cancel", string? placeholder = null, int maxLength = -1, InputType inputType = InputType.Default, string initialValue = "");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace VijayAnand.MauiToolkit.Core
{
public interface INavigationService
{
Task GoToAsync(string uri);

Task GoToAsync(string uri, string key, string value);

Task GoToAsync(string uri, Dictionary<string, object> parameters);

Task GoBackAsync(bool modal = false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace VijayAnand.MauiToolkit.Core
{
public interface IShareService
{
Task ShareText(string title, string text);

Task ShareUri(string title, string text, string uri);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace VijayAnand.MauiToolkit.Core
{
public enum InputType
{
Plain,
Chat,
Decimal,
Default,
Email,
Numeric,
Telephone,
Text,
Url
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>

<!-- Project Options -->
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>VijayAnand.MauiToolkit.Core</RootNamespace>

<!-- NuGet Package Info -->
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>VijayAnand.MauiToolkit.Core</PackageId>
<Authors>Vijay Anand E G</Authors>
<Copyright>Copyright &#169; 2022 Vijay Anand E G</Copyright>
<Product>VijayAnand.MauiToolkit.Core is a set of helper methods and classes to simplify working with .NET MAUI (and Blazor).</Product>
<Title>.NET MAUI Toolkit - Core</Title>
<Description>VijayAnand.MauiToolkit.Core is a set of helper methods and classes to simplify working with .NET MAUI (and Blazor).</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/egvijayanand/dotnet-maui-toolkit</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>.NET,MAUI,Blazor,BlazorWebView,C#,Hybrid,Toolkit,Razor,RCL,iOS,Android,macOS,WinForms,Windows,WinUI3,WPF,MacCatalyst,Server,WebAssembly,WASM</PackageTags>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/release-notes.txt"))</PackageReleaseNotes>
<AssemblyName>VijayAnand.MauiToolkit.Core</AssemblyName>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<PackageReadmeFile>overview.md</PackageReadmeFile>
<PackageProjectUrl>https://egvijayanand.in/</PackageProjectUrl>

<!-- Source Linking -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<None Include="overview.md" Pack="true" PackagePath="\" />
<None Include="release-notes.txt" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions src/VijayAnand.MauiToolkit/VijayAnand.MauiToolkit.Core/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### VijayAnand.MauiToolkit.Core

This is a toolkit with a set of abstractions to simplify working with .NET MAUI and Blazor.

It's built on top of .NET 6 and published as a NuGet package - [VijayAnand.MauiToolkit.Core](https://www.nuget.org/packages/VijayAnand.MauiToolkit.Core/).

The objective is to ease the development of the `Razor Class Library` (RCL) so that it can be shared with all Blazor targets (.NET MAUI, Server, WebAssembly, Windows Forms, and WPF).

And .NET MAUI targets Android, iOS, macOS (via Mac Catalyst), and Windows (via WinUI 3).

To start with defines the following abstractions:

* Dialogs - `IDialogService`
* Navigation - `INavigationService`
* Share - `IShareService`
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
What's new in ver. 1.0.0-pre1:

Initial release of VijayAnand.MauiToolkit.Core NuGet package and is built on top of .NET 6.

The objective is to ease the development of the Razor Class Library (RCL) so that it can be shared with all Blazor targets (.NET MAUI, Server, WebAssembly, Windows Forms, and WPF).

And .NET MAUI targets Android, iOS, macOS (via Mac Catalyst), and Windows (via WinUI 3).

To start with defines the following abstractions:

1. Dialogs - IDialogService
2. Navigation - INavigationService
3. Share - IShareService
28 changes: 28 additions & 0 deletions src/VijayAnand.MauiToolkit/VijayAnand.MauiToolkit.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VijayAnand.MauiToolkit", "VijayAnand.MauiToolkit\VijayAnand.MauiToolkit.csproj", "{8384E7C5-B193-4915-A493-7488B92DF85C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VijayAnand.MauiToolkit.Core", "VijayAnand.MauiToolkit.Core\VijayAnand.MauiToolkit.Core.csproj", "{AF5EAD10-57A6-49D1-B449-CFB3F2EFA5E4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8384E7C5-B193-4915-A493-7488B92DF85C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8384E7C5-B193-4915-A493-7488B92DF85C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8384E7C5-B193-4915-A493-7488B92DF85C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8384E7C5-B193-4915-A493-7488B92DF85C}.Release|Any CPU.Build.0 = Release|Any CPU
{AF5EAD10-57A6-49D1-B449-CFB3F2EFA5E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF5EAD10-57A6-49D1-B449-CFB3F2EFA5E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF5EAD10-57A6-49D1-B449-CFB3F2EFA5E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF5EAD10-57A6-49D1-B449-CFB3F2EFA5E4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
Loading

0 comments on commit feb4a4d

Please sign in to comment.