using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MeterVision.model
{
    public class PageModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }


        public int PageSize { get; set; }

        private int _pageCount;
        public int PageCount
        {
            get => _pageCount;
            set
            {
                if(_pageCount != value)
                {
                    _pageCount = value;
                    OnPropertyChanged(nameof(PageCount));
                }
            }          
        }

        private int _pageNumber;
        //从1开始
        public int PageNumber
        {
            get =>_pageNumber;
            set
            {
                if(_pageNumber != value)
                {
                    _pageNumber = value;
                    OnPropertyChanged(nameof(PageNumber));
                }
            }
        }


        public PageModel()
        {
            PageNumber = 1;
            PageCount = 1;
        }

        public void InitDefaulValue(int pageSize)
        {
            PageSize = pageSize;
            PageCount = 1;
            PageNumber = 1;
        }

        public void InitDefaulValue()
        {
            PageCount = 1;
            PageNumber = 1;
        }
        //////////////////////////////////
    }
}
