public override void LoadViewState(object state)
{
object[] states = state as object[];
ResourceManager rm = this.ResourceManager;
if (rm != null && !rm.ManageEventsViewState)
{
base.LoadViewState(state);
}
if (states != null)
{
foreach (Pair pair in states)
{
string directEventName = (string)pair.First;
object directEventState = pair.Second;
if (directEventName == "base")
{
base.LoadViewState(directEventState);
}
else
{
PropertyInfo property = this.GetType().GetProperty(directEventName);
if (property == null)
{
throw new InvalidOperationException("Can't find the property '{0}'".FormatWith(directEventName));
}
ComponentDirectEvent componentDirectEvent = (ComponentDirectEvent)property.GetValue(this, null);
if (componentDirectEvent != null)
{
componentDirectEvent.LoadViewState(directEventState);
}
}
}
}
else
{
base.LoadViewState(state);
}
}
}