public FirestoreService()
        {
            cards = new List <Card>();
            Firestore dbRef = Firestore.Create(Firebase.Core.App.DefaultInstance);

            dbRef.GetCollection("cards").GetDocuments((snap, err) =>
            {
                if (err != null)
                {
                    Debug.WriteLine(err);
                }
                else
                {
                    DocumentSnapshot[] docs = snap.Documents;
                    foreach (DocumentSnapshot doc in docs)
                    {
                        if (doc.Exists)
                        {
                            var data = (CardObj)doc.Data;
                            if (data != null)
                            {
                                cards.Add(data);
                            }
                            else
                            {
                                Card errorCard = new Card
                                {
                                    Text    = doc.Id,
                                    Subtext = doc.Reference.ToString(),
                                    Type    = "error"
                                };
                                cards.Add(errorCard);
                            }
                        }
                    }
                }
            });
        }
示例#2
0
        public static void GetCalibrationData(string deviceModel, DocumentSnapshotHandler completion)
        {
            var docRef = db.GetCollection(Collections.CalibrationData).GetDocument(deviceModel);

            docRef.GetDocument(completion);
        }