mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
Merge pull request #111 from MihaelaStoica/CA-137470
CA-137470: Fixed unhandled exception raised by pressing space key on gri...
This commit is contained in:
commit
077cf39366
@ -43,6 +43,7 @@ namespace XenAdmin.Controls.CheckableDataGridView
|
||||
public class CheckableDataGridViewRowEventArgs : EventArgs
|
||||
{
|
||||
public int RowIndex { get; set; }
|
||||
public bool RefreshGrid { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -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)]
|
||||
|
@ -108,7 +108,7 @@ namespace XenAdmin.Controls.CheckableDataGridView
|
||||
CheckableDataGridViewRow row = sender as CheckableDataGridViewRow;
|
||||
if(row == null)
|
||||
return;
|
||||
UpdateRow(row);
|
||||
UpdateRow(row, true);
|
||||
}
|
||||
|
||||
public List<CheckableDataGridViewRow> 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
|
||||
/// </summary>
|
||||
/// <param name="toUpdate">Replacement Row</param>
|
||||
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);
|
||||
|
@ -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<object> textToUse, bool cellDataLoaded, bool rowDisabled, int rowIndex);
|
||||
void DrawAllRowsAsCleared();
|
||||
|
@ -133,7 +133,8 @@ namespace XenAdmin.Dialogs
|
||||
Controller.SummariseSelectedRow(checkableDataGridView.GetCheckableRow(e.RowIndex));
|
||||
}
|
||||
|
||||
senderGrid.SortAndRefresh();
|
||||
if (e.RefreshGrid)
|
||||
senderGrid.SortAndRefresh();
|
||||
}
|
||||
|
||||
private void checkableDataGridView_SelectionChanged(object sender, EventArgs e)
|
||||
|
Loading…
Reference in New Issue
Block a user