private void subscribeFastMenu() { MessagingCenter.Subscribe <DrawerPage, Search>(this, "drawerAnn", async(page, data) => { isEmptyList = false; isVisibleIndicator = true; categoryData = data; try { await categoryList((int)ListCount.mid); } catch (Exception ex) { isVisibleIndicator = false; isEmptyList = true; upIconVisible = false; AnnList.Clear(); Console.WriteLine("err {0}", ex.Message); } }); }
private async Task categoryList(int count) { var tempList = (await App.hardwareService.GET_list <Announcements>("category", categoryData.categoryKey, OrderChild.startAndEndAt, count)).OrderByDescending(x => x.Object.createdDate).ToList(); //servisten yeni data gelmemesi durumundaki aksiyon //if (tempList.Last().Key == AnnList.Last().Key) return; isVisibleIndicator = false; if (tempList.Count == 0) { //eğer arama sonucu data gelmediyse isEmptyList = true; AnnList.Clear(); } else { //gelen data -1 ise aylık bir arama olmaması kontrolü if (categoryData.monthNumbE != -1) { //ocak şubat mart gibi bir arama tempList = tempList.Where(x => x.Object.employeesOfTheMonthDate != null && Convert.ToInt32(x.Object.employeesOfTheMonthDate.Split('/')[0]) == categoryData.monthNumbS + 1).ToList(); if (tempList.Count == 0) { //gelen liste sonucunda o ay yoksa içinde 0 döndür isEmptyList = true; AnnList.Clear(); return; } } var convertList = new ObservableCollection <FirebaseObject <Announcements> >(); foreach (var item in tempList) { convertList.Add(correct_Item(item)); } AnnList = convertList; } }