How to implement ISupportIncrementalLoading

1 reply. Last post: October 20, 2016 2:45 AM by Yudi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

I wonder how I can implement ISupportRefresh because I followed the documentation (http://developer.intersoftsolutions.com/display/crosslight/Displaying+Data#DisplayingData-ImplementingIncrementalLoading), but could not implement the HasMoreItems and also could not implement the limit data,, someone could help me how I can do this.

Follow my ViewModel and my controller.

my viewmodel

public class PersonListViewModel:ListViewModelBase<Person>, ISupportIncrementalLoading, ISupportRefresh
    {
        private bool _isDataLoading;
        private bool _enableIncrementalLoading;
        private bool _enableIncrementalRefresh;
        private bool _enableRefresh;
        WebApi rest;
       public PersonListViewModel()
        {
            rest = new WebApi();



            this.EnableIncrementalLoading = true;
            this.EnableAsyncFilter = true;
            this.EnableRefresh = true;
            LoadDataIncremental();
        }

        public bool EnableIncrementalLoading
        {
            get
            {
                return _enableIncrementalLoading;
            }

            set
            {
                if (_enableIncrementalLoading != value)
                {
                    _enableIncrementalLoading = value;
                    OnPropertyChanged("EnableIncrementalLoading");

                }
            }
        }



        public bool IsDataLoading
        {
            get
            {
                return _isDataLoading;
            }
            set
            {
                if (_isDataLoading != value)
                {
                    _isDataLoading = value;
                    OnPropertyChanged("IsDataLoading");
                }
            }
        }

        public async void LoadDataIncremental()
        {
            this.IsDataLoading = true;

            this.SourceItems = await rest.GetPersons();

            this.IsDataLoading = false;

        }

        public bool EnableIncrementalRefresh
        {
            get
            {
                return _enableIncrementalRefresh;
            }
            set
            {
                if (_enableIncrementalRefresh != value)
                {
                    _enableIncrementalRefresh = value;
                    OnPropertyChanged("EnableIncrementalRefresh");
                }
            }
        }

        public bool EnableRefresh
        {
            get
            {
                return _enableRefresh;
            }
            set
            {
                if (_enableRefresh != value)
                {
                    _enableRefresh = value;
                    OnPropertyChanged("EnableRefresh");
                }
            }
        }

        public bool HasMoreItems
        {
            get
            {
                throw new NotImplementedException();
            }
        }



        public async void RefreshData()
        {
            this.IsDataLoading = true;
            this.SourceItems = await rest.GetPersons();

            this.IsDataLoading = false;
        }
        protected override void ExecuteRefresh(object parameter)
        {
            base.ExecuteRefresh(parameter);
            this.RefreshData();
        }
    }

 my controller

 public class PersonsController : ApiController
    {
        private DBEntities db = new DBEntities();

        // GET: api/Persons
        public IQueryable<Person> GetPersons()
        {
            return db.Persons.Take(20);
        }
}

 

All times are GMT -5. The time now is 4:46 PM.
Previous Next