private void FillMethods()
{
if (!this.filledMethods)
{
if (this.realEvent == null)
{
this.realEvent = this.componentClass.GetEvent(this.Name);
if (this.realEvent != null)
{
this.FillMethods();
return;
}
Type[] args = new Type[] { this.type };
this.addMethod = MemberDescriptor.FindMethod(this.componentClass, "AddOn" + this.Name, args, typeof(void));
this.removeMethod = MemberDescriptor.FindMethod(this.componentClass, "RemoveOn" + this.Name, args, typeof(void));
if ((this.addMethod == null) || (this.removeMethod == null))
{
throw new ArgumentException(SR.GetString("ErrorMissingEventAccessors", new object[] { this.Name }));
}
}
else
{
this.addMethod = this.realEvent.GetAddMethod();
this.removeMethod = this.realEvent.GetRemoveMethod();
EventInfo info = null;
if ((this.addMethod == null) || (this.removeMethod == null))
{
Type baseType = this.componentClass.BaseType;
while ((baseType != null) && (baseType != typeof(object)))
{
BindingFlags bindingAttr = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
EventInfo info2 = baseType.GetEvent(this.realEvent.Name, bindingAttr);
if (info2.GetAddMethod() != null)
{
info = info2;
break;
}
}
}
if (info != null)
{
this.addMethod = info.GetAddMethod();
this.removeMethod = info.GetRemoveMethod();
this.type = info.EventHandlerType;
}
else
{
this.type = this.realEvent.EventHandlerType;
}
}
this.filledMethods = true;
}
}