public static bool CancelPushUndoStackIfNoChanges(DataGridView dataGridView) { if (IsDoingUndoRedo) { return(true); } if (dataGridView.TopLeftHeaderCell.Tag == null) { dataGridView.TopLeftHeaderCell.Tag = new DataGridViewGenericData(); } if (dataGridView.TopLeftHeaderCell.Tag.GetType() != typeof(DataGridViewGenericData)) { return(true); } DataGridViewGenericData undoAndRedo = (DataGridViewGenericData)dataGridView.TopLeftHeaderCell.Tag; Dictionary <CellLocation, DataGridViewGenericCell> peekCells = undoAndRedo.UndoCellsStack.Count == 0 ? null : undoAndRedo.UndoCellsStack.Peek(); bool isEqual = true; if (peekCells == null) { isEqual = false; } if (isEqual) { foreach (CellLocation cellLocation in peekCells.Keys) { DataGridViewGenericCell dataGridViewGenericCell = DataGridViewHandler.CopyCellDataGridViewGenericCell(dataGridView, cellLocation.ColumnIndex, cellLocation.RowIndex); if (peekCells[cellLocation] != dataGridViewGenericCell) { isEqual = false; break; } } } if (isEqual) { undoAndRedo.UndoCellsStack.Pop(); } return(isEqual); }
public DataGridViewGenericRowAndValue(string headerName, PropertyKey propertyKey, bool cellReadOnly) { DataGridViewGenericRow = new DataGridViewGenericRow(headerName); DataGridViewGenericCell = new DataGridViewGenericCell(null, new DataGridViewGenericCellStatus(cellReadOnly)); }
public DataGridViewGenericRowAndValue(DataGridViewGenericRow dataGridViewGenericRow, DataGridViewGenericCell dataGridViewGenericCell) { DataGridViewGenericRow = dataGridViewGenericRow; DataGridViewGenericCell = dataGridViewGenericCell; }
public DataGridViewGenericCell(DataGridViewGenericCell dataGridViewGenericCell) : this(dataGridViewGenericCell.Value, dataGridViewGenericCell.CellStatus) { }
public DataGridViewGenericRowAndValue(string headerName, string rowName, PropertyKey propertyKey, ReadWriteAccess readWriteAccess, bool isMultiLine, bool cellReadyOnly, object value) { DataGridViewGenericRow = new DataGridViewGenericRow(headerName, rowName, readWriteAccess, isMultiLine, propertyKey); DataGridViewGenericCell = new DataGridViewGenericCell(value, new DataGridViewGenericCellStatus(cellReadyOnly)); }