private void SetupXMatterList()
{
var packsToSkip = new string[] {"null", "bigbook", "SHRP", "SHARP", "ForUnitTest"};
_xmatterList.Items.Clear();
ListViewItem itemForFactoryDefault = null;
foreach(var pack in _xmatterPackFinder.All)
{
if (packsToSkip.Any(s => pack.Key.ToLowerInvariant().Contains(s.ToLower())))
continue;
var labelToShow = LocalizationManager.GetDynamicString("Bloom","CollectionSettingsDialog.BookMakingTab.Front/BackMatterPack."+pack.Key, pack.EnglishLabel, "Name of a Front/Back Matter Pack");
var item = _xmatterList.Items.Add(labelToShow);
item.Tag = pack;
if(pack.Key == _collectionSettings.XMatterPackName)
item.Selected = true;
if(pack.Key == _xmatterPackFinder.FactoryDefault.Key)
{
itemForFactoryDefault = item;
}
}
if(itemForFactoryDefault != null && _xmatterList.SelectedItems.Count == 0) //if the xmatter they used to have selected is gone or was renamed or something
itemForFactoryDefault.Selected = true;
if(_xmatterList.SelectedIndices.Count > 0)
_xmatterList.EnsureVisible(_xmatterList.SelectedIndices[0]);
}