我正在开发新应用,并且尝试从类中调用FireBase
我有一个新的Xamarin.Form C#2019,文件夹中的类包含一个项目 enter image description here
这是我单击时的按钮
public async void BtnAdd_Clicked(object sender, EventArgs e)
{
await DbFirebase.AddPerson(Fname.Text,Phone.Text,Email.Text,Password.Text);
Fname.Text = string.Empty;
Phone.Text = string.Empty;
Email.Text = string.Empty;
Password.Text = string.Empty;
await DisplayAlert("Success", "Person Added Successfully", "OK");
var allPersons = await Data.DbFirebase.GetAllPersons();
lstPersons.ItemsSource = allPersons;
}
//这是我在项目数据中称insaide文件夹(数据)的类(DbFirebase.cs)
public async Task AddPerson(string FName, string Phone,string Email, string Password)
{
await client
.Child("Users")
.PostAsync(new Users()
{ FName = FName,
Phone = Phone,
Email =Email,
Password = Password
});
}
我收到错误cs0120(非静态字段xamarin需要对象引用)