Exemple #1
0
 private IReadOnlyCollection <FirebaseObject <ReplayMeta> > GetAllMeta()
 {
     return(metas
            .OnceAsync <ReplayMeta>()
            .ConfigureAwait(false).GetAwaiter()
            .GetResult());
 }
        public async Task <bool> UpdateItemAsync(EntryData updatedata)
        {
            try
            {
                var toUpdatePerson = (await _query
                                      .OnceAsync <Item>()).Where(a => (a.Key == updatedata.EntryId)).FirstOrDefault();

                await _query
                .Child(updatedata.EntryId)
                .PutAsync(updatedata.EntryItem);
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(true);
        }
Exemple #3
0
 /// <inheritdoc/>
 public IObservable <IEnumerable <T> > GetItems(bool fetchOnline = false)
 {
     return(_childQuery
            .OnceAsync <T>()
            .ToObservable()
            .SelectMany(x => x)
            .Do(MapKeyToId)
            .Select(x => x.Object)
            .ToList());
 }
        public async Task <IEnumerable <T> > GetItemsAsync(bool forceRefresh = false)
        {
            try
            {
                var firebaseObjects = await _query
                                      .OnceAsync <T>();

                return(firebaseObjects
                       .Select(x => x.Object));
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Exemple #5
0
        public async Task <List <T> > GetItemsAsync(bool forceRefresh = false)
        {
            var firebaseObjects = await _query
                                  .OnceAsync <T>();

            return(firebaseObjects
                   .Select(x =>
            {
                var item = x.Object;

                item.Id = x.Key;
                item.OwnerId = uid;

                return item;
            }).ToList());
        }
Exemple #6
0
        public async Task <IEnumerable <Users> > GetUsersAsync(bool forceRefresh = false)
        {
            try
            {
                var firebaseObjects = await _query.OnceAsync <Users>();

                return(firebaseObjects.Select(x => new Users
                {
                    Id = x.Key,
                    Username = x.Object.Username,
                    Password = x.Object.Password
                }));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                return(null);
            }
        }
        public static async Task Read()
        {
            AppData.onlineLists = new List <GroceryListClass>();

            if (AppData.auth.CurrentUser == null)
            {
                return;
            }


            ChildQuery listsNode = AppData.dataNode.Child(AppData.currentUser.Uid);

            var allListsData = await listsNode.OnceAsync <TempGroceryListClass>();

            foreach (FirebaseObject <TempGroceryListClass> any in allListsData)
            {
                List <ItemClass> itemsOfList = new List <ItemClass>();

                ChildQuery thisListNode = listsNode.Child(any.Object.Name);

                var readItems = await thisListNode.Child("Items").OnceAsync <ItemClass>();

                foreach (FirebaseObject <ItemClass> anyItem in readItems)
                {
                    itemsOfList.Add(anyItem.Object);
                }

                GroceryListClass thisList = new GroceryListClass
                {
                    Name  = any.Object.Name,
                    Items = itemsOfList,
                    Owner = any.Object.Owner
                };

                AppData.onlineLists.Add(thisList);
            }
        }