public override void PageLoaded(PageLoadedDirection direction) { base.PageLoaded(direction); if (direction == PageLoadedDirection.Back) { if (dataGridViewPatches.SelectedRows.Count == 0) { return; } // refresh selected row if the update type is Existing (i.e. the update has been uploaded) int selectedIndex = dataGridViewPatches.SelectedRows[0].Index; string updateName = dataGridViewPatches.Rows[selectedIndex].Cells[ColumnUpdate.Index].Value.ToString(); if (SelectedUpdateType == UpdateType.Existing && (updateName.EndsWith(".xsoem") || updateName.EndsWith(".xsupdate"))) { // remove selected row and add a new one dataGridViewPatches.Rows.RemoveAt(selectedIndex); var row = new PatchGridViewRow(SelectedExistingPatch); if (!dataGridViewPatches.Rows.Contains(row)) { dataGridViewPatches.Rows.Add(row); row.UpdateDetails(); } row.Selected = true; } return; } PopulatePatchesBox(); UpdateEnablement(); }
private void PopulatePatchesBox() { dataGridViewPatches.Rows.Clear(); foreach (IXenConnection xenConnection in ConnectionsManager.XenConnectionsCopy) { foreach (Pool_patch patch in xenConnection.Cache.Pool_patches) { if (patch.size > 0) { PatchGridViewRow row = new PatchGridViewRow(patch); if (!dataGridViewPatches.Rows.Contains(row)) { dataGridViewPatches.Rows.Add(row); row.UpdateDetails(); } } } } dataGridViewPatches.Sort(ColumnUpdate, ListSortDirection.Ascending); }