Beispiel #1
0
 public void AddAccount(AccountCurrency currency, string type, string name)
 {
     if (Data is List <Account> dataList)
     {
         var acc = new Account(currency, type, name);
         dataList.Add(acc);
         AccountAdded?.Invoke(this, new AccountManagerEventArgs(acc, AccountManagerEventType.AccountAdded));
     }
 }
        async void OnSave(object sender, EventArgs e)
        {
            var account = BindingContext as Account;

            if (String.IsNullOrWhiteSpace(account.Name))
            {
                await DisplayAlert("Error", "Please enter name for entry", "OK");

                return;
            }

            //Check if this is a new account or an edit of existing account
            if (account.Status == null)
            {
                AccountAdded?.Invoke(this, account);
            }
            else
            {
                AccountUpdated?.Invoke(this, account);
            }

            await Navigation.PopAsync();
        }