From e32c19de144d798365ec67ec25c828e15571e258 Mon Sep 17 00:00:00 2001 From: Adolfo Marinucci Date: Mon, 23 Dec 2024 18:25:45 +0100 Subject: [PATCH] 3.0.12-beta - AOT compliance --- .github/workflows/build-deploy-beta.yml | 2 +- .../Components/Main/CategoryChart.cs | 2 +- .../Components/Main/MainPage.cs | 26 +++++++++++++------ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-deploy-beta.yml b/.github/workflows/build-deploy-beta.yml index bd39cbf..163abba 100644 --- a/.github/workflows/build-deploy-beta.yml +++ b/.github/workflows/build-deploy-beta.yml @@ -16,7 +16,7 @@ jobs: Solution_Name: ./src/MauiReactor.Build.sln Test_Project: ./samples/UnitTests/UnitTests.csproj TemplatePack_Name: ./src/MauiReactor.TemplatePack/MauiReactor.TemplatePack.csproj - Version: 3.0.11-beta + Version: 3.0.12-beta steps: - name: Checkout diff --git a/templates/MauiReactorTemplate.StartupSampleXaml/Components/Main/CategoryChart.cs b/templates/MauiReactorTemplate.StartupSampleXaml/Components/Main/CategoryChart.cs index 3bfcb93..f74c2fb 100644 --- a/templates/MauiReactorTemplate.StartupSampleXaml/Components/Main/CategoryChart.cs +++ b/templates/MauiReactorTemplate.StartupSampleXaml/Components/Main/CategoryChart.cs @@ -37,10 +37,10 @@ public override VisualNode Render() //Series new RadialBarSeries() - .ItemsSource(_todoCategoryData) .PaletteBrushes(_todoCategoryColors ?? []) .XBindingPath("Title") .YBindingPath("Count") + .ItemsSource(_todoCategoryData) .ShowDataLabels(true) .EnableTooltip(true) .TrackFill(Theme.IsLightTheme ? diff --git a/templates/MauiReactorTemplate.StartupSampleXaml/Components/Main/MainPage.cs b/templates/MauiReactorTemplate.StartupSampleXaml/Components/Main/MainPage.cs index 30aed74..f41c026 100644 --- a/templates/MauiReactorTemplate.StartupSampleXaml/Components/Main/MainPage.cs +++ b/templates/MauiReactorTemplate.StartupSampleXaml/Components/Main/MainPage.cs @@ -52,7 +52,7 @@ public override VisualNode Render() new SfPullToRefresh( RenderBody() ) - .IsRefreshing(() => State.IsRefreshing) + .IsRefreshing(State.IsRefreshing) .OnRefreshing(Refresh), Button() @@ -61,9 +61,9 @@ public override VisualNode Render() .OnClicked(AddTask) ) ) - .OnNavigatedTo(() => State.IsNavigatingTo = true) + .OnNavigatedTo(() => State.IsNavigatingTo = true) .OnNavigatedFrom(() => State.IsNavigatingTo = false) - .OnAppearing(LoadOrRefreshData); + .OnAppearing(LoadOrRefreshData); } VisualNode RenderBody() @@ -149,7 +149,7 @@ async Task LoadData() { SetState(s => s.IsBusy = true); - State.Projects = await _projectRepository.ListAsync(); + var projects = await _projectRepository.ListAsync(); var chartData = new List(); var chartColors = new List(); @@ -159,16 +159,24 @@ async Task LoadData() { chartColors.Add(category.ColorBrush); - var ps = State.Projects.Where(p => p.CategoryID == category.ID).ToList(); + var ps = projects.Where(p => p.CategoryID == category.ID).ToList(); int tasksCount = ps.SelectMany(p => p.Tasks).Count(); chartData.Add(new(category.Title, tasksCount)); } - State.TodoCategoryData = chartData; - State.TodoCategoryColors = chartColors; + var todoCategoryData = chartData; + var todoCategoryColors = chartColors; - State.Tasks = await _taskRepository.ListAsync(); + var tasks = await _taskRepository.ListAsync(); + + SetState(s => + { + s.Projects = projects; + s.TodoCategoryData = chartData; + s.TodoCategoryColors = chartColors; + s.Tasks = tasks; + }); } finally { @@ -182,6 +190,8 @@ async Task Refresh() { SetState(s => s.IsRefreshing = true); + await Task.Delay(100); + await LoadData(); } catch (Exception e)