Beispiel #1
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            var viewmodel = new ContactsViewModel();

            ListView.ItemsSource = viewmodel.EmployeeInfo;
            ListView.ScrollTo(scrollview.ScrollY);
        }
Beispiel #2
0
        private async Task <int> AddLoadMoreProducts(EstateResultDto productResults, SfListView targetListView, ObservableCollection <ProductItemViewModel> targetDataSource)
        {
            TaskCompletionSource <int> taskCompletionSource = new TaskCompletionSource <int>();

            Device.BeginInvokeOnMainThread(() =>
            {
                if (productResults != null && productResults.EstateResults != null)
                {
                    var products = productResults.EstateResults.Select(x => new ProductItemViewModel
                    {
                        Id            = x.Id,
                        ProductName   = x.EstateCode,
                        SalePrice     = x.SalePrice ?? 0,
                        SaleUnitId    = x.SaleUnit != null ? x.SaleUnit.SaleUnitId ?? 0 : 0,
                        SaleUnit      = x.SaleUnit?.Name,
                        RentPrice     = x.RentPrice ?? 0,
                        RentUnitId    = x.RentUnit != null ? x.RentUnit.RentUnitId ?? 0 : 0,
                        RentUnit      = x.RentUnit?.Name,
                        TownId        = x.Town != null ? x.Town.TownId ?? 0 : 0,
                        TownName      = x.Town?.Name,
                        ListingTypeId = x.Estate_TypeId ?? 0,
                        ListingName   = x.NameEstate_Type,
                        HouseNumber   = x.HouseNumber,
                        StaffInfo     = new StaffInfoViewModel
                        {
                            Name   = $"{x.Account?.FirstName} {x.Account?.LastName}",
                            Mobile = x.Account?.Mobile
                        },
                        OwnerInfo = new OwnerInfoViewModel
                        {
                            Name   = x.OwnerName,
                            Mobile = x.Phone
                        },
                        Area        = x.Area,
                        Notes       = x.Note,
                        CreatedDate = x.CreatedDate,
                        UpdatedDate = x.ModifiedDate,
                        IsDeleted   = x.IsDelete ?? false,
                        IsHot       = x.IsHot ?? false,
                        Lat         = x.Lat,
                        Long        = x.Long,
                        MainPinText = x.MainPinText,
                        Address     = x.Address,
                        ImageUrls   = x.ImageUrls,
                        CreatorId   = (int)(x.Account != null ? x.Account.AccountId ?? 0 : 0)
                    });
                    foreach (var item in products)
                    {
                        targetDataSource.Add(item);
                    }
                    var indexTo = targetDataSource.Count - ProductFilters.Instance.PageLimit;
                    targetListView.LayoutManager.ScrollToRowIndex(indexTo, Syncfusion.ListView.XForms.ScrollToPosition.End, true);
                    targetListView.ScrollTo(indexTo, Syncfusion.ListView.XForms.ScrollToPosition.End, true);
                    taskCompletionSource.SetResult(1);
                }
                else
                {
                    taskCompletionSource.SetResult(0);
                }
                UpdateCanLoadMore(productResults);
            });
            return(await taskCompletionSource.Task);
        }