test

Source

private void Paste()

{

if (this.startEditButton.Enabled)

{

MessageBox.Show("No edit mode. Cannot paste", "Error");

return;

}

// change gui to local edits

this.SetStartLocalEditGUI();

// first copy rows

int numCopyRows = this.copyRows.Count;

int copyRowIndex = 0;

// get id attribute id

int idAttributeId = this.categoryAccessor.GetIdAttributeId();

foreach (DataGridViewRow row in this.dataGridView1.SelectedRows)

{

if (copyRowIndex >= numCopyRows) break;

DataGridViewRow copyRow = this.copyRows[copyRowIndex];

if (row.Cells.Count != copyRow.Cells.Count) break;

int cellIndex = 0;

foreach (DataGridViewCell cell in row.Cells)

{

if (((int)cell.OwningColumn.Tag != idAttributeId) && (!cell.ReadOnly))

{

cell.Value = copyRow.Cells[cellIndex].Value;

this.editState[this.activeCategory].AfterEditCell(this.dataGridView1, cell);

}

cellIndex++;

}

copyRowIndex++;

}

// now copy cells - only copy to selected cells. stop if either no more copyCells or selectedCells

int numCopyCells = this.copyCells.Count;

int copyCellIndex = 0;

foreach (DataGridViewCell cell in this.dataGridView1.SelectedCells)

{

if (copyCellIndex >= numCopyCells) break;

DataGridViewCell copyCell = this.copyCells[copyCellIndex];

if (!cell.ReadOnly)

{

cell.Value = copyCell.Value;

this.editState[this.activeCategory].AfterEditCell(this.dataGridView1, cell);

}

copyCellIndex++;

}

String temp = Clipboard.GetText();

this.GuiSetLocalCommitState();

}

private void Paste()

{

if (this.startEditButton.Enabled)

{

MessageBox.Show("No edit mode. Cannot paste", "Error");

return;

}

// change gui to local edits

this.SetStartLocalEditGUI();

// first copy rows

int numCopyRows = this.copyRows.Count;

int copyRowIndex = 0;

// get id attribute id

int idAttributeId = this.categoryAccessor.GetIdAttributeId();

foreach (DataGridViewRow row in this.dataGridView1.SelectedRows)

{

if (copyRowIndex >= numCopyRows) break;

DataGridViewRow copyRow = this.copyRows[copyRowIndex];

if (row.Cells.Count != copyRow.Cells.Count) break;

int cellIndex = 0;

foreach (DataGridViewCell cell in row.Cells)

{

if (((int)cell.OwningColumn.Tag != idAttributeId) && (!cell.ReadOnly))

{

cell.Value = copyRow.Cells[cellIndex].Value;

this.editState[this.activeCategory].AfterEditCell(this.dataGridView1, cell);

}

cellIndex++;

}

copyRowIndex++;

}

// now copy cells - only copy to selected cells. stop if either no more copyCells or selectedCells

int numCopyCells = this.copyCells.Count;

int copyCellIndex = 0;

foreach (DataGridViewCell cell in this.dataGridView1.SelectedCells)

{

if (copyCellIndex >= numCopyCells) break;

DataGridViewCell copyCell = this.copyCells[copyCellIndex];

if (!cell.ReadOnly)

{

cell.Value = copyCell.Value;

this.editState[this.activeCategory].AfterEditCell(this.dataGridView1, cell);

}

copyCellIndex++;

}

String temp = Clipboard.GetText();

this.GuiSetLocalCommitState();

}