Skip to content

Commit

Permalink
1 single blazor host
Browse files Browse the repository at this point in the history
  • Loading branch information
Strypper committed Aug 30, 2024
1 parent b50480c commit f756f4e
Show file tree
Hide file tree
Showing 29 changed files with 714 additions and 182 deletions.
4 changes: 2 additions & 2 deletions maui-island.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MAUIsland.NewsFeatures.Inte
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGetFeatures", "NuGetFeatures", "{D069C6EA-9676-48DE-B16B-7A177A1FEDAB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MAUIsland.NuGetFeatures", "src\Features\NuGetFeatures\MAUIsland.NuGetFeatures\MAUIsland.NuGetFeatures.csproj", "{9A141D5A-B1B5-445B-9FCA-A08BA821D339}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MAUIsland.NuGetFeatures", "src\Features\NuGetFeatures\MAUIsland.NuGetFeatures\MAUIsland.NuGetFeatures.csproj", "{9A141D5A-B1B5-445B-9FCA-A08BA821D339}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NuGetFeatures.IntegrationTests", "src\Features\NuGetFeatures\NuGetFeatures.IntegrationTests\NuGetFeatures.IntegrationTests.csproj", "{5EEA72E3-4279-4131-9754-144F9D535A72}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetFeatures.IntegrationTests", "src\Features\NuGetFeatures\NuGetFeatures.IntegrationTests\NuGetFeatures.IntegrationTests.csproj", "{5EEA72E3-4279-4131-9754-144F9D535A72}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using DiscordRPC;
using MAUIsland.Features.LocalDbFeatures.GitHub;
using MAUIsland.GitHubFeatures;
using Microsoft.AspNetCore.Components;

namespace MAUIsland.Core;

Expand All @@ -25,7 +24,10 @@ public BlazorWebViewPageViewModel(IAppNavigator appNavigator,
ObservableCollection<string> navigationPageName = new();

[ObservableProperty]
public int counter;
int counter;

[ObservableProperty]
string blazorWebViewStartPath = "/blazor-web-view/";
#endregion

#region [ Overrides ]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/controls"
@page "/blazor-web-view/controls"

@using Microsoft.AspNetCore.Components;
@using System.ComponentModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/"
@page "/main"
@page "/blazor-web-view/"
@page "/blazor-web-view/main"
@namespace MAUIsland

<h1>Hello, world! wutttt?</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/weather"
@page "/blazor-web-view/weather"
@namespace MAUIsland

<h1>Weather</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@
Padding="0"
StrokeShape="RoundRectangle 4"
StrokeThickness="0">
<BlazorWebView x:Name="blazorWebView" HostPage="Features\Gallery\Pages\BuiltIn\Controls\BlazorWebView\Blazor\hosting\index.html">
<BlazorWebView
x:Name="blazorWebView"
HostPage="Blazor\hosting\index.html"
StartPath="{x:Binding BlazorWebViewStartPath}">
<BlazorWebView.RootComponents>
<RootComponent ComponentType="{x:Type local:Routes}" Selector="#app" />
</BlazorWebView.RootComponents>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private void BasePage_Loaded(object sender, EventArgs e)
private async void PageNavigateButton_Clicked(System.Object sender, System.EventArgs e)
{
var button = (Button)sender;
var pageUrl = "/" + button.Text.Replace(" Page", "").ToLower();
var pageUrl = viewModel.BlazorWebViewStartPath + button.Text.Replace(" Page", "").ToLower();
var wasDispatchCalled = await blazorWebView.TryDispatchAsync(sp =>
{
var navMan = sp.GetRequiredService<NavigationManager>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@page "/resumes-template/dotnet-template"

@namespace MAUIsland.ResumesTemplate

<h1>Hello, world! from resume template</h1>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@page "/resumes-template"

<h3>ResumesTemplate</h3>

@code {

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
xmlns:app="clr-namespace:MAUIsland"
xmlns:core="clr-namespace:MAUIsland.Core;assembly=MAUIsland.Core"
xmlns:local="clr-namespace:MAUIsland.ResumesTemplate"
Loaded="BasePage_Loaded">
x:DataType="local:ResumeDetailPageViewModel">
<Grid ColumnDefinitions="*,*">
<Button Clicked="Button_Clicked" Text="Move" />
<BlazorWebView
x:Name="blazorWebView"
x:Name="BlazorWebViewElement"
Grid.Column="1"
HostPage="Features\ResumesTemplate\Blazor\wwwroot\index.html">
HostPage="Blazor\hosting\index.html"
Loaded="BlazorWebViewElement_Loaded"
StartPath="{x:Binding BlazorWebViewStartPath}">
<BlazorWebView.RootComponents>
<RootComponent ComponentType="{x:Type local:Routes}" Selector="#app1" />
<RootComponent ComponentType="{x:Type app:Routes}" Selector="#app" />
</BlazorWebView.RootComponents>
</BlazorWebView>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,33 @@ namespace MAUIsland.ResumesTemplate;

public partial class ResumeDetailPage
{
public ResumeDetailPage()

#region [ CTor ]

public ResumeDetailPage(ResumeDetailPageViewModel vm)
{
InitializeComponent();

this.BindingContext = vm;
}
#endregion

private async void BasePage_Loaded(System.Object sender, System.EventArgs e)
private async void Button_Clicked(System.Object sender, System.EventArgs e)
{
await blazorWebView.TryDispatchAsync(sp =>
var a = await BlazorWebViewElement.TryDispatchAsync(sp =>
{
var navMan = sp.GetRequiredService<NavigationManager>();
navMan.NavigateTo("/test");
navMan.NavigateTo("/resumes-template/dotnet-template");
});
}

private async void Button_Clicked(System.Object sender, System.EventArgs e)
private async void BlazorWebViewElement_Loaded(System.Object sender, System.EventArgs e)
{
var a = await blazorWebView.TryDispatchAsync(sp =>
await BlazorWebViewElement.TryDispatchAsync(sp =>
{
var navMan = sp.GetRequiredService<NavigationManager>();
navMan.NavigateTo("/controls");
navMan.NavigateTo("/resumes-template/dotnet-template");
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@

public partial class ResumeDetailPageViewModel(IAppNavigator appNavigator) : NavigationAwareBaseViewModel(appNavigator)
{

#region [ Properties ]

[ObservableProperty]
string blazorWebViewStartPath = "/resumes-template";
#endregion
}
Loading

0 comments on commit f756f4e

Please sign in to comment.