bugthesystem / FireSharp

An asynchronous cross-platform .Net library for Firebase
The Unlicense
690 stars 146 forks source link

C# FirebaseDataBase API - Real Time Get Data into a List #125

Open Fabricciotcortes opened 5 years ago

Fabricciotcortes commented 5 years ago

1 down vote favorite 1 I´m new in this topic about Firebase in C#, the online documetation is bad, I only find 2 (FireSharp and FireBaseDataBase) API for connect my Desktop App with Firebase and also I try to connect my app with JSON HttpRequest. In all the case when i try to PUT, UPDATE, DELETE, the response time delay 4 seconds and i´m sure that my internet have a good Connection. On the other hand and as a main question (using the API FirebaseDataBase for C# WPF) is why i can´t put the real time data in a List(). First I try to do this.

//Example//` public void StreamData() { List group= new List(); var firebase = new FirebaseClient("https://dinosaur-facts.firebaseio.com/"); var observable = firebase .Child("dinosaurs") .AsObservable() .Subscribe(d => group.Add(d.Object)); } But the problem here is that "group" dont Add "d.Object". Then I try to use this code:

public void StreamData() {

    var observable = firebaseClient.Child("Information").AsObservable<Persona>();
    var t=  observable.ObserveOnDispatcher().AsObservableCollection();
}

But I have this problem :

System.InvalidOperationException: 'The current thread has no Dispatcher associated with it.'

In summary i try to get a real time data from Firebase with the API FireBaseDataBase, as a List() because i want to insert in my Datagrid.