add account

This commit is contained in:
2022-02-26 12:36:32 +08:00
parent fae6d2ce50
commit 4d69bea70b
12 changed files with 192 additions and 23 deletions

View File

@ -1,3 +1,5 @@
using System.Collections.ObjectModel;
using Billing.Models;
using Billing.UI;
using Xamarin.Forms;
@ -8,16 +10,22 @@ namespace Billing.Views
private static readonly BindableProperty BalanceProperty = BindableProperty.Create(nameof(Balance), typeof(decimal), typeof(AccountPage));
private static readonly BindableProperty AssetProperty = BindableProperty.Create(nameof(Asset), typeof(decimal), typeof(AccountPage));
private static readonly BindableProperty LiabilityProperty = BindableProperty.Create(nameof(Liability), typeof(decimal), typeof(AccountPage));
private static readonly BindableProperty AccountsProperty = BindableProperty.Create(nameof(Accounts), typeof(ObservableCollection<Account>), typeof(AccountPage));
public decimal Balance => (decimal)GetValue(BalanceProperty);
public decimal Asset => (decimal)GetValue(AssetProperty);
public decimal Liability => (decimal)GetValue(LiabilityProperty);
public ObservableCollection<Account> Accounts => (ObservableCollection<Account>)GetValue(AccountsProperty);
public Command AddAccount { get; }
private readonly ObservableCollection<Account> accounts;
public AccountPage()
{
AddAccount = new Command(OnAddAccount);
accounts = new ObservableCollection<Account>();
SetValue(AccountsProperty, accounts);
InitializeComponent();
}
@ -39,6 +47,7 @@ namespace Billing.Views
private void AccountChecked(object sender, AccountEventArgs e)
{
Helper.Debug(e.Account.ToString());
accounts.Add(e.Account);
}
}
}