internal void imageSucces(object sender, CachedImageEvents.SuccessEventArgs e) { var cachedImage = sender as CachedImage; var data = cachedImage.BindingContext as FirebaseObject <Announcements>; if (e.ImageInformation.CurrentHeight > e.ImageInformation.CurrentWidth) { AnnList.FirstOrDefault(x => x.Key == data.Key).Object.aspect = Aspect.AspectFit; } }
private void newBadgeCount() { //buradaki method listeden son okunana göre notification badge ayarlamak için try { var index = AnnList.ToList().FindIndex(x => x.Key == SaveUserData.userLastRead); if (index == 0) { return; } SaveUserData.userBadge += index; SaveUserData.userLastRead = AnnList.First().Key; SaveBadge(); } catch (Exception ex) { Console.Write("err" + ex.ToString()); } }
//page listeleme async public Task ListViewItem_ApperingCommand(FirebaseObject <Announcements> item) { var itemIndex = AnnList.IndexOf(item); if (AnnList.Count - 1 == itemIndex) { isPageLoading = true; //eğer o anki liste categorik bir arama içinden gelmişse ona göre altına elamanları getirme if (categoryData != null) { await categoryList(AnnList.Count + (int)ListCount.mid); } else { var newData = await getAnnounData(OrderChild.key.ToString(), AnnList.Last().Key, OrderChild.keyAndEndAt, (int)ListCount.mid); foreach (var items in newData) { if (!AnnList.Any(x => x.Key == items.Key)) { AnnList.Add(items); } } } isPageLoading = false; } if (itemIndex >= 4) { upIcon_NavBar(true); } else { upIcon_NavBar(false); } //listede up iconu gösteriken count tercihi }
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; } }
//liste de geçişler sırasındaki sorunu engelleme //bool androidAppering; async public Task OnAppearing() { //toolbar içinde title text yapmak //if (Device.RuntimePlatform == Device.Android) DependencyService.Get<IRemoveIcon>().setTitle("Duyurular"); if (AnnList.Count == 0) { AnnList = await getAnnounData(OrderChild.key.ToString(), "", OrderChild.key, (int)ListCount.mid); //onappering metodu için if (AnnList.Count > 0) { newBadgeCount(); await checkSqliteState(); //userin ilk gördüğ datası (notficationlardan son gelen) SaveUserData.userLastRead = AnnList.First().Key; isVisibleFeedView = true; } else if (AnnList.Count == 0) { isEmptyList = true; } SaveUserData.userBadge = sqliteManager.ItemCount(); SaveBadge(); isPageLoading = false; loadingComplate = true; } else { SaveBadge(); //0 gelme urumundaki patlama sorunu fix } }
//ListView scrool fonksiyon public void scroolListView(ListView listView) { listView.ScrollTo(AnnList.First(), ScrollToPosition.Start, true); upIconVisible = false; }