public void FormatCell(ICellHandler cell, sw.FrameworkElement element, swc.DataGridCell gridcell, object dataItem) { if (GridHandler != null) { GridHandler.FormatCell(this, cell, element, gridcell, dataItem); } }
private void RunRow(Parse row) { Parse cell = row.Parts; //first set input params for (int col = 0; col < columnAccessors.Length; col++) { Accessor accessor = columnAccessors[col]; ICellHandler cellHandler = CellOperation.GetHandler(this, cell, accessor.ParameterType); if (!isOutputColumn[col]) { cellHandler.HandleInput(this, cell, accessor); } cell = cell.More; } command.ExecuteNonQuery(); cell = row.Parts; //next evaluate output params for (int col = 0; col < columnAccessors.Length; col++) { Accessor accessor = columnAccessors[col]; ICellHandler cellHandler = CellOperation.GetHandler(this, cell, accessor.ParameterType); if (isOutputColumn[col]) { cellHandler.HandleCheck(this, cell, accessor); } cell = cell.More; } }
protected virtual nfloat GetRowWidth(ICellHandler cell, int row, CGSize cellSize) { var item = DataViewHandler.GetItem(row); var val = GetObjectValue(item); return(cell.GetPreferredSize(val, cellSize, row, item)); }
private void CheckRow(Parse row) { Parse cell = row.Parts; //first set input params foreach (DbParameterAccessor accessor in accessors) { ICellHandler cellHandler = CellOperation.GetHandler(this, cell, accessor.ParameterType); if (!accessor.IsBoundToCheckOperation) { cellHandler.HandleInput(this, cell, accessor); } cell = cell.More; } if (expectException) { try { command.ExecuteNonQuery(); Wrong(row); } catch (Exception e) { row.Parts.Last.More = new Parse("td", Gray(e.ToString()), null, null); if (errorCode.HasValue) { if (this.dbEnvironment.GetExceptionCode(e) == errorCode) { Right(row); } else { Wrong(row); } } else { Right(row); } } } else { command.ExecuteNonQuery(); //evaluate output params cell = row.Parts; foreach (DbParameterAccessor accessor in accessors) { ICellHandler cellHandler = CellOperation.GetHandler(this, cell, accessor.ParameterType); if (accessor.IsBoundToCheckOperation) { cellHandler.HandleCheck(this, cell, accessor); } cell = cell.More; } } }
public virtual void FormatCell(IGridColumnHandler column, ICellHandler cell, sw.FrameworkElement element, swc.DataGridCell gridcell, object dataItem) { if (IsEventHandled(Grid.CellFormattingEvent)) { var row = Control.Items.IndexOf(dataItem); Callback.OnCellFormatting(Widget, new FormatEventArgs(column.Widget as GridColumn, gridcell, dataItem, row, element)); } }
public void CellEdited(ICellHandler cell, sw.FrameworkElement element) { var dataCell = element.GetVisualParent <swc.DataGridCell>(); var dataRow = element.GetVisualParent <swc.DataGridRow>(); var row = dataRow.GetIndex(); var dataItem = element.DataContext; GridHandler.CellEdited(row, dataCell.Column, dataItem); }
public void Clear() { if (_lastSelectedCell != null) { _lastSelectedCell.IsSelected = false; _lastSelectedCell = null; _turnController.Clear(); } }
public sw.FrameworkElement SetupCell(ICellHandler cell, sw.FrameworkElement defaultContent) { if (this.GridHandler != null) { return(this.GridHandler.SetupCell(this, defaultContent)); } else { return(defaultContent); } }
private void RunRow(Parse row) { Parse cell = row.Parts; //first set input params foreach (DbParameterAccessor accessor in columnBindings) { ICellHandler cellHandler = CellOperation.GetHandler(this, cell, accessor.ParameterType); cellHandler.HandleInput(this, cell, accessor); cell = cell.More; } command.ExecuteNonQuery(); }
private void CheckMatchingRow(Parse row, DataRow d) { SetTargetObject(d); Parse cell = row.Parts; foreach (Accessor accessor in accessors) { ICellHandler cellHandler = CellOperation.GetHandler(this, cell, accessor.ParameterType); cellHandler.HandleCheck(this, cell, accessor); cell = cell.More; } }
public override void HandleCheck(Fixture fixture, Parse cell, Accessor accessor) { string expected = cell.Text.Substring("fail[".Length, cell.Text.Length - ("fail[".Length + 1)); Parse newCell = new Parse("td", expected, null, null); ICellHandler handler = CellOperation.GetHandler(fixture, newCell, accessor.ParameterType); if (handler.HandleEvaluate(fixture, newCell, accessor)) { fixture.Wrong(cell); } else { fixture.Right(cell); } }
public void CellEdited(ICellHandler cell, sw.FrameworkElement element) { var dataCell = element.GetVisualParent <swc.DataGridCell>(); var dataRow = element.GetVisualParent <swc.DataGridRow>(); // These can sometimes be null, but I'm not exactly sure why // It could possibly be if another event occurs to refresh the data before this call? // either way, if we aren't part of a row/cell, just don't raise the event. if (dataRow == null || dataCell == null) { return; } var row = dataRow.GetIndex(); var dataItem = element.DataContext; GridHandler.CellEdited(row, dataCell.Column, dataItem); }
private bool IsMatch(Parse row, DataRow d) { SetTargetObject(d); Parse cell = row.Parts; foreach (DataColumnAccessor accessor in accessors) { ICellHandler cellHandler = CellOperation.GetHandler(this, cell, accessor.ParameterType); if (accessor.IsUsedForMatching() && (!cellHandler.HandleEvaluate(this, cell, accessor))) { return(false); } cell = cell.More; } return(true); }
/** * Traverse cell range from top left to bottom right cell. * @param handler handler to call on each appropriate cell */ public void Traverse(ICellHandler handler) { int firstRow = range.FirstRow; int lastRow = range.LastRow; int firstColumn = range.FirstColumn; int lastColumn = range.LastColumn; int width = lastColumn - firstColumn + 1; SimpleCellWalkContext ctx = new SimpleCellWalkContext(); IRow currentRow = null; ICell currentCell = null; for (ctx.rowNumber = firstRow; ctx.rowNumber <= lastRow; ++ctx.rowNumber) { currentRow = sheet.GetRow(ctx.rowNumber); if (currentRow == null) { continue; } for (ctx.colNumber = firstColumn; ctx.colNumber <= lastColumn; ++ctx.colNumber) { currentCell = currentRow.GetCell(ctx.colNumber); if (currentCell == null) { continue; } if (IsEmpty(currentCell) && !traverseEmptyCells) { continue; } ctx.ordinalNumber = (ctx.rowNumber - firstRow) * width + (ctx.colNumber - firstColumn + 1); handler.OnCell(currentCell, ctx); } } }
public GameCell(ICellHandler cellHandler, int width, int height) { Width = width; Height = height; _handler = cellHandler; IsEnabled = _handler?.IsEnabled ?? false; Children.Add(ControlUtils.ConstructImage(_handler.CellColor)); _shapeImage = ControlUtils.ConstructImage(_handler.CellState); _shapeImage.Width = width * 0.6; _shapeImage.Height = Height * 0.6; Children.Add(_shapeImage); _border = new Border(); Children.Add(_border); UpdateCellContent(); SelectChanged(false); AttachHandlers(); }
public bool CanSelect(ICellHandler cellHandler) { if (cellHandler == null) { return(false); } // Deselect cell if (_lastSelectedCell == cellHandler) { _lastSelectedCell = null; return(true); } if (!IsSelectionAvaliable) { return(false); } if (_lastSelectedCell == null) { if (_turnController.CheckTurnStart(cellHandler.CellIdx) && cellHandler.CellState.IsSameSide(_turnController.Side)) { _lastSelectedCell = cellHandler; return(true); } return(false); } if (cellHandler.CellState == CellState.Empty) { var result = _turnController.TryMakeTurn(_lastSelectedCell.CellIdx, cellHandler.CellIdx); switch (result) { case TurnsConstructor.Result.Fail: { return(false); } case TurnsConstructor.Result.Ok: { if (_lastSelectedCell != null) { _lastSelectedCell.IsSelected = false; _lastSelectedCell = null; } return(false); } case TurnsConstructor.Result.Continue: { _lastSelectedCell.IsSelected = false; _lastSelectedCell = cellHandler; return(true); } } } return(false); }
public sw.FrameworkElement SetupCell(ICellHandler cell, sw.FrameworkElement defaultContent) { return(GridHandler != null?GridHandler.SetupCell(this, defaultContent) : defaultContent); }
public sw.FrameworkElement SetupCell(ICellHandler handler, sw.FrameworkElement defaultContent, swc.DataGridCell cell) { return(GridHandler != null?GridHandler.SetupCell(this, defaultContent, cell) : defaultContent); }