예제 #1
0
        public void GetMessage()
        {
            var userId = authService.GetUserId();

            databaseReference = database.GetReference("messages/" + userId);
            databaseReference.AddValueEventListener(new ValueEventListener());
        }
예제 #2
0
        public void GetMessage()
        {
            var userId   = authService.GetUserId();
            var messages = databaseReference.GetChild("items").GetChild(userId);

            nuint handleReference2 = messages.ObserveEvent(DataEventType.Value, (snapshot) =>
            {
                //var folderData = snapshot.GetValue<NSDictionary>();
                // Do magic with the folder data
                NSObject value = snapshot.GetValue();
                ObservableCollection <Homework> list = new ObservableCollection <Homework>();
                if (value is NSDictionary folderData)
                {
                    foreach (var item in folderData)
                    {
                        list.Add(new Homework
                        {
                            Key      = item.Key.ToString(),
                            HomeWork = item.Value.ToString()
                        });
                    }
                }
                MessagingCenter.Send(FirebaseDBService.KEY_MESSAGE, FirebaseDBService.KEY_MESSAGE, list);
            });
        }
예제 #3
0
 public void GetMessage()
 {
     var   userId          = authService.GetUserId();
     var   messages        = databaseReference.GetChild("messages").GetChild(userId);
     nuint handleReference = messages.ObserveEvent(DataEventType.Value, (snapshot) => {
         //var folderData = snapshot.GetValue<NSDictionary>();
         // Do magic with the folder data
         String message = "";
         if (snapshot.GetValue() != NSNull.Null)
         {
             message = snapshot.GetValue().ToString();
         }
         MessagingCenter.Send(FirebaseDBService.KEY_MESSAGE, FirebaseDBService.KEY_MESSAGE, message);
     });
 }