【问题标题】:I can't retrieve firebase data using firesharp library in my wpf c# application我无法在我的 wpf c# 应用程序中使用 firesharp 库检索 firebase 数据
【发布时间】:2019-12-08 11:21:14
【问题描述】:

我正在尝试从 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 retrieved");//this message is shown
       }
       else
       {
           MessageBox.Show("could not connect");
       }

       

   }

【问题讨论】:

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


    【解决方案1】:

    FirebaseResponse 响应 = 等待 client.GetAsync("Path"); var data = response.get("路径");

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-05
      相关资源
      最近更新 更多