generated from Integry/Template_NetMauiBlazorHybrid
Compare commits
1 Commits
c61ebe348c
...
feature/Na
| Author | SHA1 | Date | |
|---|---|---|---|
| ddc596ef58 |
@@ -4,17 +4,12 @@ namespace salesbook.Maui
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
private readonly IMessenger _messenger;
|
||||
|
||||
public App(IMessenger messenger)
|
||||
{
|
||||
InitializeComponent();
|
||||
_messenger = messenger;
|
||||
}
|
||||
|
||||
protected override Window CreateWindow(IActivationState? activationState)
|
||||
{
|
||||
return new Window(new MainPage(_messenger));
|
||||
MainPage = new NavigationPage(new MainPage(messenger));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
15
salesbook.Maui/Core/Services/NavigationService.cs
Normal file
15
salesbook.Maui/Core/Services/NavigationService.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using salesbook.Shared.Core.Interface;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class NavigationService(IServiceProvider serviceProvider) : INavigationService
|
||||
{
|
||||
public async Task NavigateToDetailsAsync()
|
||||
{
|
||||
var detailsPage = serviceProvider.GetService<PersonalInfo>();
|
||||
if (Application.Current.MainPage is NavigationPage nav && detailsPage != null)
|
||||
{
|
||||
await nav.Navigation.PushAsync(detailsPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
salesbook.Maui/Core/Services/PageTitleService.cs
Normal file
18
salesbook.Maui/Core/Services/PageTitleService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using salesbook.Shared.Core.Interface;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class PageTitleService(IDispatcher dispatcher) : IPageTitleService
|
||||
{
|
||||
public void SetTitle(string title)
|
||||
{
|
||||
dispatcher.Dispatch(() =>
|
||||
{
|
||||
if (Application.Current?.MainPage is NavigationPage nav &&
|
||||
nav.CurrentPage is ContentPage cp)
|
||||
{
|
||||
cp.Title = title;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:local="clr-namespace:salesbook.Maui"
|
||||
xmlns:shared="clr-namespace:salesbook.Shared;assembly=salesbook.Shared"
|
||||
x:Class="salesbook.Maui.MainPage"
|
||||
BackgroundColor="{DynamicResource PageBackgroundColor}">
|
||||
|
||||
<BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html">
|
||||
<BlazorWebView HostPage="wwwroot/index.html">
|
||||
<BlazorWebView.RootComponents>
|
||||
<RootComponent Selector="#app" ComponentType="{x:Type shared:Components.Routes}" />
|
||||
</BlazorWebView.RootComponents>
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace salesbook.Maui
|
||||
{
|
||||
InitializeComponent();
|
||||
_messenger = messenger;
|
||||
|
||||
Title = "Home";
|
||||
}
|
||||
|
||||
protected override bool OnBackButtonPressed()
|
||||
|
||||
@@ -13,6 +13,7 @@ using salesbook.Shared.Core.Messages.Activity.Copy;
|
||||
using salesbook.Shared.Core.Messages.Activity.New;
|
||||
using salesbook.Shared.Core.Messages.Back;
|
||||
using salesbook.Shared.Core.Services;
|
||||
using System.Globalization;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
@@ -24,6 +25,9 @@ namespace salesbook.Maui
|
||||
{
|
||||
InteractiveRenderSettings.ConfigureBlazorHybridRenderModes();
|
||||
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("it-IT");
|
||||
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("it-IT");
|
||||
|
||||
var builder = MauiApp.CreateBuilder();
|
||||
builder
|
||||
.UseMauiApp<App>()
|
||||
@@ -61,6 +65,10 @@ namespace salesbook.Maui
|
||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
builder.Services.AddSingleton<LocalDbService>();
|
||||
|
||||
builder.Services.AddSingleton<INavigationService, NavigationService>();
|
||||
builder.Services.AddSingleton<IPageTitleService, PageTitleService>();
|
||||
builder.Services.AddTransient<PersonalInfo>();
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
}
|
||||
|
||||
14
salesbook.Maui/PersonalInfo.xaml
Normal file
14
salesbook.Maui/PersonalInfo.xaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:components="clr-namespace:salesbook.Shared.Components;assembly=salesbook.Shared"
|
||||
x:Class="salesbook.Maui.PersonalInfo"
|
||||
BackgroundColor="{DynamicResource PageBackgroundColor}">
|
||||
|
||||
<BlazorWebView HostPage="wwwroot/index.html" StartPath="/PersonalInfo">
|
||||
<BlazorWebView.RootComponents>
|
||||
<RootComponent Selector="#app" ComponentType="{x:Type components:Routes}" />
|
||||
</BlazorWebView.RootComponents>
|
||||
</BlazorWebView>
|
||||
|
||||
</ContentPage>
|
||||
11
salesbook.Maui/PersonalInfo.xaml.cs
Normal file
11
salesbook.Maui/PersonalInfo.xaml.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace salesbook.Maui;
|
||||
|
||||
public partial class PersonalInfo : ContentPage
|
||||
{
|
||||
public PersonalInfo()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Title = "Profilo";
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
using AndroidX.AppCompat.App;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
@@ -9,5 +10,9 @@ namespace salesbook.Maui
|
||||
ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
|
||||
public class MainActivity : MauiAppCompatActivity
|
||||
{
|
||||
public MainActivity()
|
||||
{
|
||||
AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,5 +35,8 @@
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
|
||||
<key>UIUserInterfaceStyle</key>
|
||||
<string>Light</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -55,8 +55,7 @@
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup
|
||||
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android' AND '$(Configuration)' == 'Debug'">
|
||||
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android' AND '$(Configuration)' == 'Debug'">
|
||||
|
||||
<!--these help speed up android builds-->
|
||||
<!--
|
||||
@@ -66,16 +65,14 @@
|
||||
-->
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup
|
||||
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' AND '$(Configuration)' == 'Debug'">
|
||||
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' AND '$(Configuration)' == 'Debug'">
|
||||
<!--forces the simulator to pickup entitlements-->
|
||||
<EnableCodeSigning>true</EnableCodeSigning>
|
||||
<CodesignRequireProvisioningProfile>true</CodesignRequireProvisioningProfile>
|
||||
<DisableCodesignVerification>true</DisableCodesignVerification>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup
|
||||
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
<SupportedOSPlatformVersion>14.2</SupportedOSPlatformVersion>
|
||||
<DefineConstants>$(DefineConstants);APPLE;PLATFORM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
@@ -85,8 +82,7 @@
|
||||
<CodesignProvision>VS: WildCard Development</CodesignProvision>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup
|
||||
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
<!--
|
||||
<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
|
||||
|
||||
@@ -98,7 +94,7 @@
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
|
||||
<!-- Android App Icon -->
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65"/>
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
|
||||
@@ -137,4 +133,16 @@
|
||||
<ProjectReference Include="..\salesbook.Shared\salesbook.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="PersonalInfo.xaml.cs">
|
||||
<DependentUpon>PersonalInfo.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MauiXaml Update="PersonalInfo.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,4 +1,7 @@
|
||||
@using Microsoft.Maui.Controls
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IJSRuntime JS
|
||||
@inject INavigationService NavigationService
|
||||
|
||||
<div class="@(Back ? "" : "container") header">
|
||||
<div class="header-content @(Back ? "with-back" : "no-back")">
|
||||
@@ -83,7 +86,9 @@
|
||||
await JS.InvokeVoidAsync("goBack");
|
||||
}
|
||||
|
||||
private void OpenPersonalInfo() =>
|
||||
NavigationManager.NavigateTo("/PersonalInfo");
|
||||
private async Task OpenPersonalInfo()
|
||||
{
|
||||
await NavigationService.NavigateToDetailsAsync();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
@using System.Globalization
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Messages.Back
|
||||
@inherits LayoutComponentBase
|
||||
@inject IJSRuntime JS
|
||||
@inject IMessenger Messenger
|
||||
@inject BackNavigationService BackService
|
||||
@inject INavigationService NavigationService
|
||||
|
||||
<MudThemeProvider Theme="_currentTheme" @ref="@_mudThemeProvider" @bind-IsDarkMode="@IsDarkMode" />
|
||||
<MudPopoverProvider/>
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
@page "/Calendar"
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Messages.Activity.New
|
||||
@inject IManageDataService ManageData
|
||||
@inject IJSRuntime JS
|
||||
@inject NewActivityService NewActivity
|
||||
@inject IPageTitleService PageTitleService
|
||||
|
||||
<HeaderLayout Title="@_headerTitle"
|
||||
@* <HeaderLayout Title="@_headerTitle"
|
||||
ShowFilter="true"
|
||||
ShowCalendarToggle="true"
|
||||
OnFilterToggle="ToggleFilter"
|
||||
OnCalendarToggle="ToggleExpanded"/>
|
||||
OnCalendarToggle="ToggleExpanded"/> *@
|
||||
|
||||
<div @ref="_weekSliderRef" class="container week-slider @(Expanded ? "expanded" : "") @(SliderAnimation)">
|
||||
@if (Expanded)
|
||||
@@ -260,6 +259,8 @@
|
||||
private void PrepareHeaderTitle()
|
||||
{
|
||||
_headerTitle = CurrentMonth.ToString("MMMM yyyy", new System.Globalization.CultureInfo("it-IT")).FirstCharToUpper();
|
||||
PageTitleService?.SetTitle(_headerTitle);
|
||||
|
||||
}
|
||||
|
||||
private void PrepareEventsCache()
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
@page "/Notifications"
|
||||
@attribute [Authorize]
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IPageTitleService PageTitleService
|
||||
|
||||
<HeaderLayout Title="Notifiche" />
|
||||
@* <HeaderLayout Title="Notifiche" /> *@
|
||||
|
||||
<div class="container">
|
||||
<NoDataAvailable Text="Nessuna notifica meno recente" />
|
||||
</div>
|
||||
|
||||
@code {
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
PageTitleService?.SetTitle("Notifiche");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
@page "/PersonalInfo"
|
||||
@attribute [Authorize]
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Authorization.Enum
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Services
|
||||
@@ -8,7 +7,7 @@
|
||||
@inject INetworkService NetworkService
|
||||
@inject IFormFactor FormFactor
|
||||
|
||||
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/>
|
||||
@* <HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/> *@
|
||||
|
||||
@if (IsLoggedIn)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@page "/Users"
|
||||
@attribute [Authorize]
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService ManageData
|
||||
@inject IPageTitleService PageTitleService
|
||||
|
||||
<HeaderLayout Title="Contatti"/>
|
||||
@* <HeaderLayout Title="Contatti"/> *@
|
||||
|
||||
<div class="container search-box">
|
||||
<div class="input-card clearButton">
|
||||
@@ -36,6 +36,11 @@
|
||||
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
|
||||
private string? TextToFilter { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
PageTitleService?.SetTitle("Contatti");
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
|
||||
6
salesbook.Shared/Core/Interface/INavigationService.cs
Normal file
6
salesbook.Shared/Core/Interface/INavigationService.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace salesbook.Shared.Core.Interface;
|
||||
|
||||
public interface INavigationService
|
||||
{
|
||||
Task NavigateToDetailsAsync();
|
||||
}
|
||||
6
salesbook.Shared/Core/Interface/IPageTitleService.cs
Normal file
6
salesbook.Shared/Core/Interface/IPageTitleService.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace salesbook.Shared.Core.Interface;
|
||||
|
||||
public interface IPageTitleService
|
||||
{
|
||||
void SetTitle(string title);
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="IntegryApiClient.Core" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Core" Version="9.0.70" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.11.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.5" />
|
||||
|
||||
Reference in New Issue
Block a user