diff --git a/XenAdmin/Controls/CheckableDataGridView/CheckableDataGridView.cs b/XenAdmin/Controls/CheckableDataGridView/CheckableDataGridView.cs
index f78992cbd..3089235a0 100644
--- a/XenAdmin/Controls/CheckableDataGridView/CheckableDataGridView.cs
+++ b/XenAdmin/Controls/CheckableDataGridView/CheckableDataGridView.cs
@@ -43,6 +43,7 @@ namespace XenAdmin.Controls.CheckableDataGridView
public class CheckableDataGridViewRowEventArgs : EventArgs
{
public int RowIndex { get; set; }
+ public bool RefreshGrid { get; set; }
}
///
@@ -340,11 +341,11 @@ namespace XenAdmin.Controls.CheckableDataGridView
}
[EditorBrowsable(EditorBrowsableState.Never)]
- public void TriggerRowUpdatedEvent(int rowUpdated)
+ public void TriggerRowUpdatedEvent(int rowUpdated, bool refreshGrid)
{
RowUpdatedEvent handler = Events[RowUpdatedEventKey] as RowUpdatedEvent;
if (handler != null)
- handler.Invoke(this, new CheckableDataGridViewRowEventArgs { RowIndex = rowUpdated });
+ handler.Invoke(this, new CheckableDataGridViewRowEventArgs { RowIndex = rowUpdated, RefreshGrid = refreshGrid });
}
[EditorBrowsable(EditorBrowsableState.Never)]
diff --git a/XenAdmin/Controls/CheckableDataGridView/CheckableDataGridViewController.cs b/XenAdmin/Controls/CheckableDataGridView/CheckableDataGridViewController.cs
index 2d6e18993..80926b731 100644
--- a/XenAdmin/Controls/CheckableDataGridView/CheckableDataGridViewController.cs
+++ b/XenAdmin/Controls/CheckableDataGridView/CheckableDataGridViewController.cs
@@ -108,7 +108,7 @@ namespace XenAdmin.Controls.CheckableDataGridView
CheckableDataGridViewRow row = sender as CheckableDataGridViewRow;
if(row == null)
return;
- UpdateRow(row);
+ UpdateRow(row, true);
}
public List CheckedRows
@@ -122,7 +122,7 @@ namespace XenAdmin.Controls.CheckableDataGridView
return;
storedRows.ForEach(r=>r.Highlighted = false);
storedRows[rowIndex].Highlighted = true;
- UpdateRow(storedRows[rowIndex]);
+ UpdateRow(storedRows[rowIndex], false);
View.DrawRowAsHighlighted(storedRows[rowIndex].Highlighted, rowIndex);
}
@@ -188,7 +188,7 @@ namespace XenAdmin.Controls.CheckableDataGridView
/// Pass in the replacement row
///
/// Replacement Row
- private void UpdateRow(CheckableDataGridViewRow toUpdate)
+ private void UpdateRow(CheckableDataGridViewRow toUpdate, bool refreshGrid)
{
if (toUpdate == null)
return;
@@ -208,7 +208,7 @@ namespace XenAdmin.Controls.CheckableDataGridView
View.DrawUpdatedRow(storedRows[indexToUpdate].CellText, storedRows[indexToUpdate].CellDataLoaded,
storedRows[indexToUpdate].Disabled, indexToUpdate);
}
- View.TriggerRowUpdatedEvent(indexToUpdate);
+ View.TriggerRowUpdatedEvent(indexToUpdate, refreshGrid);
}
private int ReplaceStoredRow(CheckableDataGridViewRow toUpdate)
@@ -224,6 +224,7 @@ namespace XenAdmin.Controls.CheckableDataGridView
if (indexToUpdate >= storedRows.Count || indexToUpdate < 0)
{
log.DebugFormat("Unexpected index in ReplaceStoredRow row '{0}'; Stored rows contain '{1}' items", indexToUpdate, storedRows.Count);
+ return -1;
}
storedRows.Remove(storedRows[indexToUpdate]);
storedRows.Insert(indexToUpdate, toUpdate);
diff --git a/XenAdmin/Controls/CheckableDataGridView/ICheckableDataGridViewView.cs b/XenAdmin/Controls/CheckableDataGridView/ICheckableDataGridViewView.cs
index b04f9b619..a6e6c3143 100644
--- a/XenAdmin/Controls/CheckableDataGridView/ICheckableDataGridViewView.cs
+++ b/XenAdmin/Controls/CheckableDataGridView/ICheckableDataGridViewView.cs
@@ -40,7 +40,7 @@ namespace XenAdmin.Controls.CheckableDataGridView
void DrawRowAsChecked(bool checkStatus, int rowIndex);
void DrawRowAsHighlighted(bool highlightStatus, int rowIndex);
void DrawRowAsDisabled(bool disabledStatus, int rowIndex);
- void TriggerRowUpdatedEvent(int rowUpdated);
+ void TriggerRowUpdatedEvent(int rowUpdated, bool refreshGrid);
void TriggerRowCheckedEvent(int rowChecked);
void DrawUpdatedRow(Queue