public void Fetch()
{
foreach (var dk in _mappings)
{
Element element = dk.Key;
MemberInfo mi = dk.Value.Member;
object obj = dk.Value.Obj;
if (element is DateTimeElement)
SetValue(mi, obj, ((DateTimeElement)element).DateValue);
else if (element is FloatElement)
SetValue(mi, obj, ((FloatElement)element).Value);
else if (element is BooleanElement)
SetValue(mi, obj, ((BooleanElement)element).Value);
else if (element is CheckboxElement)
SetValue(mi, obj, ((CheckboxElement)element).Value);
else if (element is EntryElement)
{
var entry = (EntryElement)element;
// TODO: entry.FetchValue();
SetValue(mi, obj, entry.Value);
}
else if (element is ImageElement)
SetValue(mi, obj, ((ImageElement)element).Value);
else if (element is RootElement)
{
var re = element as RootElement;
if (re._group as MemberRadioGroup != null)
{
var group = re._group as MemberRadioGroup;
SetValue(group.mi, obj, re.RadioSelected);
}
else if (re._group as RadioGroup != null)
{
var mType = GetTypeForMember(mi);
var fi = mType.GetFields(BindingFlags.Public | BindingFlags.Static)[re.RadioSelected];
SetValue(mi, obj, fi.GetValue(null));
}
}
}
}
}