private void LoadParatextProjectCombos()
{
ScrText assocProj = ParatextHelper.GetAssociatedProject(m_cache.ProjectId);
//Ignore the case that there is information already in the combobox.
//Solution for TE - 4441)
bool loadMappings = false;
if (cboPTLangProj.Items.Count == 0)
{
if (assocProj != null)
{
m_settings.ParatextScrProj = assocProj.Name;
cboPTLangProj.Items.Add(assocProj);
cboPTLangProj.SelectedIndex = 0;
cboPTLangProj.Enabled = false;
loadMappings = true;
}
else
{
cboPTLangProj.Enabled = true;
LoadParatextProjectCombo(cboPTLangProj, m_settings.ParatextScrProj);
}
}
if (cboPTBackTrans.Items.Count == 0)
{
IEnumerable<ScrText> btProjects = assocProj != null ? ParatextHelper.GetBtsForProject(assocProj).ToList() : null;
if (btProjects != null && btProjects.Any())
{
m_settings.ParatextBTProj = btProjects.First().Name;
foreach (ScrText btText in btProjects)
cboPTBackTrans.Items.Add(btText);
cboPTBackTrans.SelectedIndex = 0;
cboPTBackTrans.Enabled = (btProjects.Count() > 1);
loadMappings = true;
}
else
{
// Add '(none)' as the first item in the arrays for back translation
cboPTBackTrans.Items.Add(s_noneProject);
cboPTBackTrans.Enabled = true;
LoadParatextProjectCombo(cboPTBackTrans, m_settings.ParatextBTProj);
}
}
if (cboPTTransNotes.Items.Count == 0)
{
// Add '(none)' as the first item in the arrays for translation notes
cboPTTransNotes.Items.Add(s_noneProject);
LoadParatextProjectCombo(cboPTTransNotes, m_settings.ParatextNotesProj);
}
if (loadMappings)
ParatextHelper.LoadProjectMappings(m_settings);
}