private eFileStatus CheckConfigSettings()
{
mFileStatus = mXMLHelper.CheckElement(eElementName.StartLanguage.ToString(), out mContent);
if (eFileStatus.OK != mFileStatus)
{
return mFileStatus;
}
else if (eFileStatus.OK == mFileStatus && mContent.Length == 0)
{
mFileStatus = ShowInputFormForElement(eElementName.StartLanguage);
if (eFileStatus.OK != mFileStatus)
{
return mFileStatus;
}
}
mFileStatus = mXMLHelper.CheckElement(eElementName.ExportPath.ToString(), out mContent);
if (eFileStatus.OK != mFileStatus)
{
return mFileStatus;
}
else if (eFileStatus.OK == mFileStatus && mContent.Length == 0)
{
mFileStatus = ShowInputFormForElement(eElementName.ExportPath);
if (eFileStatus.OK != mFileStatus)
{
return mFileStatus;
}
}
}
eFileStatus is an enum and so is mFileStatus. Basically, CheckElement() checks if an element in an XML is empty or not. Next, if there is an error (it is not equal to eFileStatus.OK) then it will return the value of mFileStatus. Otherwise, if there is no error and the element is empty, it will call the ShowInputFormForElement() method to enable the user to fill up the value for the element.
There are more than two elements to check and I would like to learn how to do this better.