private FieldComboItem AddStringFieldItemsToCombo(ComboBox combo, FieldComboItem selectedItem, bool fIsSourceCombo)
{
FieldComboItem newSelection = null;
int icol = -1;
foreach (XmlNode node in m_bv.ColumnSpecs)
{
icol++;
FieldReadWriter accessor = null;
string optionLabel = GetColumnLabel(m_mediator, node);
try
{
if (fIsSourceCombo)
accessor = new ManyOnePathSortItemReadWriter(m_cache, node, m_bv, (IApp)m_mediator.PropertyTable.GetValue("App"));
else
accessor = FieldReadWriter.Create(node, m_cache, m_bv.RootObjectHvo);
if (accessor == null)
continue;
// Use the decorated data access - see FWR-376.
accessor.DataAccess = m_bv.SpecialCache;
}
catch
{
Debug.Fail(String.Format("There was an error creating Delete combo item for column ({0})"), optionLabel);
// skip buggy column
continue;
}
FieldComboItem item = new FieldComboItem(optionLabel, icol, accessor);
combo.Items.Add(item);
if (selectedItem != null && selectedItem.ToString() == item.ToString())
newSelection = item;
}
return newSelection;
}