-
Notifications
You must be signed in to change notification settings - Fork 15
/
MainPage.xaml.cs
27 lines (24 loc) · 1007 Bytes
/
MainPage.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using GridDatafromFireBase.Model;
using Firebase.Database;
using Firebase.Auth;
using System.Reactive.Linq;
namespace GridDatafromFireBase;
public partial class MainPage : ContentPage {
public MainPage() {
InitializeComponent();
LoadDataAsync();
}
async void LoadDataAsync() {
var authProvider = new FirebaseAuthProvider(new FirebaseConfig("AIzaSyAKApodIrO_mQScynAqPZknFnrJUB1IdF8"));
var auth = await authProvider.SignInWithEmailAndPasswordAsync("[email protected]", "12345678");
var firebaseClient = new FirebaseClient("https://maui-data-grid-source-default-rtdb.firebaseio.com",
new FirebaseOptions {
AuthTokenAsyncFactory = () => Task.FromResult(auth.FirebaseToken)
});
datagrid.ItemsSource = firebaseClient
.Child("DataSet/Employees")
.AsObservable<Employee>()
.ObserveOn(System.Threading.SynchronizationContext.Current)
.AsObservableCollection();
}
}