fix issue

This commit is contained in:
2022-03-15 20:12:40 +08:00
parent 5b209cc19c
commit 8ba6f4bf85
8 changed files with 70 additions and 13 deletions

View File

@ -50,6 +50,17 @@ namespace Billing.Views
groupLayout.Refresh(accounts);
}
protected override void OnRefresh()
{
accounts.Clear();
foreach (var account in App.Accounts)
{
AddToAccountGroup(account);
}
RefreshBalance(true);
groupLayout.Refresh(accounts);
}
private void RefreshBalance(bool calc = false)
{
if (calc)

View File

@ -60,19 +60,23 @@ namespace Billing.Views
billingDate.SetDateTime(DateTime.Today);
}
private void OnDateSelected(object sender, DateEventArgs e)
protected override void OnRefresh()
{
SelectedDate = e.Date;
Task.Run(() =>
{
var bills = App.Bills.Where(b => Helper.IsSameDay(b.CreateTime, e.Date));
var bills = App.Bills.Where(b => Helper.IsSameDay(b.CreateTime, SelectedDate));
Bills = new List<UIBill>(bills.OrderBy(b => b.CreateTime).Select(b => Helper.WrapBill(b)));
RefreshBalance(Bills);
MainThread.BeginInvokeOnMainThread(async () => await scrollView.ScrollToAsync(0, 0, true));
});
}
private void OnDateSelected(object sender, DateEventArgs e)
{
SelectedDate = e.Date;
OnRefresh();
}
private void RefreshBalance(List<UIBill> bills)
{
SetValue(NoBillsProperty, bills.Count == 0);

View File

@ -229,6 +229,11 @@ namespace Billing.Views
}
}
protected override void OnRefresh()
{
OnDateChanged(this);
}
private void OnDateTypeCommand(DateType index)
{
if (index < DateType.Monthly || index > DateType.Total)

View File

@ -59,6 +59,12 @@ namespace Billing.Views
//Light.Instance.RefreshColor(Color.FromHex(color));
}
protected override async void OnRefresh()
{
var count = await StoreHelper.GetLogsCount();
SetValue(ManyRecordsProperty, string.Format(Resource.ManyRecords, count));
}
private async void OnShareCommand()
{
if (Tap.IsBusy)