public void SetInfo(string name, Dictionary<string, string> information)
{
if (!String.IsNullOrEmpty(name))
{
lblName.Text = name;
}
else
{
lblName.Text = UNKNOWN_TEXT;
}
if (information != null)
{
List<string> fields = information.Keys.ToList<string>();
List<string> values = information.Values.ToList<string>();
//Set the information
for (int i = 0; i < information.Count && i < NUM_LABELS; i++)
{
if (!String.IsNullOrEmpty(fields[i]))
{
m_fieldLabels[i].Text = fields[i];
if (!fields[i].EndsWith(":"))
{
m_fieldLabels[i].Text += ":";
}
}
else //SRS requirement to display "Unknown" if information is unavailable (shouldn't happen)
{
m_fieldLabels[i].Text = UNKNOWN_TEXT;
}
if (!String.IsNullOrEmpty(values[i]))
{
m_valueLabels[i].Text = values[i];
}
else //SRS requirement to display "Unknown" if information is unavailable (shouldn't happen)
{
m_valueLabels[i].Text = UNKNOWN_TEXT;
}
m_fieldLabels[i].Visible = m_valueLabels[i].Visible = true;
}
//Hide the unused labels
for (int i = information.Count; i < NUM_LABELS; i++)
{
m_fieldLabels[i].Visible = m_valueLabels[i].Visible = false;
}
AdjustLabelPositions();
}
}