-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/Dreamescaper/BlazorBindings.Maui/issues/66
- Loading branch information
1 parent
1e86cc2
commit 59a75cb
Showing
37 changed files
with
740 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace MauiBlazor | ||
{ | ||
public partial class App : Application | ||
{ | ||
public App(MauiBlazorBindingsRenderer renderer) => renderer.AddComponent<AppShell>(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace MauiBlazor | ||
{ | ||
public class AppConstants | ||
{ | ||
public const string FontAwesomeBrands = "FAB"; | ||
|
||
public const string FontAwesomeRegular = "FAR"; | ||
|
||
public const string FontAwesomeSolid = "FAS"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
@inject ShellNavigationManager Navigator | ||
|
||
<Shell> | ||
@* Flyout items *@ | ||
<FlyoutItem Title="Home" Icon="homeIcon"> | ||
<ShellContent> | ||
<HomePage /> | ||
</ShellContent> | ||
</FlyoutItem> | ||
<FlyoutItem Title="Search" Icon="searchIcon"> | ||
<ShellContent> | ||
<SearchPage /> | ||
</ShellContent> | ||
</FlyoutItem> | ||
<FlyoutItem Title="Settings" Icon="settingsIcon"> | ||
<ShellContent> | ||
<SettingsPage /> | ||
</ShellContent> | ||
</FlyoutItem> | ||
@* Menu items *@ | ||
<MenuItem Text="Logout" IconImageSource="logoutIcon" OnClick="OnLogoutClicked" /> | ||
@* Won't show up in the Flyout menu *@ | ||
<TabBar> | ||
<Tab> | ||
<ShellContent> | ||
<LoginPage /> | ||
</ShellContent> | ||
</Tab> | ||
</TabBar> | ||
</Shell> | ||
|
||
@code { | ||
ImageSource homeIcon = new FontImageSource() | ||
{ | ||
FontFamily = FontAwesomeSolid, | ||
Glyph = fas.IconFont.House, | ||
Color = Black | ||
}; | ||
|
||
ImageSource searchIcon = new FontImageSource() | ||
{ | ||
FontFamily = FontAwesomeSolid, | ||
Glyph = fas.IconFont.MagnifyingGlass, | ||
Color = Black | ||
}; | ||
|
||
ImageSource settingsIcon = new FontImageSource() | ||
{ | ||
FontFamily = FontAwesomeSolid, | ||
Glyph = fas.IconFont.Gear, | ||
Color = Black | ||
}; | ||
|
||
ImageSource logoutIcon = new FontImageSource() | ||
{ | ||
FontFamily = FontAwesomeSolid, | ||
Glyph = fas.IconFont.RightFromBracket, | ||
Color = Black | ||
}; | ||
|
||
async Task OnLogoutClicked() => await Navigator.NavigateToAsync("/login"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@page "/details" | ||
|
||
<ContentPage Title="Details"> | ||
<Grid RowDefinitions="*, *" ColumnDefinitions="*, *"> | ||
<GridCell Row="0" Column="0"> | ||
<Label Text="(0, 0)" HorizontalOptions="LayoutOptions.Center" VerticalOptions="LayoutOptions.Center" /> | ||
</GridCell> | ||
<GridCell Row="0" Column="1"> | ||
<Label Text="(0, 1)" HorizontalOptions="LayoutOptions.Center" VerticalOptions="LayoutOptions.Center" /> | ||
</GridCell> | ||
<GridCell Row="1" Column="0"> | ||
<Label Text="(1, 0)" HorizontalOptions="LayoutOptions.Center" VerticalOptions="LayoutOptions.Center" /> | ||
</GridCell> | ||
<GridCell Row="1" Column="1"> | ||
<Label Text="(1, 1)" HorizontalOptions="LayoutOptions.Center" VerticalOptions="LayoutOptions.Center" /> | ||
</GridCell> | ||
</Grid> | ||
</ContentPage> | ||
|
||
@code { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
global using BlazorBindings.Core; | ||
global using BlazorBindings.Maui; | ||
global using far = FontAwesome.Regular; | ||
global using fas = FontAwesome.Solid; | ||
|
||
global using static MauiBlazor.AppConstants; | ||
global using static Microsoft.Maui.Graphics.Colors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@page "/home" | ||
@inject ShellNavigationManager Navigator | ||
|
||
<ContentPage> | ||
<ToolbarItems> | ||
<ToolbarItem Text="Search" IconImageSource="searchIcon" OnClick="OnSearchClicked" /> | ||
</ToolbarItems> | ||
<ChildContent> | ||
<Label Text="Home" | ||
HorizontalOptions="LayoutOptions.Center" | ||
VerticalOptions="LayoutOptions.Center" /> | ||
</ChildContent> | ||
</ContentPage> | ||
|
||
@code { | ||
ImageSource searchIcon = new FontImageSource() | ||
{ | ||
FontFamily = FontAwesomeSolid, | ||
Glyph = fas.IconFont.MagnifyingGlass, | ||
Color = Black | ||
}; | ||
|
||
async Task OnSearchClicked() => await Navigator.NavigateToAsync("/search"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@page "/login" | ||
@inject ShellNavigationManager Navigator | ||
|
||
<ContentPage @ref="loginPage"> | ||
<Button Text="Login" | ||
HorizontalOptions="LayoutOptions.Center" | ||
VerticalOptions="LayoutOptions.Center" | ||
OnClick="OnLoginClicked" /> | ||
</ContentPage> | ||
|
||
@code { | ||
ContentPage loginPage; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
//Maui.ContentPage thisPage = loginPage.NativeControl; | ||
//Maui.Shell.SetNavBarIsVisible(thisPage, false); | ||
//Maui.Shell.SetPresentationMode(thisPage, PresentationMode.Animated); | ||
} | ||
|
||
async Task OnLoginClicked() => await Navigator.NavigateToAsync("/home"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@page "/main" | ||
@inject ShellNavigationManager Navigator | ||
|
||
<ContentPage> | ||
<ScrollView> | ||
<VerticalStackLayout Spacing="25" | ||
Padding="new(30,0)" | ||
VerticalOptions="LayoutOptions.Center"> | ||
|
||
<Image Source="dotNetBotSource" | ||
HeightRequest="200" | ||
HorizontalOptions="LayoutOptions.Center" /> | ||
|
||
<Label Text="Hello, World!" | ||
FontSize="32" | ||
HorizontalOptions="LayoutOptions.Center" /> | ||
|
||
<Label Text="Welcome to .NET Multi-platform App UI" | ||
FontSize="18" | ||
HorizontalOptions="LayoutOptions.Center" /> | ||
|
||
<Button Text="@ButtonText" | ||
HorizontalOptions="LayoutOptions.Center" | ||
OnClick="OnCounterClicked" /> | ||
|
||
<Button Text="Go to details page." | ||
HorizontalOptions="LayoutOptions.Center" | ||
OnClick="OnClicked" /> | ||
</VerticalStackLayout> | ||
</ScrollView> | ||
</ContentPage> | ||
|
||
@code { | ||
ImageSource dotNetBotSource = ImageSource.FromFile("dotnet_bot.png"); | ||
|
||
int count = 0; | ||
|
||
string ButtonText => count switch | ||
{ | ||
0 => "Click me", | ||
1 => $"Clicked 1 time", | ||
_ => $"Clicked {count} times" | ||
}; | ||
|
||
void OnCounterClicked() | ||
{ | ||
count++; | ||
} | ||
|
||
async Task OnClicked() => await Navigator.NavigateToAsync("/details"); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Razor"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks> | ||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>MauiBlazor</RootNamespace> | ||
<UseMaui>true</UseMaui> | ||
<SingleProject>true</SingleProject> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<EnableDefaultCssItems>false</EnableDefaultCssItems> | ||
|
||
<!-- Display name --> | ||
<ApplicationTitle>MauiBlazor</ApplicationTitle> | ||
|
||
<!-- App Identifier --> | ||
<ApplicationId>com.companyname.mauiblazor</ApplicationId> | ||
<ApplicationIdGuid>3ed29413-fbb3-4262-9adb-2c59a43b416a</ApplicationIdGuid> | ||
|
||
<!-- Versions --> | ||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> | ||
<ApplicationVersion>1</ApplicationVersion> | ||
|
||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">23.0</SupportedOSPlatformVersion> | ||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion> | ||
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!-- App Icon --> | ||
<MauiIcon Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" Color="#512BD4" /> | ||
|
||
<!-- Splash Screen --> | ||
<MauiSplashScreen Include="Resources\appiconfg.svg" Color="#512BD4" BaseSize="128,128" /> | ||
|
||
<!-- Images --> | ||
<MauiImage Include="Resources\Images\*" /> | ||
|
||
<!-- Custom Fonts --> | ||
<MauiFont Include="Resources\Fonts\*" /> | ||
|
||
<!-- Raw Assets (also remove the "Resources\Raw" prefix) --> | ||
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BlazorBindings.Maui" Version="0.9.2-preview" /> | ||
<PackageReference Include="VijayAnand.FontAwesome" Version="2.1.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31611.283 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiBlazor", "MauiBlazor.csproj", "{C01396EE-7233-4298-841A-712D250F9D55}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C01396EE-7233-4298-841A-712D250F9D55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C01396EE-7233-4298-841A-712D250F9D55}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C01396EE-7233-4298-841A-712D250F9D55}.Debug|Any CPU.Deploy.0 = Debug|Any CPU | ||
{C01396EE-7233-4298-841A-712D250F9D55}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C01396EE-7233-4298-841A-712D250F9D55}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{C01396EE-7233-4298-841A-712D250F9D55}.Release|Any CPU.Deploy.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {B750A2DF-70FE-4058-838E-2BD25DD8EA96} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace MauiBlazor | ||
{ | ||
public static class MauiProgram | ||
{ | ||
public static MauiApp CreateMauiApp() | ||
{ | ||
var builder = MauiApp.CreateBuilder(); | ||
builder.UseMauiApp<App>() | ||
.UseMauiBlazorBindings() | ||
.ConfigureFonts(fonts => | ||
{ | ||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | ||
fonts.AddFont("fa-brands-400.ttf", FontAwesomeBrands); | ||
fonts.AddFont("fa-regular-400.ttf", FontAwesomeRegular); | ||
fonts.AddFont("fa-solid-900.ttf", FontAwesomeSolid); | ||
}); | ||
|
||
builder.Services.AddSingleton<ShellNavigationManager>(); | ||
|
||
return builder.Build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" /> | ||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Android.App; | ||
using Android.Content.PM; | ||
using Android.OS; | ||
|
||
namespace MauiBlazor; | ||
|
||
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)] | ||
public class MainActivity : MauiAppCompatActivity | ||
{ | ||
protected override void OnCreate(Bundle savedInstanceState) | ||
{ | ||
base.OnCreate(savedInstanceState); | ||
Platform.Init(this, savedInstanceState); | ||
} | ||
|
||
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults) | ||
{ | ||
Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); | ||
|
||
base.OnRequestPermissionsResult(requestCode, permissions, grantResults); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Android.App; | ||
using Android.Runtime; | ||
|
||
namespace MauiBlazor; | ||
|
||
[Application] | ||
public class MainApplication : MauiApplication | ||
{ | ||
public MainApplication(IntPtr handle, JniHandleOwnership ownership) | ||
: base(handle, ownership) | ||
{ | ||
} | ||
|
||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="colorPrimary">#512BD4</color> | ||
<color name="colorPrimaryDark">#2B0B98</color> | ||
<color name="colorAccent">#2B0B98</color> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Foundation; | ||
|
||
namespace MauiBlazor; | ||
|
||
[Register("AppDelegate")] | ||
public class AppDelegate : MauiUIApplicationDelegate | ||
{ | ||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
} |
Oops, something went wrong.