Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single proj Migration: Maui community toolkit app #749

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: clean up
  • Loading branch information
Kunal22shah committed Jun 7, 2024
commit 6d36cd428943b1fb78e808ea0f4559bdb5daf249
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public App()
protected Window? MainWindow { get; private set; }
protected IHost? Host { get; private set; }

protected async override void OnLaunched(LaunchActivatedEventArgs args)
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
var builder = this.CreateBuilder(args)
// Add navigation support for toolkit controls such as TabBar and NavigationView
Expand Down Expand Up @@ -70,15 +70,14 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args)
// Register Json serializers (ISerializer and ISerializer)
.UseSerialization((context, services) => services
.AddContentSerializer(context)
.AddJsonTypeInfo(WeatherForecastContext.Default.IImmutableListWeatherForecast))
)
.UseHttp((context, services) => services
// Register HttpClient
#if DEBUG
// DelegatingHandler will be automatically injected into Refit Client
.AddTransient<DelegatingHandler, DebugHttpHandler>()
#endif
.AddSingleton<IWeatherCache, WeatherCache>()
.AddRefitClient<IApiClient>(context))
)
.ConfigureServices((context, services) =>
{
// TODO: Register your services
Expand All @@ -100,16 +99,14 @@ private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
{
views.Register(
new ViewMap(ViewModel: typeof(ShellModel)),
new ViewMap<MainPage, MainModel>(),
new DataViewMap<SecondPage, SecondModel, Entity>()
new ViewMap<MainPage, MainModel>()
);

routes.Register(
new RouteMap("", View: views.FindByViewModel<ShellModel>(),
Nested:
[
new ("Main", View: views.FindByViewModel<MainModel>()),
new ("Second", View: views.FindByViewModel<SecondModel>()),
]
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
global using Microsoft.Extensions.Options;
global using MauiCommunityToolkitApp.Models;
global using MauiCommunityToolkitApp.Presentation;
global using MauiCommunityToolkitApp.DataContracts;
global using MauiCommunityToolkitApp.DataContracts.Serialization;
global using MauiCommunityToolkitApp.Services.Caching;
global using MauiCommunityToolkitApp.Services.Endpoints;
#if MAUI_EMBEDDING
global using MauiCommunityToolkitApp.MauiControls;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui"/>
<PackageReference Include="CommunityToolkit.Maui" />
<PackageReference Include="CommunityToolkit.Mvvm" />
<PackageReference Include="Microsoft.Maui.Controls" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,4 @@ public MainModel(
public async Task Counter(CancellationToken ct) =>
await Count.Update(x => ++x, ct);

public async Task GoToSecond()
{
var name = await Name;
await _navigator.NavigateViewModelAsync<SecondModel>(this, data: new Entity(name!));
}

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading