fix issue

This commit is contained in:
gaoyuan
2022-03-03 22:34:18 +08:00
parent 526da1ede8
commit bc5cf4afa5
5 changed files with 25 additions and 18 deletions

View File

@ -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<UIBill>(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<UIBill>(bills.Select(b => WrapBill(b)));
RefreshBalance(Bills);
});
}
private void RefreshBalance(List<UIBill> 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);
}