complete account page

This commit is contained in:
2022-03-02 17:31:49 +08:00
parent aa38e186c7
commit 51f8e4f2e8
26 changed files with 547 additions and 76 deletions

View File

@ -12,7 +12,7 @@ namespace Billing.Views
private static readonly BindableProperty AccountNameProperty = BindableProperty.Create(nameof(AccountName), typeof(string), typeof(AddAccountPage));
private static readonly BindableProperty AccountIconProperty = BindableProperty.Create(nameof(AccountIcon), typeof(string), typeof(AddAccountPage));
private static readonly BindableProperty CategoryProperty = BindableProperty.Create(nameof(Category), typeof(AccountCategory), typeof(AddAccountPage));
private static readonly BindableProperty BalanceProperty = BindableProperty.Create(nameof(Balance), typeof(decimal), typeof(AddAccountPage));
private static readonly BindableProperty InitialProperty = BindableProperty.Create(nameof(Initial), typeof(string), typeof(AddAccountPage));
private static readonly BindableProperty MemoProperty = BindableProperty.Create(nameof(Memo), typeof(string), typeof(AddAccountPage));
public string AccountName
@ -30,10 +30,10 @@ namespace Billing.Views
get => (AccountCategory)GetValue(CategoryProperty);
set => SetValue(CategoryProperty, value);
}
public decimal Balance
public string Initial
{
get => (decimal)GetValue(BalanceProperty);
set => SetValue(BalanceProperty, value);
get => (string)GetValue(InitialProperty);
set => SetValue(InitialProperty, value);
}
public string Memo
{
@ -54,6 +54,7 @@ namespace Billing.Views
CheckAccount = new Command(OnCheckAccount);
SelectIcon = new Command(OnSelectIcon);
SelectCategory = new Command(OnSelectCategory);
AccountIcon = BaseModel.ICON_DEFAULT;
Category = AccountCategory.Cash;
InitializeComponent();
@ -61,13 +62,16 @@ namespace Billing.Views
public AddAccountPage(Account account)
{
CheckAccount = new Command(OnCheckAccount);
SelectIcon = new Command(OnSelectIcon);
SelectCategory = new Command(OnSelectCategory);
this.account = account;
AccountName = account.Name;
AccountIcon = account.Icon;
Category = account.Category;
Balance = account.Balance;
Initial = account.Initial.ToString();
Memo = account.Memo;
CheckAccount = new Command(OnCheckAccount);
InitializeComponent();
}
@ -80,6 +84,7 @@ namespace Billing.Views
using (Tap.Start())
{
await Navigation.PopAsync();
_ = decimal.TryParse(Initial, out decimal initial);
AccountChecked?.Invoke(this, new AccountEventArgs
{
Account = new Account
@ -88,7 +93,8 @@ namespace Billing.Views
Name = AccountName,
Icon = AccountIcon,
Category = Category,
Balance = Balance,
Initial = initial,
Balance = initial,
Memo = Memo
}
});