FireSharp icon indicating copy to clipboard operation
FireSharp copied to clipboard

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

Open Fabricciotcortes opened this issue 7 years ago • 0 comments

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<Dinosaur> group= new List<Dinosaur>(); var firebase = new FirebaseClient("https://dinosaur-facts.firebaseio.com/"); var observable = firebase .Child("dinosaurs") .AsObservable<Dinosaur>() .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.

Fabricciotcortes avatar Aug 12 '18 05:08 Fabricciotcortes