public BindingMapTile(IMapTile tile) { this.tileGrid = new BindingGrid <Bitmap>(tile.TileGrid); this.heightGrid = new BindingGrid <int>(tile.HeightGrid); this.tileGrid.CellsChanged += this.TileGridChanged; this.heightGrid.CellsChanged += this.HeightGridChanged; }
public VoidLayer(UndoableMapModel map) { var grid = new BindingGrid <bool>(map.Voids); this.painter = new VoidPainter(map.Voids, map.BaseTile.HeightGrid, new Size(CellSize, CellSize)); var voidChangeEvents = Observable.FromEventPattern <GridEventArgs>( e => grid.CellsChanged += e, e => grid.CellsChanged -= e) .Select(e => new GridCoordinates(e.EventArgs.X, e.EventArgs.Y)); var heightchangeEvents = Observable.FromEventPattern <GridEventArgs>( e => map.BaseTileHeightChanged += e, e => map.BaseTileHeightChanged -= e) .Select(e => new GridCoordinates(e.EventArgs.X, e.EventArgs.Y)); this.eventSubscription = voidChangeEvents.Merge(heightchangeEvents) .Select(GetCellRectangle) .Subscribe(this.OnLayerChanged); }
/// <summary> /// 根据当前页、显示行数确定显示的表格 /// </summary> private void SetShowingDataTable() { try { if (BindingDataTable.Rows.Count <= RowsCount) { ShowingDataTable = BindingDataTable.Copy(); return; } else { int startRowIndex = (CurrentPage - 1) * RowsCount; int endRoeIndex = startRowIndex + RowsCount; if (endRoeIndex > BindingDataTable.Rows.Count) { endRoeIndex = BindingDataTable.Rows.Count; } ShowingDataTable.Rows.Clear(); DataRow dataRow = null; for (int i = startRowIndex; i < endRoeIndex; i++) { dataRow = ShowingDataTable.NewRow(); dataRow = BindingDataTable.Rows[i]; ShowingDataTable.ImportRow(dataRow); } } } catch (Exception ex) { XtraMessageBox.Show("列表显示失败"); } finally { BindingGrid.DataSource = ShowingDataTable; BindingGrid.RefreshDataSource(); } }
public JsonResult Listar(BindingGrid curso) { return(Json(objCurso.Listar(curso), JsonRequestBehavior.AllowGet)); }