From 9f783c1b5ff6cce19b686611f2c6a89723fdd2c5 Mon Sep 17 00:00:00 2001 From: Tsanie Lily Date: Mon, 7 Mar 2022 17:36:03 +0800 Subject: [PATCH] tiny fix --- .../Views/CategorySelectPage.xaml.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Billing.Shared/Views/CategorySelectPage.xaml.cs b/Billing.Shared/Views/CategorySelectPage.xaml.cs index 0b93b4d..ba5623f 100644 --- a/Billing.Shared/Views/CategorySelectPage.xaml.cs +++ b/Billing.Shared/Views/CategorySelectPage.xaml.cs @@ -60,7 +60,7 @@ namespace Billing.Views { cat = TopCategories.SelectMany(g => g).FirstOrDefault(c => c.Category.Id == category.ParentId); } - OnTopCategoryTapped(cat); + DoRefreshSubCategories(cat); InitializeComponent(); } @@ -76,6 +76,16 @@ namespace Billing.Views }; } + private void DoRefreshSubCategories(UICategory category) + { + var many = TopCategories.SelectMany(g => g); + foreach (var m in many) + { + m.IsChecked = m == category; + } + SubCategories = App.Categories.Where(c => c.ParentId == category.Category.Id).Select(c => WrapCategory(c)).ToList(); + } + private async void OnTopCategoryTapped(object o) { if (Tap.IsBusy) @@ -86,12 +96,7 @@ namespace Billing.Views { if (o is UICategory category) { - var many = TopCategories.SelectMany(g => g); - foreach (var m in many) - { - m.IsChecked = m == category; - } - SubCategories = App.Categories.Where(c => c.ParentId == category.Category.Id).Select(c => WrapCategory(c)).ToList(); + DoRefreshSubCategories(category); if (SubCategories.Count == 0) { CategoryTapped?.Invoke(this, category);