public override MethodInfo GetAddMethod(bool nonPublic)
 {
     if ((this.addMethod == null) && (this.declaringType.ResolveType(DesignTimeType.GetTypeNameFromCodeTypeReference(this.codeDomEvent.Type, this.declaringType)) != null))
     {
         CodeMemberMethod methodInfo = new CodeMemberMethod {
             Name       = "add_" + this.name,
             ReturnType = new CodeTypeReference(typeof(void))
         };
         methodInfo.Parameters.Add(new CodeParameterDeclarationExpression(this.codeDomEvent.Type, "Handler"));
         methodInfo.Attributes = this.memberAttributes;
         this.addMethod        = new DesignTimeMethodInfo(this.declaringType, methodInfo, true);
     }
     return(this.addMethod);
 }
 public override MethodInfo GetAddMethod(bool nonPublic)
 {
     if ((this.addMethod == null) && (this.declaringType.ResolveType(DesignTimeType.GetTypeNameFromCodeTypeReference(this.codeDomEvent.Type, this.declaringType)) != null))
     {
         CodeMemberMethod methodInfo = new CodeMemberMethod {
             Name = "add_" + this.name,
             ReturnType = new CodeTypeReference(typeof(void))
         };
         methodInfo.Parameters.Add(new CodeParameterDeclarationExpression(this.codeDomEvent.Type, "Handler"));
         methodInfo.Attributes = this.memberAttributes;
         this.addMethod = new DesignTimeMethodInfo(this.declaringType, methodInfo, true);
     }
     return this.addMethod;
 }
 internal DesignTimeEventInfo(DesignTimeType declaringType, CodeMemberEvent codeDomEvent)
 {
     if (declaringType == null)
     {
         throw new ArgumentNullException("Declaring Type");
     }
     if (codeDomEvent == null)
     {
         throw new ArgumentNullException("codeDomEvent");
     }
     this.declaringType    = declaringType;
     this.codeDomEvent     = codeDomEvent;
     this.name             = Helper.EnsureTypeName(codeDomEvent.Name);
     this.memberAttributes = codeDomEvent.Attributes;
     this.addMethod        = null;
     this.removeMethod     = null;
 }
 internal DesignTimeEventInfo(DesignTimeType declaringType, CodeMemberEvent codeDomEvent)
 {
     if (declaringType == null)
     {
         throw new ArgumentNullException("Declaring Type");
     }
     if (codeDomEvent == null)
     {
         throw new ArgumentNullException("codeDomEvent");
     }
     this.declaringType = declaringType;
     this.codeDomEvent = codeDomEvent;
     this.name = Helper.EnsureTypeName(codeDomEvent.Name);
     this.memberAttributes = codeDomEvent.Attributes;
     this.addMethod = null;
     this.removeMethod = null;
 }
Example #5
0
        public override MethodInfo GetRemoveMethod(bool nonPublic)
        {
            if (this.removeMethod == null)
            {
                Type handlerType = declaringType.ResolveType(DesignTimeType.GetTypeNameFromCodeTypeReference(this.codeDomEvent.Type, declaringType));
                if (handlerType != null)
                {
                    CodeMemberMethod codeRemoveMethod = new CodeMemberMethod();

                    codeRemoveMethod.Name = "remove_" + this.name;
                    codeRemoveMethod.ReturnType = new CodeTypeReference(typeof(void));
                    codeRemoveMethod.Parameters.Add(new CodeParameterDeclarationExpression(handlerType, "Handler"));
                    codeRemoveMethod.Attributes = this.memberAttributes;
                    this.removeMethod = new DesignTimeMethodInfo(declaringType, codeRemoveMethod, true);
                }
            }
            return this.removeMethod;
        }
        public override MethodInfo GetRemoveMethod(bool nonPublic)
        {
            if (this.removeMethod == null)
            {
                Type handlerType = declaringType.ResolveType(DesignTimeType.GetTypeNameFromCodeTypeReference(this.codeDomEvent.Type, declaringType));
                if (handlerType != null)
                {
                    CodeMemberMethod codeRemoveMethod = new CodeMemberMethod();

                    codeRemoveMethod.Name       = "remove_" + this.name;
                    codeRemoveMethod.ReturnType = new CodeTypeReference(typeof(void));
                    codeRemoveMethod.Parameters.Add(new CodeParameterDeclarationExpression(handlerType, "Handler"));
                    codeRemoveMethod.Attributes = this.memberAttributes;
                    this.removeMethod           = new DesignTimeMethodInfo(declaringType, codeRemoveMethod, true);
                }
            }
            return(this.removeMethod);
        }