add account
This commit is contained in:
@ -9,7 +9,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(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 MemoProperty = BindableProperty.Create(nameof(Memo), typeof(string), typeof(AddAccountPage));
|
||||
|
||||
@ -23,9 +23,9 @@ namespace Billing.Views
|
||||
get => (string)GetValue(AccountIconProperty);
|
||||
set => SetValue(AccountIconProperty, value);
|
||||
}
|
||||
public string Category
|
||||
public AccountCategory Category
|
||||
{
|
||||
get => (string)GetValue(CategoryProperty);
|
||||
get => (AccountCategory)GetValue(CategoryProperty);
|
||||
set => SetValue(CategoryProperty, value);
|
||||
}
|
||||
public decimal Balance
|
||||
@ -52,6 +52,8 @@ namespace Billing.Views
|
||||
CheckAccount = new Command(OnCheckAccount);
|
||||
SelectIcon = new Command(OnSelectIcon);
|
||||
SelectCategory = new Command(OnSelectCategory);
|
||||
AccountIcon = BaseModel.ICON_DEFAULT;
|
||||
Category = AccountCategory.Cash;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@ -60,27 +62,35 @@ namespace Billing.Views
|
||||
this.account = account;
|
||||
AccountName = account.Name;
|
||||
AccountIcon = account.Icon;
|
||||
Category = account.Category.ToString();
|
||||
Category = account.Category;
|
||||
Balance = account.Balance;
|
||||
Memo = account.Memo;
|
||||
CheckAccount = new Command(OnCheckAccount);
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnCheckAccount()
|
||||
private async void OnCheckAccount()
|
||||
{
|
||||
AccountChecked?.Invoke(this, new AccountEventArgs
|
||||
if (Tap.IsBusy)
|
||||
{
|
||||
Account = new Account
|
||||
return;
|
||||
}
|
||||
using (Tap.Start())
|
||||
{
|
||||
await Navigation.PopAsync();
|
||||
AccountChecked?.Invoke(this, new AccountEventArgs
|
||||
{
|
||||
Id = account?.Id ?? -1,
|
||||
Name = AccountName,
|
||||
Icon = AccountIcon,
|
||||
//Category = Category,
|
||||
Balance = Balance,
|
||||
Memo = Memo
|
||||
}
|
||||
});
|
||||
Account = new Account
|
||||
{
|
||||
Id = account?.Id ?? -1,
|
||||
Name = AccountName,
|
||||
Icon = AccountIcon,
|
||||
Category = Category,
|
||||
Balance = Balance,
|
||||
Memo = Memo
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSelectIcon()
|
||||
|
Reference in New Issue
Block a user