Skip to content

Commit

Permalink
Fix for related entry update refresh issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xantari committed Mar 28, 2021
1 parent 24dfb18 commit 385f8ce
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions PinCab.Configurator/DatabaseBrowserForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,16 @@ private void editToolStripMenuItem_Click(object sender, EventArgs e)
var existingEntry = _dbManager.Entries.FirstOrDefault(c => c.Id == dbFile.Id && c.DatabaseName == row.DatabaseName);
_dbManager.MapDatabaseEntryToBrowserEntry(contentDatabase, dbFile, existingEntry);
_dbManager.MapRelatedEntries(existingEntry, contentDatabase, dbFile);

//It could be we updated the title or some other bit of info about this item, therefore go through
//all other related entries in the database cache and update them
var relatedEntriesToUpdate = _dbManager.Entries.Where(c => c.RelatedEntries.Any(g => g.Id == dbFile.Id));
foreach(var relatedEntry in relatedEntriesToUpdate)
{
var entryToUpdate = relatedEntry.RelatedEntries.First(c => c.Id == dbFile.Id);
_dbManager.MapDatabaseEntryToBrowserEntry(contentDatabase, dbFile, entryToUpdate);
}

_dbManager.SaveDatabaseCache<List<DatabaseBrowserEntry>>(_dbManager.Entries, _dbManager.PreprocessedDatabasePath);

//Refresh grid (will do that automatically)
Expand Down

0 comments on commit 385f8ce

Please sign in to comment.