/// <summary> /// Creates a change state that reflects the move of some rows (in all columns). /// </summary> /// <param name="numberOfColumns">The number of columns in the table.</param> /// <param name="firstRowNumber">The first row number that was affected.</param> /// <param name="maxRowNumber">One more than the last affected row number.</param> /// <returns>The change state that reflects the move.</returns> public static DataColumnCollectionChangedEventArgs CreateRowMoveArgs(int numberOfColumns, int firstRowNumber, int maxRowNumber) { var args = new DataColumnCollectionChangedEventArgs(0, firstRowNumber, maxRowNumber, false) { _maxColChanged = numberOfColumns }; return(args); }
/// <summary> /// Creates a change state that reflects the move of some columns. /// </summary> /// <param name="firstColumnNumber">The first column number that was removed.</param> /// <param name="maxColumnNumber">One more than the last affected column.</param> /// <returns>The change state that reflects the move.</returns> public static DataColumnCollectionChangedEventArgs CreateColumnMoveArgs(int firstColumnNumber, int maxColumnNumber) { var args = new DataColumnCollectionChangedEventArgs(firstColumnNumber, 0, 0, false) { _maxColChanged = maxColumnNumber }; return(args); }
/// <summary> /// Creates a change state that reflects the removal of some columns. /// </summary> /// <param name="firstColumnNumber">The first column number that was removed.</param> /// <param name="originalNumberOfColumns">The number of columns in the collection before the removal.</param> /// <param name="maxRowCountOfRemovedColumns">The maximum row count of the removed columns.</param> /// <returns>The change state that reflects the removal.</returns> public static DataColumnCollectionChangedEventArgs CreateColumnRemoveArgs(int firstColumnNumber, int originalNumberOfColumns, int maxRowCountOfRemovedColumns) { var args = new DataColumnCollectionChangedEventArgs(firstColumnNumber, 0, maxRowCountOfRemovedColumns, true); if (originalNumberOfColumns > args._maxColChanged) { args._maxColChanged = originalNumberOfColumns; } return(args); }
/// <summary> /// Accumulate the change state by adding another change state. /// </summary> /// <param name="args">The other change state to be added.</param> public void Accumulate(DataColumnCollectionChangedEventArgs args) { if (args._minColChanged < this._minColChanged) this._minColChanged = args._minColChanged; if (args._maxColChanged > this._maxColChanged) this._maxColChanged = args._maxColChanged; if (args._minRowChanged < this._minRowChanged) this._minRowChanged = args._minRowChanged; if (args.MaxRowChanged > this._maxRowChanged) this._maxRowChanged = args._maxRowChanged; _hasRowCountDecreased |= args._hasRowCountDecreased; }
/// <summary> /// Accumulate the change state by adding another change state. /// </summary> /// <param name="args">The other change state to be added.</param> public void Accumulate(DataColumnCollectionChangedEventArgs args) { if (args._minColChanged < _minColChanged) { _minColChanged = args._minColChanged; } if (args._maxColChanged > _maxColChanged) { _maxColChanged = args._maxColChanged; } if (args._minRowChanged < _minRowChanged) { _minRowChanged = args._minRowChanged; } if (args.MaxRowChanged > _maxRowChanged) { _maxRowChanged = args._maxRowChanged; } _hasRowCountDecreased |= args._hasRowCountDecreased; }
/// <summary> /// Create the change state that reflects the replace of one column by another (or copying data). /// </summary> /// <param name="columnIndex">The index of the column to replace.</param> /// <param name="oldRowCount">The row count of the old (replaced) column.</param> /// <param name="newRowCount">The row count of the new column.</param> /// <returns>The newly created ChangeEventArgs for this case.</returns> public static DataColumnCollectionChangedEventArgs CreateColumnCopyOrReplaceArgs(int columnIndex, int oldRowCount, int newRowCount) { var args = new DataColumnCollectionChangedEventArgs(columnIndex, 0, Math.Max(oldRowCount, newRowCount), newRowCount < oldRowCount); return(args); }
/// <summary> /// Create the change state that reflects the renaming of one column. /// </summary> /// <param name="columnIndex">The index of the renamed column.</param> /// <returns>The newly created ChangeEventArgs for this case.</returns> public static DataColumnCollectionChangedEventArgs CreateColumnRenameArgs(int columnIndex) { var args = new DataColumnCollectionChangedEventArgs(columnIndex, 0, 0, false); return(args); }
/// <summary> /// Create the change state that reflects the addition of one column. /// </summary> /// <param name="columnIndex">The index of the added column.</param> /// <param name="rowCountOfAddedColumn">The row count of the added column.</param> /// <returns>The newly created ChangeEventArgs for this case.</returns> public static DataColumnCollectionChangedEventArgs CreateColumnAddArgs(int columnIndex, int rowCountOfAddedColumn) { var args = new DataColumnCollectionChangedEventArgs(columnIndex, 0, rowCountOfAddedColumn, false); return(args); }
/// <summary> /// Create the change state that reflects the replace of one column by another (or copying data). /// </summary> /// <param name="columnIndex">The index of the column to replace.</param> /// <param name="oldRowCount">The row count of the old (replaced) column.</param> /// <param name="newRowCount">The row count of the new column.</param> /// <returns>The newly created ChangeEventArgs for this case.</returns> public static DataColumnCollectionChangedEventArgs CreateColumnCopyOrReplaceArgs(int columnIndex, int oldRowCount, int newRowCount) { DataColumnCollectionChangedEventArgs args = new DataColumnCollectionChangedEventArgs(columnIndex, 0, Math.Max(oldRowCount, newRowCount), newRowCount < oldRowCount); return args; }
/// <summary> /// Create the change state that reflects the renaming of one column. /// </summary> /// <param name="columnIndex">The index of the renamed column.</param> /// <returns>The newly created ChangeEventArgs for this case.</returns> public static DataColumnCollectionChangedEventArgs CreateColumnRenameArgs(int columnIndex) { DataColumnCollectionChangedEventArgs args = new DataColumnCollectionChangedEventArgs(columnIndex, 0, 0, false); return args; }
/// <summary> /// Create the change state that reflects the addition of one column. /// </summary> /// <param name="columnIndex">The index of the added column.</param> /// <param name="rowCountOfAddedColumn">The row count of the added column.</param> /// <returns>The newly created ChangeEventArgs for this case.</returns> public static DataColumnCollectionChangedEventArgs CreateColumnAddArgs(int columnIndex, int rowCountOfAddedColumn) { DataColumnCollectionChangedEventArgs args = new DataColumnCollectionChangedEventArgs(columnIndex, 0, rowCountOfAddedColumn, false); return args; }
/// <summary> /// Creates a change state that reflects the move of some rows (in all columns). /// </summary> /// <param name="numberOfColumns">The number of columns in the table.</param> /// <param name="firstRowNumber">The first row number that was affected.</param> /// <param name="maxRowNumber">One more than the last affected row number.</param> /// <returns>The change state that reflects the move.</returns> public static DataColumnCollectionChangedEventArgs CreateRowMoveArgs(int numberOfColumns, int firstRowNumber, int maxRowNumber) { DataColumnCollectionChangedEventArgs args = new DataColumnCollectionChangedEventArgs(0, firstRowNumber, maxRowNumber, false); args._maxColChanged = numberOfColumns; return args; }
/// <summary> /// Creates a change state that reflects the move of some columns. /// </summary> /// <param name="firstColumnNumber">The first column number that was removed.</param> /// <param name="maxColumnNumber">One more than the last affected column.</param> /// <returns>The change state that reflects the move.</returns> public static DataColumnCollectionChangedEventArgs CreateColumnMoveArgs(int firstColumnNumber, int maxColumnNumber) { DataColumnCollectionChangedEventArgs args = new DataColumnCollectionChangedEventArgs(firstColumnNumber, 0, 0, false); args._maxColChanged = maxColumnNumber; return args; }
/// <summary> /// Creates a change state that reflects the removal of some columns. /// </summary> /// <param name="firstColumnNumber">The first column number that was removed.</param> /// <param name="originalNumberOfColumns">The number of columns in the collection before the removal.</param> /// <param name="maxRowCountOfRemovedColumns">The maximum row count of the removed columns.</param> /// <returns>The change state that reflects the removal.</returns> public static DataColumnCollectionChangedEventArgs CreateColumnRemoveArgs(int firstColumnNumber, int originalNumberOfColumns, int maxRowCountOfRemovedColumns) { DataColumnCollectionChangedEventArgs args = new DataColumnCollectionChangedEventArgs(firstColumnNumber, 0, maxRowCountOfRemovedColumns, true); if (originalNumberOfColumns > args._maxColChanged) args._maxColChanged = originalNumberOfColumns; return args; }