コード例 #1
0
 /// <summary>
 /// Call this protected .ctor to indicate that the subclass implements IVirtualListLoader<T>
 /// </summary>
 protected VirtualList()
     : this(null)
 {
     if (!(this is IVirtualListLoader <T>))
     {
         throw new InvalidCastException(string.Format("This class of type `{0}` must implement IVirtualListLoader<T> to use this .ctor", GetType().Name));
     }
     _loader = (IVirtualListLoader <T>) this;
 }
コード例 #2
0
        public VirtualList(IVirtualListLoader <T> loader, int pageSize, SynchronizationContext synchronizationContext)
        {
            if (loader == null)
            {
                throw new ArgumentNullException("loader");
            }
            if (pageSize <= 0)
            {
                throw new ArgumentOutOfRangeException("pageSize");
            }

            _synchronizationContext     = synchronizationContext;
            _pageRequests               = new QueuedBackgroundWorker <int>(LoadPage, synchronizationContext);
            _pageRequests.StateChanged += new EventHandler(OnPageRequestsStateChanged);

            _version++;
            _loader   = loader;
            _pageSize = pageSize;
            LoadAsync(0);
        }
コード例 #3
0
        public VirtualList(IVirtualListLoader <T> loader, int pageSize, SynchronizationContext synchronizationContext)
        {
            //EventMessageBus.Current.GetEvent<EntityRangeLoaded<T>>(Source)
            //    .Subscribe(x => handleRangeLoaded(x.Entities,x.StartIndex, x.OverAllCount, x.Process as ISystemProcess));

            if (loader == null)
            {
                throw new ArgumentNullException("loader");
            }
            if (pageSize <= 0)
            {
                throw new ArgumentOutOfRangeException("pageSize");
            }

            _synchronizationContext     = synchronizationContext;
            _pageRequests               = new QueuedBackgroundWorker <int>(LoadPage, synchronizationContext);
            _pageRequests.StateChanged += new EventHandler(OnPageRequestsStateChanged);


            _version++;
            _loader   = loader;
            _pageSize = pageSize;
            LoadAsync(0);
        }
コード例 #4
0
 public VirtualList(IVirtualListLoader <T> loader, SynchronizationContext synchronizationContext)
     : this(loader, DefaultPageSize, synchronizationContext)
 {
 }
コード例 #5
0
 public VirtualList(IVirtualListLoader <T> loader)
     : this(loader, DefaultPageSize, SynchronizationContext.Current)
 {
 }