public List <T> GetPageData(JumpOperation mode) { switch (mode) { case JumpOperation.GoHome: CurrentIndex_ = 1; break; case JumpOperation.GoPrePrevious: if (CurrentIndex_ > 1) { CurrentIndex_ -= 1; } break; case JumpOperation.GoNext: if (CurrentIndex_ < PageCount_) { CurrentIndex_ += 1; } break; case JumpOperation.GoEnd: CurrentIndex_ = PageCount_; break; } List <T> listPageData = new List <T>(); try { int pageCountTo = PageSize_; if (PageCount_ == CurrentIndex_ && DataSource_.Count % PageSize_ > 0) { pageCountTo = DataSource_.Count % PageSize_; } if (null != DataSource_) { for (int i = 0; i < pageCountTo; i++) { if ((CurrentIndex_ - 1) * PageSize_ + i < DataSource_.Count) { listPageData.Add(DataSource_[(CurrentIndex_ - 1) * PageSize_ + i]); } else { break; } } } return(listPageData); } catch { return(listPageData); } }
public List <T> GetPageData(JumpOperation jo) { switch (jo) { case JumpOperation.GoHome: currentIndex = 1; break; case JumpOperation.GoPrePrevious: if (currentIndex > 1) { currentIndex -= 1; } break; case JumpOperation.GoNext: if (currentIndex < pagecount) { currentIndex += 1; } break; case JumpOperation.GoEnd: currentIndex = pagecount; break; } List <T> listPageData = new List <T>(); try { int pageCountTo = pageSize; if (pagecount == currentIndex && dataSource.Count % pageSize > 0) { pageCountTo = dataSource.Count % pageSize; } if (null != dataSource) { for (int i = 0; i < pageCountTo; i++) { if ((currentIndex - 1) * pageSize + i < dataSource.Count) { listPageData.Add(dataSource[(currentIndex - 1) * pageSize + i]); } else { break; } } } return(listPageData); } catch { return(listPageData); } }
void ITreeWalker.Visit(IfStatement statement) { statement.Validate(this); statement.Condition.Accept(this); _operations.Add(PopIfOperation.Instance); var jumpToElse = InsertMarker(); statement.Primary.Accept(this); var jumpToEnd = InsertMarker(); statement.Secondary.Accept(this); var end = _operations.Count; _operations[jumpToElse] = new JumpOperation(jumpToEnd); _operations[jumpToEnd] = new JumpOperation(end - 1); }
void ITreeWalker.Visit(WhileStatement statement) { statement.Validate(this); var start = _operations.Count; statement.Condition.Accept(this); _operations.Add(PopIfOperation.Instance); var jump = InsertMarker(); _loops.Push(new LoopInfo { Break = jump, Continue = start }); statement.Body.Accept(this); _loops.Pop(); _operations.Add(new JumpOperation(start - 1)); var end = _operations.Count; _operations[jump] = new JumpOperation(end - 1); }
public void GetPageData(JumpOperation jo) { this.PageCount = dataSource.Count / this.pageSize; if (dataSource.Count >= pageSize) { this.PageCount += (dataSource.Count % this.pageSize) != 0 ? 1 : 0; } switch (jo) { case JumpOperation.GoHome: CurrentIndex = 1; break; case JumpOperation.GoPrevious: if (CurrentIndex > 1) { CurrentIndex -= 1; } break; case JumpOperation.GoNext: if (CurrentIndex < PageCount) { CurrentIndex += 1; } break; case JumpOperation.GoEnd: CurrentIndex = PageCount; break; case JumpOperation.Refresh: break; } Paging(); }
public FieldCommand(GameViewModel vm) : base() { this.vm = vm; cloneMove = new CloneMoveOperation(vm.Model); jump = new JumpOperation(vm.Model); }
private void InsertJump(Int32 index, Int32 target) { _operations[index] = new JumpOperation(target - index); }
public GameBase() { cloneMove = new CloneMoveOperation(this); jump = new JumpOperation(this); }