我无法在WPF C#应用程序中使用FireSharp库检索Firebase数据

时间:2019-12-08 11:21:14

标签: c# wpf null data-retrieval fire-sharp

我正在尝试从Firebase检索数据。 但是我要在其中存储数据的对象的所有属性均为空。 请帮助

    using FireSharp.Config;   
    using FireSharp.Interfaces; 
    using FireSharp.Response;


    IFirebaseConfig config = new FirebaseConfig
    {
        AuthSecret= "authsecretexample",
        BasePath= "baspathexample"
    };

    IFirebaseClient client;

'''''从Firebase检索数据的功能'''

    //RETRIEVE DATA FROM FIREBASE 
    private async void Button_Click_1(object sender, RoutedEventArgs e)
   {
       client = new FireSharp.FirebaseClient(config);
       if(client != null)
       {

            //usernameTxt is textbox in xaml            
           FirebaseResponse response = await client.GetTaskAsync("Information/" + usernameTxt.Text)
           Users obj = response.ResultAs<Users>(); //obj is object of user class in which i want to store data




           //all these MessageBoxes are null
           MessageBox.Show(obj.Name);
           MessageBox.Show(obj.Address);
           MessageBox.Show("Data retireved");//this message is shown

       }
       else
       {
           MessageBox.Show("could not connect");
       }



   }

1 个答案:

答案 0 :(得分:-1)

FirebaseResponse响应=等待client.GetAsync(“ Path”); var data = response.get(“ Path”);