首页 > 解决方案 > C# Firebase 从数据库中获取时间戳

问题描述

我在 c# 中创建了一个 WPF 表单,它与 firebase 一起工作以发送消息。我想向firebase发送一个时间戳请求,然后得到回复。我已经导入了以下内容。

using Firebase.Storage;
using FireSharp.Config;
using FireSharp.Interfaces;
using FireSharp.Response;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; 

并初始化以下

  static string basePath = Properties.Settings.Default.FirebaseAppUri;
    static string storagePath = Properties.Settings.Default.FirebaseStorage;


    //Setup Firebase path and access rights
    IFirebaseConfig config = new FirebaseConfig
    {
        AuthSecret = Properties.Settings.Default.NormalFireKey,
        BasePath = basePath
    };

    IFirebaseClient client;

我试过下面的代码

   public async void generateTimeStampAsync()
    {
        FirebaseResponse response = await client.GetTaskAsync($"ServerValue/TIMESTAMP");
        Person  person = response.ResultAs<Person>();
        MessageBox.Show(person.ToString());
    }
}

但是程序只是收到一个空值。关于如何在 c# 中为 wpf 应用程序执行此操作的任何建议?

标签: c#wpffirebasetimestamp

解决方案


推荐阅读