Merge pull request #120 from MihaelaStoica/CA-139588

CA-139588: Try to prevent Index was out of range exception by invoking o...
This commit is contained in:
Stephen Turner 2014-07-10 14:44:26 +01:00
commit 8deb94d290

View File

@ -119,20 +119,25 @@ namespace XenAdmin.Dialogs
private void checkableDataGridView_RowUpdated(object sender, CheckableDataGridViewRowEventArgs e)
{
LicenseCheckableDataGridView senderGrid = sender as LicenseCheckableDataGridView;
if (senderGrid == null || e.RowIndex >= senderGrid.Rows.Count || e.RowIndex < 0)
if (senderGrid == null)
return;
LicenseDataGridViewRow lRow = senderGrid.Rows[e.RowIndex] as LicenseDataGridViewRow;
if (lRow == null)
return;
Program.Invoke(this, delegate
{
if (e.RowIndex >= senderGrid.Rows.Count || e.RowIndex < 0)
return;
Controller.SetStatusIcon(e.RowIndex, lRow.RowStatus);
LicenseDataGridViewRow lRow = senderGrid.Rows[e.RowIndex] as LicenseDataGridViewRow;
if (lRow == null)
return;
if (senderGrid.SelectedRows.Count >= 1 && senderGrid.SelectedRows[0].Index == e.RowIndex)
{
Controller.SummariseSelectedRow(checkableDataGridView.GetCheckableRow(e.RowIndex));
}
Controller.SetStatusIcon(e.RowIndex, lRow.RowStatus);
if (senderGrid.SelectedRows.Count > 0 && senderGrid.SelectedRows[0].Index == e.RowIndex)
{
Controller.SummariseSelectedRow(checkableDataGridView.GetCheckableRow(e.RowIndex));
}
});
if (e.RefreshGrid)
senderGrid.SortAndRefresh();
}