From bc5cf4afa5ffa06af7264b9784ea5e6ccd58fa31 Mon Sep 17 00:00:00 2001 From: gaoyuan Date: Thu, 3 Mar 2022 22:34:18 +0800 Subject: [PATCH] fix issue --- Billing.Shared/Views/AccountPage.xaml | 3 ++- Billing.Shared/Views/AccountPage.xaml.cs | 6 +++--- Billing.Shared/Views/BillPage.xaml | 13 +++++++------ Billing.Shared/Views/BillPage.xaml.cs | 19 ++++++++++++------- Billing.Shared/Views/SettingPage.xaml | 2 +- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Billing.Shared/Views/AccountPage.xaml b/Billing.Shared/Views/AccountPage.xaml index 9e9e1f5..7c7de67 100644 --- a/Billing.Shared/Views/AccountPage.xaml +++ b/Billing.Shared/Views/AccountPage.xaml @@ -43,7 +43,8 @@ Text="{Binding Liability, Converter={StaticResource moneyConverter}}"/> - + diff --git a/Billing.Shared/Views/AccountPage.xaml.cs b/Billing.Shared/Views/AccountPage.xaml.cs index d0f53ef..17e0ec4 100644 --- a/Billing.Shared/Views/AccountPage.xaml.cs +++ b/Billing.Shared/Views/AccountPage.xaml.cs @@ -46,8 +46,8 @@ namespace Billing.Views AddToAccountGroup(account); } } - groupLayout.Refresh(accounts); RefreshBalance(true); + groupLayout.Refresh(accounts); } private void RefreshBalance(bool calc = false) @@ -127,8 +127,8 @@ namespace Billing.Views { accounts.Remove(group); } - groupLayout.Refresh(accounts); RefreshBalance(); + groupLayout.Refresh(accounts); _ = Task.Run(App.WriteAccounts); } @@ -144,8 +144,8 @@ namespace Billing.Views App.Accounts.Add(e.Account); AddToAccountGroup(e.Account); } - groupLayout.Refresh(accounts); RefreshBalance(!add); + groupLayout.Refresh(accounts); Task.Run(App.WriteAccounts); } diff --git a/Billing.Shared/Views/BillPage.xaml b/Billing.Shared/Views/BillPage.xaml index ce6232f..2bf65b6 100644 --- a/Billing.Shared/Views/BillPage.xaml +++ b/Billing.Shared/Views/BillPage.xaml @@ -23,12 +23,13 @@ - + + diff --git a/Billing.Shared/Views/BillPage.xaml.cs b/Billing.Shared/Views/BillPage.xaml.cs index 45125ac..5aaadb2 100644 --- a/Billing.Shared/Views/BillPage.xaml.cs +++ b/Billing.Shared/Views/BillPage.xaml.cs @@ -33,11 +33,13 @@ namespace Billing.Views public decimal Spending => (decimal)GetValue(SpendingProperty); public decimal Balance => (decimal)GetValue(BalanceProperty); + public Command TitleLongPressed { get; } public Command EditBilling { get; } public Command DeleteBilling { get; } public BillPage() { + TitleLongPressed = new Command(OnTitleDateLongPressed); EditBilling = new Command(OnEditBilling); DeleteBilling = new Command(OnDeleteBilling); @@ -50,12 +52,15 @@ namespace Billing.Views { SelectedDate = e.Date; - var bills = App.Bills.Where(b => - b.CreateTime.Year == e.Date.Year && - b.CreateTime.Month == e.Date.Month && - b.CreateTime.Day == e.Date.Day); - Bills = new List(bills.Select(b => WrapBill(b))); - RefreshBalance(Bills); + Task.Run(() => + { + var bills = App.Bills.Where(b => + b.CreateTime.Year == e.Date.Year && + b.CreateTime.Month == e.Date.Month && + b.CreateTime.Day == e.Date.Day); + Bills = new List(bills.Select(b => WrapBill(b))); + RefreshBalance(Bills); + }); } private void RefreshBalance(List bills) @@ -89,7 +94,7 @@ namespace Billing.Views bill.Wallet = App.Accounts.FirstOrDefault(a => a.Id == bill.Bill.WalletId)?.Name; } - private void OnTitleDateLongPressed(object sender, EventArgs e) + private void OnTitleDateLongPressed() { billingDate.SetDateTime(DateTime.Now); } diff --git a/Billing.Shared/Views/SettingPage.xaml b/Billing.Shared/Views/SettingPage.xaml index 7628833..e6a76b0 100644 --- a/Billing.Shared/Views/SettingPage.xaml +++ b/Billing.Shared/Views/SettingPage.xaml @@ -10,7 +10,7 @@ Title="{r:Text Settings}" BindingContext="{x:Reference settingPage}"> - +