public void Reload() { #if DEBUG if (IsBreakingOnQuery) { //breaking on query if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debugger.Break(); } else { System.Diagnostics.Debugger.Launch(); } } #endif using (new MethodTracer <PagedQueryable <T> >("Reload")) { if (_isFreezed) { Tracer.Verbose(() => "PagedQueryable is freezed"); return; } Tracer.Verbose(() => "clear Items"); Items.Clear(); int totalPages; int queryCount; Tracer.Verbose(() => "getting paged items"); List <T> items = _query.ApplyFilter(Filter).ApplyOrder(SortColumn, SortDirection).ApplyPaging( CurrentPage, PageSize, out totalPages, out queryCount).ToList(); Items.AddRange(items); Tracer.Verbose(() => "setting PageCount"); PageCount = totalPages; Tracer.Verbose(() => "maximize current page"); CurrentPage = Math.Min(CurrentPage, PageCount); Tracer.Verbose(() => "setting QueryCount"); QueryCount = queryCount; Tracer.Verbose(() => "raising navigation properties changed event"); OnPropertyChanged("CanMoveFirst"); OnPropertyChanged("CanMoveLast"); OnPropertyChanged("CanMoveNext"); OnPropertyChanged("CanMovePrevious"); OnReloaded(); } }
public void Reload() { using (new MethodTracer <PagedQueryable <T> >("Reload")) { if (_isFreezed) { Tracer.Verbose(() => "PagedQueryable is freezed"); return; } Tracer.Verbose(() => "clear Items"); Items.Clear(); int totalPages; int queryCount; Tracer.Verbose(() => "getting paged items"); List <T> items = _query.ApplyFilter(Filter).ApplyOrder(SortColumn, SortDirection).ApplyPaging( CurrentPage, PageSize, out totalPages, out queryCount).ToList(); Items.AddRange(items); Tracer.Verbose(() => "setting PageCount"); PageCount = totalPages; Tracer.Verbose(() => "maximize current page"); CurrentPage = Math.Min(CurrentPage, PageCount); Tracer.Verbose(() => "setting QueryCount"); QueryCount = queryCount; Tracer.Verbose(() => "raising navigation properties changed event"); OnPropertyChanged("CanMoveFirst"); OnPropertyChanged("CanMoveLast"); OnPropertyChanged("CanMoveNext"); OnPropertyChanged("CanMovePrevious"); OnReloaded(); } }