private void CheckProjectCombo(string projName, FwOverrideComboBox projCombo,
ImportDomain domain)
{
string ptShortName = GetPTShortName(projCombo);
// if the project name was set successfully to the contents of the short name from the combobox.
if (projName != null && projName.Equals(ptShortName))
{
// no problems with the selected item. We're finished.
return;
}
// If the project name is null but the selected project is "none" then the selected
// item is fine. The selected project is "none" when the domain in back translation
// or notes and the selected index in the combobox is 0.
if ((domain == ImportDomain.BackTrans || domain == ImportDomain.Annotations) &&
projCombo.SelectedIndex == 0)
{
return;
}
// However, if the project name is null and the selected item in the combo box
// is something else, then we need to throw an exception so that the user will
// be notified about a problem with the project that they selected.
throw new ParatextLoadException(string.Format(TeResourceHelper.GetResourceString(
"kstidParatextProjectLoadFailure"), ptShortName), null);
}