first step
This commit is contained in:
@ -49,29 +49,27 @@ namespace Billing.Views
|
||||
|
||||
public event EventHandler<AccountEventArgs> AccountChecked;
|
||||
|
||||
public AddAccountPage()
|
||||
{
|
||||
CheckAccount = new Command(OnCheckAccount);
|
||||
SelectIcon = new Command(OnSelectIcon);
|
||||
SelectCategory = new Command(OnSelectCategory);
|
||||
|
||||
AccountIcon = BaseModel.ICON_DEFAULT;
|
||||
Category = AccountCategory.Cash;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public AddAccountPage(Account account)
|
||||
public AddAccountPage(Account account = null)
|
||||
{
|
||||
CheckAccount = new Command(OnCheckAccount);
|
||||
SelectIcon = new Command(OnSelectIcon);
|
||||
SelectCategory = new Command(OnSelectCategory);
|
||||
Title = Resource.EditAccount;
|
||||
|
||||
this.account = account;
|
||||
AccountName = account.Name;
|
||||
AccountIcon = account.Icon;
|
||||
Category = account.Category;
|
||||
Initial = account.Initial.ToString();
|
||||
Memo = account.Memo;
|
||||
if (account == null)
|
||||
{
|
||||
AccountIcon = BaseModel.ICON_DEFAULT;
|
||||
Category = AccountCategory.Cash;
|
||||
}
|
||||
else
|
||||
{
|
||||
AccountName = account.Name;
|
||||
AccountIcon = account.Icon;
|
||||
Category = account.Category;
|
||||
Initial = account.Initial.ToString();
|
||||
Memo = account.Memo;
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@ -83,13 +81,26 @@ namespace Billing.Views
|
||||
}
|
||||
using (Tap.Start())
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(AccountName))
|
||||
{
|
||||
await this.ShowMessage(Resource.AccountRequired);
|
||||
return;
|
||||
}
|
||||
await Navigation.PopAsync();
|
||||
_ = decimal.TryParse(Initial, out decimal initial);
|
||||
if (account != null)
|
||||
{
|
||||
account.Name = AccountName;
|
||||
account.Icon = AccountIcon;
|
||||
account.Category = Category;
|
||||
account.Initial = initial;
|
||||
account.Memo = Memo;
|
||||
}
|
||||
AccountChecked?.Invoke(this, new AccountEventArgs
|
||||
{
|
||||
Account = new Account
|
||||
Account = account ?? new Account
|
||||
{
|
||||
Id = account?.Id ?? -1,
|
||||
Id = -1,
|
||||
Name = AccountName,
|
||||
Icon = AccountIcon,
|
||||
Category = Category,
|
||||
|
Reference in New Issue
Block a user